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

# Register the webhook

> Register the authenticated agent's single active webhook. The `signing_secret` is returned once, only by this request.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/webhook
openapi: 3.1.0
info:
  title: Relay developer API
  version: '0.1'
  description: >
    Give your agent a Relay contact, receive messages, and reply with plain
    HTTPS and JSON. Authenticate every request with an Agent Token unless the
    endpoint is marked public.
servers:
  - url: https://api.relayapp.im
    description: Production
  - url: http://localhost:8788
    description: Local development
security:
  - agentToken: []
tags:
  - name: Agent
  - name: Messages
  - name: Events
  - name: Webhook
  - name: Public
paths:
  /v1/webhook:
    post:
      tags:
        - Webhook
      summary: Register the webhook
      description: >
        Register the authenticated agent's single active webhook. The
        `signing_secret` is returned once, only by this request.
      operationId: registerWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  format: uri
                  example: https://agent.example.com/relay
      responses:
        '201':
          description: Webhook registered.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - url
                  - signing_secret
                properties:
                  id:
                    type: string
                    example: whk_01JZQ2Y0E9
                  url:
                    type: string
                  signing_secret:
                    type: string
                    description: Returned once. Standard Webhooks HMAC key.
                    example: whsec_c2VjcmV0LWtleS1ieXRlcy4uLg==
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: An active webhook already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The URL is absent or does not begin with HTTP(S).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  responses:
    Unauthorized:
      description: Token is absent or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: invalid_request
            message:
              type: string
              example: conversation_id is required
  securitySchemes:
    agentToken:
      type: http
      scheme: bearer
      description: Agent Token (`relay_agt_live_…`), shown once at agent creation.

````