> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sahlfinancial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a webhook endpoint

> Required scope: `webhooks:manage`.

Registers an endpoint. `url` must be https and resolve to a public address (checked again before every delivery); every name in `events` must come from `GET /v1/partner/webhooks/events`. Without `secret`, Sahl generates one (`whsec_...`) and returns it once, in this response only. Deliveries are signed and retried on a schedule.



## OpenAPI

````yaml /openapi.json post /v1/partner/webhooks
openapi: 3.1.0
info:
  title: Sahl Partner API
  version: 0.2.0
  description: >-
    Server-to-server API for lenders and banks: document reading, verification,
    risk assessment, eID checks, Moroccan company (KYB) onboarding, bank
    statements, document requests, webhooks, registry checks, cases, scoring,
    KYC policy, webhook deliveries and bank connections. Authenticate with
    `Authorization: Bearer <API key>`. Paths are relative to the server URL. New
    workspaces start in sandbox.
servers:
  - url: https://app.sahlfinancial.com/api
    description: Single API host. Send environment=sandbox (the default) for test data.
security:
  - bearerAuth: []
tags:
  - name: KYC
    description: Read documents, verify a profile, assess risk, start an eID check.
  - name: Bank connections (Growth)
    description: >-
      Growth plan, switched on per workspace by Sahl. Sandbox simulation today;
      production answers 409 until a bank data provider is live.
  - name: KYB
    description: >-
      Moroccan company file: read the Modèle J, the IF attestation and the
      manager's CIN, check an ICE. Every plan.
  - name: Statements
    description: Read a bank statement line by line and reconcile it. Every plan.
  - name: Webhooks
    description: >-
      Manage webhook endpoints with an API key (scope `webhooks:manage`). Every
      plan.
  - name: Document requests
    description: >-
      Ask an applicant for documents through a link or an embedded page, and
      follow the request.
  - name: Sandbox
    description: 'The specimen gallery: the only documents a new workspace''s Sandbox reads.'
  - name: Registry
    description: >-
      Check a SIREN, a VAT number, a LEI, an IBAN, a Moroccan RIB or ICE. Scope
      `registry:read`.
  - name: Cases
    description: >-
      Read the cases your calls filed, their documents and the fields read.
      Scope `cases:read`.
  - name: Scoring
    description: >-
      Read, re-run or simulate a case's credit score. Scopes `scoring:read`,
      `scoring:write`.
  - name: Policy
    description: >-
      Read and save the KYC policy your `/v1/kyc/*` calls run under. Scopes
      `policy:read`, `policy:write`.
  - name: Webhook deliveries
    description: >-
      See what was sent to your endpoints and send a delivery again. Scope
      `webhooks:manage`.
  - name: Account
    description: The calling key, its usage, its recent calls and the error catalogue.
paths:
  /v1/partner/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a webhook endpoint
      description: >-
        Required scope: `webhooks:manage`.


        Registers an endpoint. `url` must be https and resolve to a public
        address (checked again before every delivery); every name in `events`
        must come from `GET /v1/partner/webhooks/events`. Without `secret`, Sahl
        generates one (`whsec_...`) and returns it once, in this response only.
        Deliveries are signed and retried on a schedule.
      operationId: webhooks_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookEndpointCreate'
            examples:
              basic:
                summary: Two events, Sahl generates the secret
                value:
                  url: https://example.com/hooks/sahl
                  events:
                    - kyb.completed
                    - statement.extracted
                  description: Production receiver
        required: true
      responses:
        '201':
          description: Created. `secret` is shown once.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointCreateResponse'
              example:
                id: a2c4e6f8-1b3d-4f57-8a9c-0d2e4f6a8b10
                tenant_id: 0b6f5a3e-7c1d-4e0a-9d2f-3a1c5e8b7f10
                url: https://example.com/hooks/sahl
                events: kyb.completed,statement.extracted
                is_active: true
                description: Production receiver
                created_at: '2026-11-24T09:00:00Z'
                updated_at: '2026-11-24T09:00:00Z'
                secret: whsec_0123456789abcdef0123456789abcdef0123456789abcdef
        '401':
          description: Missing, invalid, revoked or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: Invalid or revoked API key
        '403':
          description: The key lacks the `webhooks:manage` scope (`insufficient_scope`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail: API key lacks the webhooks:manage scope
        '422':
          description: >-
            `unknown_webhook_event` (an unknown name or no event; the answer
            lists `allowed`), a URL that is not https or does not resolve to a
            public address, or a validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: unknown_webhook_event
                  message: 'Unknown event(s): foo.bar'
                  allowed:
                    - document.completed
                    - kyb.completed
        '429':
          description: >-
            Per-key rate limit (`rate_limit_exceeded`, 60 calls a minute by
            default, with `Retry-After`) or the per-IP limit (top-level `code`,
            no `detail`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                detail:
                  code: rate_limit_exceeded
                  message: More than 60 calls a minute with this API key. Slow down.
                  limit: 60
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFlat'
              example:
                code: internal_error
                message: An unexpected error occurred
                details: null
      security:
        - bearerAuth: []
components:
  schemas:
    WebhookEndpointCreate:
      properties:
        url:
          type: string
          title: Url
          description: https only, resolving to a public address.
        secret:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 16
            - type: 'null'
          title: Secret
          description: >-
            Signing secret, 16 to 255 characters. Omit it and Sahl generates a
            `whsec_...` secret and returns it once.
        events:
          items:
            type: string
          type: array
          title: Events
          description: >-
            Event names from `GET /v1/partner/webhooks/events`. An unknown name
            is refused.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Free text for your own use.
      type: object
      required:
        - url
        - events
      title: WebhookEndpointCreate
    WebhookEndpointCreateResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          format: uuid
          title: Tenant Id
        url:
          type: string
          title: Url
        events:
          type: string
          title: Events
          description: The subscribed event names as one comma-separated string.
        is_active:
          type: boolean
          title: Is Active
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Secret
          description: >-
            The signing secret, only when Sahl generated it (you sent none).
            Shown once, never again.
      type: object
      required:
        - id
        - tenant_id
        - url
        - events
        - is_active
        - description
        - created_at
        - updated_at
      title: WebhookEndpointCreateResponse
      description: 'Returned only at creation: carries the signing secret when Sahl made it.'
    Error:
      type: object
      title: Error
      description: >-
        FastAPI error body. `detail` is a string, a list (validation 422), or an
        object with `code` and `message` (extra keys possible).
      properties:
        detail:
          oneOf:
            - type: string
            - type: array
              items:
                additionalProperties: true
                type: object
              description: Validation errors (422).
            - type: object
              additionalProperties: true
              properties:
                code:
                  type: string
                message:
                  type: string
      required:
        - detail
    ErrorFlat:
      type: object
      title: ErrorFlat
      description: >-
        Body of a rate-limit 429, an unknown route 404 and a 500: `code` and
        `message` at the top level, with no `detail`.
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type:
            - string
            - 'null'
          description: Present on a 500 only; null unless the server runs in debug mode.
      required:
        - code
        - message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key created in the console. Scopes: kyc:extract, kyc:verify,
        kyc:eid; kyb:onboard, kyb:ice; statements:read; webhooks:manage;
        requests:read, requests:write; bank:read, bank:write (Growth plan,
        enabled per workspace by Sahl); registry:read; cases:read; scoring:read,
        scoring:write; policy:read, policy:write; usage:read. The Sandbox
        specimen routes, `GET /v1/partner/me` and `GET /v1/partner/errors` need
        any valid key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.