---
agentTools:
  projectIndex: https://elai.readme.io/llms.txt
---

# Subscribe

Subscribe to `video_ready` and `video_error`, or replace the URL of an existing subscription. One webhook per workspace: posting again overwrites what was there.

The body is validated strictly — any field other than `url`, `enabled` and `techEmail` is rejected with a `400`.

```curl Request
curl -X POST 'https://apis.elai.io/api/v1/webhook/' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "<url>"
}'
```

```json Response 200
{
  "url": "https://site.com/webhook",
  "enabled": true
}
```

# OpenAPI definition

````json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Elai Public API",
    "version": "1.0",
    "description": "Every endpoint below is served under `https://apis.elai.io/api/v1`.\n\n## Authentication\n\nSend your workspace API token as a bearer token on every request:\n\n```\nAuthorization: Bearer <your-api-token>\n```\n\nGenerate and rotate the token in the Elai web app under **Settings → API**, or through\n`POST /generateToken`. The token is scoped to one **workspace** and authenticates as that\nworkspace's admin user — it is not tied to an individual person, and it carries admin rights\ninside that workspace.\n\nA request with a missing, unknown or revoked token gets a bare `401` with no response body.\n\n> **Organizations on the Unlimited plan cannot use the API.** Their requests are rejected with the\n> same bare `401` as an invalid token, with nothing to distinguish the two. If a valid, freshly\n> generated token returns `401` on every endpoint, check the plan first.\n\n## Errors\n\nFailures carry a JSON body of the shape `{ \"message\": \"...\" }`. Validation failures on the newer\nendpoints may add an `errors` array naming the offending fields. `401` is the exception: it has no\nbody at all.\n\nBoth render endpoints are **fire-and-forget** — they queue work and return immediately, so a\n`200` means \"accepted\", not \"rendered\". Render failures surface only through the `video_error`\nwebhook, never as an HTTP error on the call that started the render.\n\n## Scope\n\nThis reference is generated from the running code rather than maintained by hand, so it cannot\nquietly fall behind the API it describes. It documents 96 operations across the\n`/api/v1` surface.\n\nEndpoints are grouped by subject in the sidebar. If something you need is missing, or an endpoint\ndoes not behave as described here, tell us.\n\n---\n\n_Generated from `chore/web-4760/api-v1-reference-build` at `5289745d` on 2026-09-04._"
  },
  "servers": [
    {
      "url": "https://apis.elai.io/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "SECRET_KEY"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/webhook/": {
      "post": {
        "summary": "Subscribe",
        "description": "Subscribe to `video_ready` and `video_error`, or replace the URL of an existing subscription. One webhook per workspace: posting again overwrites what was there.\n\nThe body is validated strictly — any field other than `url`, `enabled` and `techEmail` is rejected with a `400`.",
        "operationId": "webhook-subscribe",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Where we POST each event. **HTTPS only** — an `http://` URL is rejected. URLs containing `localhost` or `elai.io` are rejected as well, so you cannot point a webhook back at us or at your own machine. Maximum 2048 characters.\n\nThe schema treats this as optional, but the handler rejects a missing URL, so treat it as required."
                  },
                  "techEmail": {
                    "type": "string",
                    "description": "Address we email when deliveries start failing, and again before the webhook is disabled. Must contain `@` or the request is rejected with `Email is not valid`. Maximum 254 characters. If omitted we email the user who created the video instead."
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": true,
                    "description": "Whether the webhook is active. Defaults to `true`, so you normally omit it. Sending `false` subscribes the URL but leaves it switched off — and a secret set while a webhook is switched off is silently discarded (see Set secret token)."
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {
                      "url": "https://site.com/webhook",
                      "enabled": true
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "example": "https://site.com/webhook"
                    },
                    "enabled": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The URL or the tech email was rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "bad url": {
                    "value": {
                      "message": "Valid url with secure protocol required"
                    }
                  },
                  "bad tech email": {
                    "value": {
                      "message": "Email is not valid"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "tags": [
    {
      "name": "Webhooks",
      "description": "Subscribe to `video_ready` and `video_error` callbacks, and set the HMAC signing secret."
    }
  ],
  "_id": {
    "buffer": {
      "0": 106,
      "1": 154,
      "2": 229,
      "3": 101,
      "4": 201,
      "5": 178,
      "6": 243,
      "7": 252,
      "8": 223,
      "9": 58,
      "10": 69,
      "11": 151
    }
  }
}
````