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

# Register a Webhook

<Warning>
  **v1 (legacy).** This page documents the API before the v2 update. The v1
  format is not enabled for new accounts and must be enabled on your account by
  your account manager. New integrations should use the
  [current documentation](/introduction). To update an existing integration,
  follow the [migration guide](/migration).
</Warning>


## OpenAPI

````yaml v1/api-reference/webhooks-docs.json post /api/webhooks/{type}
openapi: 3.0.0
info:
  version: v1.0.0
  title: Webhooks API (legacy v1)
  description: API for managing webhooks in the Rio platform
servers:
  - url: https://app.sandbox.rio.trade
security:
  - apiKeyAuth: []
paths:
  /api/webhooks/{type}:
    post:
      summary: Create a webhook registration
      parameters:
        - name: type
          in: path
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/webhookTypePathParameter'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createWebHookSchema'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responseCreatedWebhookSchema'
components:
  parameters:
    webhookTypePathParameter:
      name: type
      in: path
      description: Type of webhook to be created.
      required: true
      schema:
        enum:
          - orders
          - bank-accounts
          - users
  schemas:
    createWebHookSchema:
      type: object
      properties:
        userId:
          description: The user ID of the user that the webhook is being created for
          type: string
          example: 66290ac8bd3903485989f82e
        url:
          type: string
          description: URL to send the webhook to
        retryOnFailure:
          type: boolean
          description: >-
            Whether to retry webhook delivery on failure. If true, the system
            will retry up to 5 times with exponential backoff. If false or not
            provided, only one attempt will be made.
          example: true
      required:
        - url
    responseCreatedWebhookSchema:
      type: object
      properties:
        id:
          type: string
          description: Id of the created webhook
          example: 66733d33222710ab2785dc62
        secret:
          description: Webhook secret
          type: string
          example: IgAeeIIorKQ86gAGItsmY0slzhxRY1Gvj/VIJz8DtIs=
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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