# Create a webhook

`POST https://api-vod-express.syncwords.com/v1/webhooks`

Create a webhook

Subscribes an HTTPS URL to events: each is POSTed to it as JSON, signed with the `secret` this answer carries. **The secret is shown only here**: keep it to verify deliveries. The URL must be `https://` and reach a public address. At most 10 webhooks per account, one per URL.

**Guide:** [Webhooks](/vod-express/guides/webhooks)

## Request body

Example:

```json
{
  "url": "https://hooks.example.com/syncwords",
  "events": [
    "file.done",
    "file.failed"
  ]
}
```

Schema:

```json
{
  "type": "object",
  "required": [
    "url",
    "events"
  ],
  "additionalProperties": false,
  "properties": {
    "url": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048,
      "examples": [
        "https://hooks.example.com/syncwords"
      ]
    },
    "events": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "enum": [
          "file.done",
          "file.failed",
          "project.stopped",
          "project.error"
        ]
      }
    }
  }
}
```

## Responses

### 201

Created

Example:

```json
{
  "data": {
    "id": "wh_01m3n2t4k8b5x0c7d2e9f6g1h3",
    "url": "https://hooks.example.com/syncwords",
    "events": [
      "file.done",
      "file.failed"
    ],
    "createdAt": "2026-09-28T09:00:00.000Z",
    "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
  }
}
```

Schema:

```json
{
  "type": "object",
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "allOf": [
        {
          "$ref": "#/components/schemas/Webhook"
        },
        {
          "type": "object",
          "required": [
            "secret"
          ],
          "properties": {
            "secret": {
              "type": "string",
              "description": "The signing secret, `whsec_…`. Shown only in this answer."
            }
          }
        }
      ]
    }
  }
}
```

### 401

No token, or an expired or unknown one: `unauthenticated`.

Example:

```json
{
  "message": "Unauthenticated.",
  "code": "unauthenticated"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 403

VOD Express is not available to the account: switched off for it (`vod_express_not_enabled`), or the account is restricted — its access revoked, its trial expired or used up (`account_restricted`, with the reason in `message`).

Example:

```json
{
  "message": [
    "VOD Express is not enabled for your account."
  ],
  "code": "vod_express_not_enabled"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 413

The body is over 2 MB: `payload_too_large`.

Example:

```json
{
  "message": [
    "The request body is too large."
  ],
  "code": "payload_too_large"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 415

The body is neither JSON nor YAML: `unsupported_media_type`.

Example:

```json
{
  "message": [
    "Send the body as JSON (Content-Type: application/json) or YAML (Content-Type: application/yaml)."
  ],
  "code": "unsupported_media_type"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 422

An invalid body, a URL that is not `https://` or not public, or one the account already has (`validation_failed`); or the account has 10 webhooks already (`webhook_limit_reached`).

Example:

```json
{
  "message": "The URL’s host does not resolve to a public address, so it cannot receive webhooks.",
  "errors": {
    "url": [
      "The URL’s host does not resolve to a public address, so it cannot receive webhooks."
    ]
  },
  "code": "validation_failed"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 429

Rate limited: `too_many_requests`. Wait the seconds `Retry-After` says, then repeat the call.

Example:

```json
{
  "message": [
    "Too Many Attempts."
  ],
  "code": "too_many_requests"
}
```

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 503

Webhooks cannot be created right now: `service_unavailable`.

Schema:

```json
{
  "$ref": "#/components/schemas/Error"
}
```

## Schemas

### Webhook

`#/components/schemas/Webhook`

```json
{
  "type": "object",
  "required": [
    "id",
    "url",
    "events",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "file.done",
          "file.failed",
          "project.stopped",
          "project.error"
        ]
      }
    },
    "createdAt": {
      "type": "string"
    }
  }
}
```

### Error

`#/components/schemas/Error`

```json
{
  "type": "object",
  "required": [
    "message",
    "code"
  ],
  "properties": {
    "message": {
      "description": "For people. A string, or an array of one string on some statuses: read it as `Array.isArray(m) ? m[0] : m`.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "code": {
      "description": "For programs: stable, one per situation. See the Errors guide.",
      "enum": [
        "bad_request",
        "invalid_output_path",
        "invalid_idempotency_key",
        "unauthenticated",
        "invalid_credentials",
        "forbidden",
        "vod_express_not_enabled",
        "account_restricted",
        "not_found",
        "project_not_found",
        "file_not_found",
        "file_meta_not_found",
        "output_not_found",
        "feed_not_found",
        "upload_not_found",
        "webhook_not_found",
        "webhook_delivery_not_found",
        "aws_access_not_provisioned",
        "storage_connection_not_found",
        "method_not_allowed",
        "conflict",
        "file_exists",
        "project_reads_feed",
        "project_reads_folder",
        "file_processing",
        "project_config_locked",
        "idempotency_in_progress",
        "storage_connection_in_use",
        "payload_too_large",
        "unsupported_media_type",
        "validation_failed",
        "service_start_failed",
        "idempotency_key_reused",
        "webhook_limit_reached",
        "storage_failed",
        "storage_connection_check_failed",
        "storage_connection_folder_only",
        "storage_prefix_taken",
        "build_without_storage_connections",
        "build_has_no_schema",
        "too_many_requests",
        "internal_error",
        "bad_gateway",
        "service_stop_failed",
        "aws_access_failed",
        "platform_unavailable",
        "service_unavailable",
        "build_list_unavailable"
      ]
    },
    "errors": {
      "type": "object",
      "description": "On a 422: each field’s messages, keyed by field name, or by JSON pointer inside `config`.",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    }
  }
}
```
