# Webhooks

Webhook subscriptions of this token or app: subscribe an address to events, rotate its secret, send a test, read the delivery log and redeliver. Each event's delivery is under Webhook events.

## List webhook subscriptions

`GET /orgs/{org}/webhooks`

Scope: `webhooks:manage`

The subscriptions this token (or this app's connection) made, oldest first. Another token's or app's subscriptions, and the organisation admins' own webhooks, aren't listed.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Query parameters

- `limit` (integer): How many items a page holds, 1 to 200. [from 1 to 200; default 50]
- `cursor` (string): The next_cursor of the previous page; leave it out for the first page. [at most 1000 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/webhooks" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
      "name": "hooks.example.com",
      "url": "https://hooks.example.com/projqo",
      "events": [
        "task_created",
        "task_updated"
      ],
      "projects": [
        {
          "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
          "key": "WEB"
        }
      ],
      "spaces": [],
      "task_query": null,
      "enabled": true,
      "switched_off": null,
      "secret_last_four": "Qx7a",
      "previous_secret_expires_at": null,
      "health": {
        "failures_in_a_row": 0,
        "failing_since": null,
        "last_success_at": "2026-12-02T09:30:00.000Z"
      },
      "created_at": "2026-12-01T10:00:00.000Z",
      "updated_at": "2026-12-01T10:00:00.000Z"
    }
  ],
  "next_cursor": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Create a webhook subscription

`POST /orgs/{org}/webhooks`

Scope: `webhooks:manage`

Subscribes an address to events. Each event needs its read scope too (page events need docs:read; 403 insufficient_scope names the one missing). The answer carries the subscription's secret, shown only now: every delivery is signed with it. A ping is sent to the address at once. At most 20 subscriptions a token or app connection. Not idempotent: the answer holds a secret, which projqo never keeps.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Body

- `url` (string, required): The https address that receives the deliveries (no variables). [1 to 2000 characters]
- `events` (array of string, required): The events to receive. Each needs its read scope on the token or app. [1 to 100 items]
- `name` (string): A name to know it by (on the organisation's Webhooks page too); the address's host by default. [1 to 255 characters]
- `projects` (array of string): Projects by key or id: only events about their things. Empty: every project. [at most 50 items]
- `spaces` (array of string): Docs spaces by key or id: only Docs events in them. Empty: every space. [at most 50 items]
- `task_query` (string): Only task events whose task matches this query (the query language). [at most 2000 characters]
- `enabled` (boolean): false switches it off; true switches it on again (not after an organisation admin switched it off).

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/webhooks" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "string",
  "events": [
    "task_created"
  ],
  "name": "string",
  "projects": [
    "string"
  ],
  "spaces": [
    "string"
  ],
  "task_query": "string",
  "enabled": true
}'
```

### Answer: 201

```json
{
  "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
  "name": "hooks.example.com",
  "url": "https://hooks.example.com/projqo",
  "events": [
    "task_created",
    "task_updated"
  ],
  "projects": [
    {
      "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "key": "WEB"
    }
  ],
  "spaces": [],
  "task_query": null,
  "enabled": true,
  "switched_off": null,
  "secret_last_four": "Qx7a",
  "previous_secret_expires_at": null,
  "health": {
    "failures_in_a_row": 0,
    "failing_since": null,
    "last_success_at": "2026-12-02T09:30:00.000Z"
  },
  "created_at": "2026-12-01T10:00:00.000Z",
  "updated_at": "2026-12-01T10:00:00.000Z",
  "secret": "whsec_9QpL2vY1kT8sXr3mN6bA0cHdE4fGh5Jw"
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 409 `limit_reached`: limit_reached: A limit was reached (of the plan, or of how many of something one person may have).
- 413 `too_large`: too_large: The body or a file is larger than allowed.
- 415 `unsupported_media_type`: unsupported_media_type: The body isn't JSON.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get a webhook subscription

`GET /orgs/{org}/webhooks/{webhook}`

Scope: `webhooks:manage`

One of this token's (or app connection's) subscriptions, with its health.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
  "name": "hooks.example.com",
  "url": "https://hooks.example.com/projqo",
  "events": [
    "task_created",
    "task_updated"
  ],
  "projects": [
    {
      "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "key": "WEB"
    }
  ],
  "spaces": [],
  "task_query": null,
  "enabled": true,
  "switched_off": null,
  "secret_last_four": "Qx7a",
  "previous_secret_expires_at": null,
  "health": {
    "failures_in_a_row": 0,
    "failing_since": null,
    "last_success_at": "2026-12-02T09:30:00.000Z"
  },
  "created_at": "2026-12-01T10:00:00.000Z",
  "updated_at": "2026-12-01T10:00:00.000Z"
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Change a webhook subscription

`PATCH /orgs/{org}/webhooks/{webhook}`

Scope: `webhooks:manage`

Changes what is given. enabled: true switches a subscription on again after it was switched off for failing (its health starts again); one an organisation admin switched off stays off (403 refused).

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Body

- `name` (string): A name to know it by (on the organisation's Webhooks page too); the address's host by default. [1 to 255 characters]
- `url` (string): The https address that receives the deliveries (no variables). [1 to 2000 characters]
- `events` (array of string): The events to receive. Each needs its read scope on the token or app. [1 to 100 items]
- `projects` (array of string): Projects by key or id: only events about their things. Empty: every project. [at most 50 items]
- `spaces` (array of string): Docs spaces by key or id: only Docs events in them. Empty: every space. [at most 50 items]
- `task_query` (string): Only task events whose task matches this query (the query language). [at most 2000 characters]
- `enabled` (boolean): false switches it off; true switches it on again (not after an organisation admin switched it off).

### Request

```sh
curl -X PATCH "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}" \
  -H "Authorization: Bearer $PROJQO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "url": "string",
  "events": [
    "task_created"
  ],
  "projects": [
    "string"
  ],
  "spaces": [
    "string"
  ],
  "task_query": "string",
  "enabled": true
}'
```

### Answer: 200

```json
{
  "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
  "name": "hooks.example.com",
  "url": "https://hooks.example.com/projqo",
  "events": [
    "task_created",
    "task_updated"
  ],
  "projects": [
    {
      "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "key": "WEB"
    }
  ],
  "spaces": [],
  "task_query": null,
  "enabled": true,
  "switched_off": null,
  "secret_last_four": "Qx7a",
  "previous_secret_expires_at": null,
  "health": {
    "failures_in_a_row": 0,
    "failing_since": null,
    "last_success_at": "2026-12-02T09:30:00.000Z"
  },
  "created_at": "2026-12-01T10:00:00.000Z",
  "updated_at": "2026-12-01T10:00:00.000Z"
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 413 `too_large`: too_large: The body or a file is larger than allowed.
- 415 `unsupported_media_type`: unsupported_media_type: The body isn't JSON.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Delete a webhook subscription

`DELETE /orgs/{org}/webhooks/{webhook}`

Scope: `webhooks:manage`

Deletes the subscription and its delivery log. Nothing more is sent.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Request

```sh
curl -X DELETE "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 204

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Rotate a subscription's secret

`POST /orgs/{org}/webhooks/{webhook}/rotate-secret`

Scope: `webhooks:manage`

Makes a new secret, shown only now. For 24 hours the old one signs too, in X-Projqo-Signature-Previous, so a receiver keeps working while you deploy the new one. Rotating again within that time ends the older secret at once.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}/rotate-secret" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "secret": "whsec_Zr4Kp0aL8vQ2tY6mXb1nC3dE5fGh7Jw9",
  "previous_secret_expires_at": "2026-12-03T10:00:00.000Z"
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Send a test

`POST /orgs/{org}/webhooks/{webhook}/test`

Scope: `webhooks:manage`

Sends a ping event to the subscription's address now (also when it is switched off), and answers its delivery; follow it in the delivery log.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}/test" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 202

```json
{
  "id": "7d8e9f0a-1b2c-4d3e-8f4a-5b6c7d8e9f0a",
  "event": "ping",
  "status": "queued",
  "attempts": 0,
  "response_code": null,
  "duration_ms": null,
  "reason": null,
  "created_at": "2026-12-02T09:30:00.000Z",
  "last_attempt_at": null,
  "next_attempt_at": "2026-12-02T09:30:00.000Z",
  "sent_at": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## List a subscription's deliveries

`GET /orgs/{org}/webhooks/{webhook}/deliveries`

Scope: `webhooks:manage`

The delivery log, newest first, for 30 days: each delivery's status, attempts, your address's answer, how long it took and why it failed or was skipped.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]

### Query parameters

- `status` (string): Only deliveries with this status. [one of: queued, sent, failed, skipped]
- `limit` (integer): How many items a page holds, 1 to 200. [from 1 to 200; default 50]
- `cursor` (string): The next_cursor of the previous page; leave it out for the first page. [at most 1000 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}/deliveries" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "7d8e9f0a-1b2c-4d3e-8f4a-5b6c7d8e9f0a",
      "event": "task_updated",
      "status": "failed",
      "attempts": 5,
      "response_code": 500,
      "duration_ms": 142,
      "reason": "The receiver answered 500.",
      "created_at": "2026-12-02T09:30:00.000Z",
      "last_attempt_at": "2026-12-02T12:13:00.000Z",
      "next_attempt_at": null,
      "sent_at": null
    }
  ],
  "next_cursor": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get a delivery

`GET /orgs/{org}/webhooks/{webhook}/deliveries/{delivery}`

Scope: `webhooks:manage`

One delivery of the subscription's log.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]
- `delivery` (string, required): The delivery's id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}/deliveries/{delivery}" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "id": "7d8e9f0a-1b2c-4d3e-8f4a-5b6c7d8e9f0a",
  "event": "task_updated",
  "status": "failed",
  "attempts": 5,
  "response_code": 500,
  "duration_ms": 142,
  "reason": "The receiver answered 500.",
  "created_at": "2026-12-02T09:30:00.000Z",
  "last_attempt_at": "2026-12-02T12:13:00.000Z",
  "next_attempt_at": null,
  "sent_at": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Redeliver

`POST /orgs/{org}/webhooks/{webhook}/deliveries/{delivery}/redeliver`

Scope: `webhooks:manage`

Sends a finished delivery (sent, failed or skipped) again, as it was, with the same id, prepared again for the subscription's person. 409 conflict while it is still waiting.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]
- `webhook` (string, required): The subscription's id. [1 to 60 characters]
- `delivery` (string, required): The delivery's id. [1 to 60 characters]

### Request

```sh
curl -X POST "https://projqo.example/api/v1/orgs/{org}/webhooks/{webhook}/deliveries/{delivery}/redeliver" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 202

```json
{
  "id": "7d8e9f0a-1b2c-4d3e-8f4a-5b6c7d8e9f0a",
  "event": "task_updated",
  "status": "queued",
  "attempts": 0,
  "response_code": null,
  "duration_ms": 142,
  "reason": null,
  "created_at": "2026-12-02T09:30:00.000Z",
  "last_attempt_at": "2026-12-02T12:13:00.000Z",
  "next_attempt_at": "2026-12-02T12:20:00.000Z",
  "sent_at": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. read_only: The organisation is read-only (over the Free plan's people, or a payment is overdue).
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 409 `conflict`: conflict: The thing changed since it was read, or the change clashes with its state.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).
