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

# Create Webhook

> Registers a new webhook endpoint. The response includes the `secretKey` for HMAC-SHA256 signature verification — **it is shown only once**. Store it securely.



## OpenAPI

````yaml POST /partner/webhooks
openapi: 3.0.3
info:
  title: Exchange Partner API
  version: 1.0.0
  description: >-
    REST API for exchange office partners. Authenticate with a Bearer API key
    (`sk_branch_*`, `sk_personal_*`, or `pk_*`). API key management endpoints
    use JWT Bearer auth from the staff panel.
servers:
  - url: https://api.example.com/api/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Partner — Public
    description: >-
      Read-only endpoints accessible with any key type (including pk_* public
      keys)
  - name: Partner — Exchanges
    description: Read public exchange office data and rates
  - name: Partner — Offers
    description: Browse available currency exchange rate offers
  - name: Partner — Orders
    description: Create and manage client exchange orders
  - name: Partner — Clients
    description: Register and manage client accounts
  - name: Partner — Webhooks
    description: Manage webhook endpoint registrations
  - name: API Keys
    description: Create and revoke partner API keys (JWT auth required)
paths:
  /partner/webhooks:
    post:
      tags:
        - Partner — Webhooks
      summary: Register a webhook endpoint
      description: >-
        Registers a new webhook endpoint. The response includes the `secretKey`
        for HMAC-SHA256 signature verification — **it is shown only once**.
        Store it securely.
      operationId: partnerCreateWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
            example:
              url: https://example.com/webhooks/exchange
              events:
                - order.created
                - order.status_changed
      responses:
        '201':
          description: >-
            Webhook registered. The `secretKey` field is shown only in this
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateWebhookResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateWebhookRequest:
      type: object
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          example: https://example.com/webhooks/exchange
        events:
          type: array
          items:
            type: string
            enum:
              - order.created
              - order.status_changed
              - order.cancelled
              - offer.updated
          minItems: 1
          example:
            - order.created
            - order.status_changed
    CreateWebhookResponse:
      allOf:
        - $ref: '#/components/schemas/Webhook'
        - type: object
          properties:
            secretKey:
              type: string
              description: HMAC-SHA256 signing secret. Shown only once — store securely.
              example: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
            note:
              type: string
              example: >-
                Store this secret key securely — it will not be shown again. Use
                it to verify HMAC-SHA256 signatures.
    Webhook:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        url:
          type: string
          format: uri
          example: https://example.com/webhooks/exchange
        events:
          type: array
          items:
            type: string
            enum:
              - order.created
              - order.status_changed
              - order.cancelled
              - offer.updated
          example:
            - order.created
            - order.status_changed
        isActive:
          type: boolean
          example: true
        failCount:
          type: integer
          example: 0
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          example: Validation failed
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
  responses:
    ValidationError:
      description: Request body or parameters failed validation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            message:
              - url must be a URL address
              - events should not be empty
            error: Bad Request
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Unauthorized
    TooManyRequests:
      description: Rate limit exceeded (60 req/min per API key)
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds until the rate limit window resets
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 429
            message: Too Many Requests
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Partner API key. Format: `sk_branch_<32chars>`, `sk_personal_<32chars>`,
        or `pk_<32chars>` (public, read-only)

````