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

# Create Webhook Endpoint

> Add a webhook endpoint with POST /api/webhooks. The response holds the signing secret, which is only returned once.

Adds an endpoint that receives the events you choose. The response includes the signing secret (`whsec_...`): store it, because it is only returned here. See [Webhooks](https://octanist.com/docs/api-reference/webhooks.md) for the payload and how to verify the signature.

Needs an API key with full access.

## Request Body

| Field | Type | Required | Description |
| - | - | - | - |
| `url` | string | Yes | HTTPS URL on a public host, up to 2048 characters. |
| `events` | string\[] | Yes | One or more of `lead.created`, `lead.status_changed` and `lead.updated`. |
| `description` | string | No | A note for yourself, up to 200 characters. |

An organization can have up to 10 endpoints.

## Example Request

```bash theme={null}
curl -X POST \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://crm.example.com/webhooks/octanist",
    "events": ["lead.created", "lead.status_changed"],
    "description": "CRM sync"
  }' \
  "https://octanist.com/api/webhooks"
```

## Example Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "9b2f1c4e-6a1d-4f7e-9a51-2c8f0f3d1a77",
    "url": "https://crm.example.com/webhooks/octanist",
    "description": "CRM sync",
    "events": ["lead.created", "lead.status_changed"],
    "enabled": true,
    "disabledReason": null,
    "createdAt": "2026-11-30T10:00:00.000Z",
    "updatedAt": "2026-11-30T10:00:00.000Z",
    "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
  },
  "meta": {
    "requestId": "req_a1b2c3d4e5f6",
    "timestamp": "2026-11-30T10:00:00.000Z"
  }
}
```

## Errors

| Status | Code | When |
| - | - | - |
| 400 | `VALIDATION_ERROR` | The URL is not HTTPS, points to a private address or cannot be found; no or unknown events; already 10 endpoints. |
| 403 | `FORBIDDEN` | The API key is read-only. |


## OpenAPI

````yaml POST /api/webhooks
openapi: 3.0.1
info:
  title: Octanist API
  description: >-
    The Octanist API allows you to create, update and read leads, run reports,
    read workspace settings, retrieve statistics, and access ad spend data.
  version: 2.5.0
  contact:
    name: Octanist Support
    url: https://octanist.com/docs
servers:
  - url: https://octanist.com
    description: Production server
security:
  - apiKeyAuth: []
paths:
  /api/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create Webhook Endpoint
      description: >-
        Add an endpoint. The response holds the signing secret; it is only
        returned here.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '201':
          description: Endpoint created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    allOf:
                      - $ref: '#/components/schemas/WebhookEndpoint'
                      - type: object
                        properties:
                          secret:
                            type: string
                            description: Signing secret, returned once
                            example: whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          description: Invalid URL or events, or the organization already has 10 endpoints
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: A read-only API key, or the organization is a read-only demo
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateWebhookRequest:
      type: object
      required:
        - url
        - events
      properties:
        url:
          type: string
          format: uri
          maxLength: 2048
          description: HTTPS URL on a public host
          example: https://crm.example.com/webhooks/octanist
        events:
          type: array
          items:
            type: string
            enum:
              - lead.created
              - lead.status_changed
              - lead.updated
          minItems: 1
          description: Events to send to this endpoint
          example:
            - lead.created
            - lead.status_changed
        description:
          type: string
          maxLength: 200
          nullable: true
          example: CRM sync
    WebhookEndpoint:
      type: object
      properties:
        id:
          type: string
          example: 9b2f1c4e-6a1d-4f7e-9a51-2c8f0f3d1a77
        url:
          type: string
          format: uri
          example: https://crm.example.com/webhooks/octanist
        description:
          type: string
          nullable: true
          example: CRM sync
        events:
          type: array
          items:
            type: string
            enum:
              - lead.created
              - lead.status_changed
              - lead.updated
          minItems: 1
          description: Events to send to this endpoint
          example:
            - lead.created
            - lead.status_changed
        enabled:
          type: boolean
          example: true
        disabledReason:
          type: string
          nullable: true
          enum:
            - user
            - gone
            - null
          description: >-
            Why the endpoint is off: `user` (turned off in Octanist or with the
            API) or `gone` (it answered HTTP 410)
          example: null
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Meta:
      type: object
      properties:
        requestId:
          type: string
          example: req_a1b2c3d4e5f6
        timestamp:
          type: string
          format: date-time
          example: '2026-03-10T12:00:00.000Z'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human readable error message
              example: Human readable error message
            details:
              type: object
              description: Optional additional error details
        meta:
          $ref: '#/components/schemas/Meta'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication

````

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