# Set the webhook

`PUT https://app.booksbyinstant.com/api/integrator/v1/webhook`

The credential is checked before the URL, so Instant resolves no name for an unknown caller. Every call mints a new signing secret, also for the same URL, and shows it this once; the previous secret stops at once. Pending deliveries are kept and go to the new URL, signed with the new secret. When Instant cannot mint a secret right now, the answer is 503.

operationId `setWebhook`; tag Webhook.

## Example request

cURL:

```bash
curl -X PUT 'https://app.booksbyinstant.com/api/integrator/v1/webhook' \
  -H "Authorization: Bearer $INTEGRATOR_CREDENTIAL" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://example.com/"
}'
```

JavaScript:

```javascript
// Node 18 or later, in an ES module (.mjs), which allows the top-level await.
const res = await fetch("https://app.booksbyinstant.com/api/integrator/v1/webhook", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.INTEGRATOR_CREDENTIAL}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://example.com/"
  }),
});
const data = await res.json();
```

Python:

```python
import os
import requests

res = requests.put(
    "https://app.booksbyinstant.com/api/integrator/v1/webhook",
    headers={
        "Authorization": f"Bearer {os.environ['INTEGRATOR_CREDENTIAL']}",
    },
    json={
        "url": "https://example.com/",
    },
)
data = res.json()
```

## Authorization

- Bearer token `live_<100 hex>`: `Authorization: Bearer <secret>`. A 401 answers `WWW-Authenticate: Bearer realm="instant-integrator-api"`.

## Request body

At most 4096 bytes.

`application/json`, required: object; no other fields

- `url` (string; required; at most 2000 characters; matches `^https://`): Where Instant sends the webhook deliveries: an https URL without credentials, on port 443, with a host name (never an IP address) that resolves to public addresses only. Every call mints a new signing secret, also for the same URL.

Example, built from the schema:

```json
{
  "url": "https://example.com/"
}
```

## Responses

### 200

The webhook and its new signing secret.

`application/json`: object

- `webhook` (object; required): The integrator's webhook, never its secret.
  - `url` (string; required): Where Instant posts the deliveries.
  - `hint` (string; required; matches `^[a-z]+_w_…[0-9a-f]{4}$`): The signing secret's prefix, … and its last four hex characters.
  - `setAt` (string · date-time; required): When the webhook was set, and its secret minted. ISO 8601 in UTC with milliseconds, such as 2026-11-06T10:00:00.000Z.
- `secret` (string; required; matches `^[a-z]+_w_[0-9a-f]{64}$`): The signing secret, shown this once. Keep it on your servers, in a secret manager.

Example, built from the schema:

```json
{
  "webhook": {
    "url": "string",
    "hint": "string",
    "setAt": "2026-01-15T09:30:00.000Z"
  },
  "secret": "string"
}
```

### 400

The body is not one JSON object, or a field is invalid; `error` says which. Also when the URL is not a public https URL.

`application/json`: object; `Error`

Every answer that is not a success.

- `error` (string; required): Instant's sentence for people. A 4xx keeps the refusal's own sentence; a 5xx always says "Instant is temporarily unavailable. Please try again shortly."
- `code` (string; required): Stable, and what a caller branches on: VALIDATION_ERROR (400), UNAUTHENTICATED (401), FORBIDDEN (403), NOT_FOUND (404), CONFLICT (409), LIMIT_EXCEEDED (413), UNSUPPORTED_MEDIA_TYPE (415), UNREADABLE_FILE (422), RATE_LIMITED (429) and UNAVAILABLE (5xx). More codes may be added; treat one you do not know by its status.
- `retryAfter` (integer; at least `1`): Seconds to wait before retrying, also sent as the `Retry-After` header. Present only when there is a wait, as on a 429.
- `existingId` (string · uuid): On a 409 that names the object already there, such as a customer with that reference: its id.

Example, built from the schema:

```json
{
  "error": "string",
  "code": "VALIDATION_ERROR",
  "retryAfter": 1,
  "existingId": "01900000-0000-7000-8000-000000000000"
}
```

### 401

The credential is missing, malformed, unknown, revoked or rotated, or its integrator is disabled. All of these answer the same way.

Headers:

- `WWW-Authenticate` (string): Bearer realm="instant-integrator-api"

`application/json`: the `Error` object, as in 400.

### 413

The body is over 4096 bytes.

`application/json`: the `Error` object, as in 400.

### 415

The body is not sent as `application/json`.

`application/json`: the `Error` object, as in 400.

### 5XX

Instant is temporarily unavailable. Retry later, with backoff.

`application/json`: the `Error` object, as in 400.

---

Page: https://booksbyinstant.com/docs/set-webhook/ · Overview: https://booksbyinstant.com/docs/index.md
