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

# Create a webhook endpoint JSON Schema

> Create a webhook endpoint JSON Schema contract. Includes route metadata, request parameters, response statuses, examples, and JSON fields for implementation.

Source OpenAPI: 0xArchive API 1.6.1; 168 paths; 190 component schemas.

Register an HTTPS destination and get its signing secret. The secret is returned in this response and in a rotation, and nowhere else, so store it now. Destinations that resolve to a private or internal address are refused, at creation and again on every delivery. A plan without webhook delivery, or one already at its endpoint cap, is refused with the reason and the way forward. Authenticate with an API key or a signed-in dashboard session. Costs no credits.

## Route Metadata

| Field                | Value                    |
| -------------------- | ------------------------ |
| Method               | `POST`                   |
| Path                 | `/v1/webhooks/endpoints` |
| operationId          | `createWebhookEndpoint`  |
| Tag                  | Webhooks - Endpoints     |
| Family               | Webhooks                 |
| Deprecated or legacy | no                       |

## Request Body

### application/json

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "createWebhookEndpoint request body",
  "description": "A new delivery destination.",
  "type": "object",
  "required": [
    "url"
  ],
  "properties": {
    "description": {
      "description": "Your own label for the endpoint.",
      "type": "string",
      "default": "",
      "example": "Trading desk alerts"
    },
    "url": {
      "description": "HTTPS destination that will receive deliveries. Destinations that resolve to a private or internal address are refused.",
      "type": "string",
      "format": "uri",
      "example": "https://example.com/hooks/0xarchive"
    }
  }
}
```

## Response Contracts

### Status 200

The new endpoint and its signing secret

#### application/json

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "createWebhookEndpoint response 200",
  "description": "API response containing a newly created endpoint and its signing secret.",
  "type": "object",
  "properties": {
    "data": {
      "description": "A newly created endpoint, including the signing secret. This is one of the two responses that carry the secret; the other is a rotation. Store it now, because it is not shown again.",
      "type": "object",
      "required": [
        "consecutive_failures",
        "created_at",
        "description",
        "id",
        "secret",
        "status",
        "url"
      ],
      "properties": {
        "consecutive_failures": {
          "description": "Failed attempts since the last success. Resets to zero on a delivery that lands.",
          "type": "integer",
          "format": "int32",
          "example": 0
        },
        "created_at": {
          "description": "When the endpoint was created.",
          "type": "string",
          "format": "date-time"
        },
        "description": {
          "description": "Your own label for the endpoint.",
          "type": "string",
          "example": "Trading desk alerts"
        },
        "id": {
          "description": "Endpoint identifier.",
          "type": "string",
          "format": "uuid"
        },
        "secret": {
          "description": "Signing secret for this endpoint. Every delivery is signed with it, and your receiver verifies the signature against it.",
          "type": "string",
          "example": "whsec_6f1c0b2a4d8e5f3a9c7b1e0d2f4a6c8b1d3e5f7a9c0b2d4e6f8a1c3b5d7e9f0a"
        },
        "status": {
          "description": "`active` is serving. `disabled` means you switched it off. `auto_disabled` means a long run of failed deliveries switched it off for you; bring it back with the enable route.",
          "type": "string",
          "enum": [
            "active",
            "disabled",
            "auto_disabled"
          ],
          "example": "active"
        },
        "url": {
          "description": "HTTPS destination that receives deliveries.",
          "type": "string",
          "format": "uri",
          "example": "https://example.com/hooks/0xarchive"
        }
      }
    },
    "note": {
      "description": "That the secret is shown once.",
      "type": "string",
      "example": "Store the secret now; it is not shown again."
    },
    "success": {
      "type": "boolean",
      "example": true
    }
  }
}
```

### Status 400

Invalid request

#### application/json

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "createWebhookEndpoint response 400",
  "description": "Error response",
  "type": "object",
  "properties": {
    "code": {
      "description": "HTTP status code",
      "type": "integer"
    },
    "error": {
      "description": "Error message",
      "type": "string"
    },
    "error_code": {
      "description": "Machine-readable error code. Common values: `invalid_query_params` (a query parameter failed to parse or validate) and `invalid_path_params` (a path parameter failed to parse). Other endpoint-specific codes exist; treat unknown codes as generic errors of the given HTTP status.",
      "type": "string"
    },
    "request_id": {
      "description": "Unique request ID for support",
      "type": "string",
      "format": "uuid"
    }
  }
}
```

##### OpenAPI example

```json theme={"theme":"github-dark"}
{
  "code": 400,
  "error": "Failed to deserialize query string: limit: invalid digit found in string",
  "error_code": "invalid_query_params",
  "request_id": "3f2a9c71-5b0e-4d68-9a4c-7e1d2b6f8a05"
}
```

### Status 401

Authentication required

#### application/json

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "createWebhookEndpoint response 401",
  "description": "Error response",
  "type": "object",
  "properties": {
    "code": {
      "description": "HTTP status code",
      "type": "integer"
    },
    "error": {
      "description": "Error message",
      "type": "string"
    },
    "error_code": {
      "description": "Machine-readable error code. Common values: `invalid_query_params` (a query parameter failed to parse or validate) and `invalid_path_params` (a path parameter failed to parse). Other endpoint-specific codes exist; treat unknown codes as generic errors of the given HTTP status.",
      "type": "string"
    },
    "request_id": {
      "description": "Unique request ID for support",
      "type": "string",
      "format": "uuid"
    }
  }
}
```

##### OpenAPI example

```json theme={"theme":"github-dark"}
{
  "code": 401,
  "error": "Missing or invalid API key. Provide X-API-Key header."
}
```

### Status 429

Rate limit exceeded

#### application/json

```json theme={"theme":"github-dark"}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "createWebhookEndpoint response 429",
  "description": "Error response",
  "type": "object",
  "properties": {
    "code": {
      "description": "HTTP status code",
      "type": "integer"
    },
    "error": {
      "description": "Error message",
      "type": "string"
    },
    "error_code": {
      "description": "Machine-readable error code. Common values: `invalid_query_params` (a query parameter failed to parse or validate) and `invalid_path_params` (a path parameter failed to parse). Other endpoint-specific codes exist; treat unknown codes as generic errors of the given HTTP status.",
      "type": "string"
    },
    "request_id": {
      "description": "Unique request ID for support",
      "type": "string",
      "format": "uuid"
    }
  }
}
```

##### OpenAPI example

```json theme={"theme":"github-dark"}
{
  "code": 429,
  "error": "Rate limit exceeded"
}
```
