webhooks
7 operations
GET /v1/webhooksThe tenant's webhook subscriptionsPOST /v1/webhooksRegister a webhook subscription (secret shown once)GET /v1/webhooks/{id}One webhook subscriptionPATCH /v1/webhooks/{id}Change, disable or enable a webhook subscriptionPOST /v1/webhooks/{id}/rotate-secretReplace a webhook subscription's secret (shown once)GET /v1/webhooks/{id}/deliveriesA webhook subscription's delivery logPOST /v1/webhooks/{id}/deliveries/{delivery}/redeliverSend a delivered or failed delivery again
GET /v1/webhooks
The tenant's webhook subscriptions
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · listWebhooks
Every subscription of the tenant (at most 20), by id; never a secret. Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role. Not audited (a read). no-store.
Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookSubscriptionListapplication/json | The subscriptions. |
| 400 | Errorapplication/json | A bad X-Request-Id. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"items": [
{
"id": 3,
"url": "https://erp.buyer.example/hooks/croppath",
"description": "Buyer ERP",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"status": "active",
"disabled_reason": null,
"disabled_at": null,
"consecutive_failures": 0,
"created_by": "admin@coop.example",
"created_at": 1790000000.5,
"updated_at": 1790000000.5
}
]
}Response 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks
Register a webhook subscription (secret shown once)
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · createWebhook
Registers an HTTPS endpoint for the given event types; the server generates the signing secret, returns it in this response only and stores it encrypted under the deployment's key-encryption key. The URL must be https, without credentials or fragment, and every address its host resolves to must be public. Audited (webhook.create, in the same transaction, with the URL's host and the event types, never the secret). Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role. Every delivery is a POST of application/json to the subscription's URL with the Standard Webhooks headers webhook-id (the event id, the same on every attempt: deduplicate on it, delivery is at least once), webhook-timestamp (Unix seconds of this attempt) and webhook-signature (v1, + base64 of HMAC-SHA256 over {webhook-id}.{webhook-timestamp}.{body}, keyed with the base64-decoded part of the secret after whsec_). Verify the signature over the raw body with a constant-time comparison and refuse a timestamp more than 300 seconds from your clock. Answer 2xx within 10 seconds; any other answer (a redirect is not followed) or none is a failed attempt, retried with exponential backoff (1 minute doubling, at most 6 hours) for 12 attempts (about 21 hours). 50 failed attempts in a row disable the subscription.
Request body
WebhookSubscriptionCreate (required)
Media type: application/json
Example request · application/json
{
"url": "https://erp.buyer.example/hooks/croppath",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"description": "Buyer ERP"
}Responses
| Status | Type | Description |
|---|---|---|
| 201 | WebhookSecretapplication/json | The subscription, with its secret shown this once. |
| 400 | Errorapplication/json | Invalid JSON, an unknown field, a bad URL (not https, credentials, a fragment, a host that does not resolve or resolves to an address that is not public), bad event types or description, or a bad X-Request-Id; or an Idempotency-Key header, which this operation refuses: its response holds the signing secret, which is stored only encrypted. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only while the company is leaving CropPath or has left (its records can be read and exported, not changed). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 409 | Errorapplication/json | The tenant holds 20 subscriptions already. |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
| 503 | Errorapplication/json | No key-encryption key is configured (AGRITRACE_ISSUER_KEK): a secret cannot be stored; nothing changed. Retry after |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 201 | string | Request id: the caller's |
Cache-Control | 201 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 409 | string | Request id: the caller's |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 500 | string | Request id: the caller's |
X-Request-Id | 503 | string | Request id: the caller's |
Retry-After | 503 | string | Seconds to wait before retrying. |
Example responses
Response 201 · application/json
{
"subscription": {
"id": 3,
"url": "https://erp.buyer.example/hooks/croppath",
"description": "Buyer ERP",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"status": "active",
"disabled_reason": null,
"disabled_at": null,
"consecutive_failures": 0,
"created_by": "admin@coop.example",
"created_at": 1790000000.5,
"updated_at": 1790000000.5
},
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw3qdbLeXcY4o="
}Response 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Response 400 · application/json · url
{
"error": "invalid url: https:// only",
"code": "invalid_url"
}Response 400 · application/json · private
{
"error": "invalid url: the host resolves to an address that is not a public one",
"code": "invalid_url"
}Response 400 · application/json · resolve
{
"error": "invalid url: the host does not resolve",
"code": "invalid_url"
}Response 400 · application/json · event_types
{
"error": "invalid event_types: a non-empty list of distinct types from lot.sealed, lot.recalled, lot.withdrawn, lab_result.recorded, shipment.departed, lot.trust_tier_changed, report.filed",
"code": "invalid_event_types"
}Response 400 · application/json · description
{
"error": "invalid description: at most 200 characters on one line",
"code": "invalid_description"
}Response 400 · application/json · unknown
{
"error": "unknown fields: secret",
"code": "unknown_fields"
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 400 · application/json · idempotency_key_not_supported
{
"error": "idempotency key not supported",
"code": "idempotency_key_not_supported"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 403 · application/json · company_read_only
{
"error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
"code": "company_read_only"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 409 · application/json
{
"error": "subscription limit reached: at most 20 per tenant",
"code": "subscription_limit_reached"
}Response 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}Response 503 · application/json
{
"error": "webhooks unavailable: no key-encryption key is configured",
"code": "webhooks_unavailable"
}GET /v1/webhooks/{id}
One webhook subscription
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · getWebhook
Never its secret. Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role. Another tenant's answers like a missing one. no-store.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The subscription id. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookSubscriptionapplication/json | The subscription. |
| 400 | Errorapplication/json | A bad X-Request-Id. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant). |
| 404 | Errorapplication/json | No such subscription of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"id": 3,
"url": "https://erp.buyer.example/hooks/croppath",
"description": "Buyer ERP",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"status": "active",
"disabled_reason": null,
"disabled_at": null,
"consecutive_failures": 0,
"created_by": "admin@coop.example",
"created_at": 1790000000.5,
"updated_at": 1790000000.5
}Response 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}PATCH /v1/webhooks/{id}
Change, disable or enable a webhook subscription
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · updateWebhook
Changes the URL (checked as on create), the event types, the description, or enabled. Disabling fails the pending deliveries (subscription_disabled, redeliverable once enabled again); enabling resets the failure count. Audited (webhook.update, with the host, event types and status before and after). Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The subscription id. |
Request body
WebhookSubscriptionUpdate (required)
Media type: application/json
Example request · application/json
{
"enabled": false
}Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookSubscriptionapplication/json | The subscription as changed. |
| 400 | Errorapplication/json | Invalid JSON, an empty body, an unknown field, a bad URL, event types, description or |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only while the company is leaving CropPath or has left (its records can be read and exported, not changed). |
| 404 | Errorapplication/json | No such subscription of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"id": 3,
"url": "https://erp.buyer.example/hooks/croppath",
"description": "Buyer ERP",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"status": "disabled",
"disabled_reason": "manual",
"disabled_at": 1790003600.5,
"consecutive_failures": 0,
"created_by": "admin@coop.example",
"created_at": 1790000000.5,
"updated_at": 1790003600.5
}Response 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Response 400 · application/json · url
{
"error": "invalid url: https:// only",
"code": "invalid_url"
}Response 400 · application/json · private
{
"error": "invalid url: the host resolves to an address that is not a public one",
"code": "invalid_url"
}Response 400 · application/json · resolve
{
"error": "invalid url: the host does not resolve",
"code": "invalid_url"
}Response 400 · application/json · event_types
{
"error": "invalid event_types: a non-empty list of distinct types from lot.sealed, lot.recalled, lot.withdrawn, lab_result.recorded, shipment.departed, lot.trust_tier_changed, report.filed",
"code": "invalid_event_types"
}Response 400 · application/json · description
{
"error": "invalid description: at most 200 characters on one line",
"code": "invalid_description"
}Response 400 · application/json · unknown
{
"error": "unknown fields: secret",
"code": "unknown_fields"
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 400 · application/json · empty
{
"error": "nothing to change: give url, event_types, description or enabled",
"code": "nothing_to_change"
}Response 400 · application/json · enabled
{
"error": "invalid enabled: true or false",
"code": "invalid_enabled"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 403 · application/json · company_read_only
{
"error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
"code": "company_read_only"
}Response 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks/{id}/rotate-secret
Replace a webhook subscription's secret (shown once)
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · rotateWebhookSecret
A new secret replaces the old one at once: the next delivery is signed with it. Audited (webhook.rotate_secret, never the secret). Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role. no-store. A session must have confirmed its password within the last 10 minutes (SELF-1-2, #183), else 401 reauthentication_required before anything is done.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The subscription id. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookSecretapplication/json | The subscription, with its new secret shown this once. |
| 400 | Errorapplication/json | A bad X-Request-Id; or an Idempotency-Key header, which this operation refuses: its response holds the new signing secret, which is stored only encrypted. |
| 401 | Errorapplication/json | No valid session, API token or legacy token; or a session whose password was last confirmed more than 10 minutes ago ( |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only while the company is leaving CropPath or has left (its records can be read and exported, not changed). |
| 404 | Errorapplication/json | No such subscription of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
| 503 | Errorapplication/json | No key-encryption key is configured (AGRITRACE_ISSUER_KEK): a secret cannot be stored; nothing changed. Retry after |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 500 | string | Request id: the caller's |
X-Request-Id | 503 | string | Request id: the caller's |
Retry-After | 503 | string | Seconds to wait before retrying. |
Example responses
Response 200 · application/json
{
"subscription": {
"id": 3,
"url": "https://erp.buyer.example/hooks/croppath",
"description": "Buyer ERP",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"status": "active",
"disabled_reason": null,
"disabled_at": null,
"consecutive_failures": 0,
"created_by": "admin@coop.example",
"created_at": 1790000000.5,
"updated_at": 1790000000.5
},
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw3qdbLeXcY4o="
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 400 · application/json · idempotency_key_not_supported
{
"error": "idempotency key not supported",
"code": "idempotency_key_not_supported"
}Response 401 · application/json · credentials
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 401 · application/json · reauthentication
{
"error": "reauthentication required: confirm your password with POST /v1/auth/reauth",
"code": "reauthentication_required"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 403 · application/json · company_read_only
{
"error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
"code": "company_read_only"
}Response 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}Response 503 · application/json
{
"error": "webhooks unavailable: no key-encryption key is configured",
"code": "webhooks_unavailable"
}GET /v1/webhooks/{id}/deliveries
A webhook subscription's delivery log
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · listWebhookDeliveries
Newest first, one page (limit, default 50, at most 200; cursor from the previous page), optionally of one status. Deliveries finished more than 30 days ago are removed. Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role. Not audited (a read). no-store.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The subscription id. |
statusoptional | query | "pending" | "delivered" | "failed" | Only deliveries of this status. |
limitoptional | query | integer | 1 to 200 (default 50). |
cursoroptional | query | string | The previous page's |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookDeliveryPageapplication/json | One page of deliveries. |
| 400 | Errorapplication/json | A bad |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant). |
| 404 | Errorapplication/json | No such subscription of this tenant (another tenant's answers like a missing one). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Cache-Control | 200 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"items": [
{
"id": 41,
"subscription_id": 3,
"event_id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
"event_type": "lot.sealed",
"status": "delivered",
"attempts": 1,
"next_attempt_at": null,
"last_attempt_at": 1790000003.2,
"last_status": 204,
"last_error": null,
"created_at": 1790000002.9,
"delivered_at": 1790000003.4
}
],
"next_cursor": null
}Response 400 · application/json · status
{
"error": "invalid status: one of pending, delivered, failed",
"code": "invalid_status"
}Response 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}Response 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks/{id}/deliveries/{delivery}/redeliver
Send a delivered or failed delivery again
Authentication: cookie, bearer, oauth2 · OAuth2 scopes: webhook_admin · redeliverWebhook
The delivery is pending again, due now, with a fresh retry window (attempts from 0) and the same event id and body. Audited (webhook.redeliver). Allowed for tenant_admin and platform_admin acting for the tenant (X-Tenant), through a session or an API token of their role.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | The subscription id. |
deliveryrequired | path | string | The delivery id. |
Idempotency-Keyoptional | header | string | Makes a retry of this request safe (#169). A client-chosen key, 1 to 255 visible ASCII characters (a UUID is a good choice), scoped to the caller's tenant and principal (session user, API token or legacy token). The first request with a key runs; when it answers 2xx, that response (status, body and headers) is stored and replayed for 24 hours to every request with the same key and the same method, path, query and body bytes, marked |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | WebhookDeliveryapplication/json | The delivery, pending again. |
| 400 | Errorapplication/json | A bad X-Request-Id; or a malformed or repeated Idempotency-Key header. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin and platform_admin), tenant not allowed (X-Tenant), origin not allowed or CSRF token missing or invalid (cookie sessions on unsafe methods). SELF-2-4 (#193): also company read-only while the company is leaving CropPath or has left (its records can be read and exported, not changed). |
| 404 | Errorapplication/json | No such subscription of this tenant, or no such delivery of it. |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 409 | Errorapplication/json | The subscription is disabled, or the delivery is still pending. Or the Idempotency-Key's first request is still running ( |
| 413 | Errorapplication/json | The request body is over 1 MiB. |
| 422 | Errorapplication/json | The Idempotency-Key was used by this principal within 24 hours with another method, path, query or body. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
Response headers
| Name | Status | Type | Description |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
Idempotent-Replayed | 200 | "true" |
|
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 404 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 409 | string | Request id: the caller's |
Retry-After | 409 | string | Seconds to wait before retrying. |
X-Request-Id | 413 | string | Request id: the caller's |
X-Request-Id | 422 | string | Request id: the caller's |
X-Request-Id | 500 | string | Request id: the caller's |
Example responses
Response 200 · application/json
{
"id": 41,
"subscription_id": 3,
"event_id": "evt_6f1c2d3e4a5b46c7889900aabbccddee",
"event_type": "lot.sealed",
"status": "pending",
"attempts": 0,
"next_attempt_at": 1790007200.5,
"last_attempt_at": 1790000003.2,
"last_status": 204,
"last_error": null,
"created_at": 1790000002.9,
"delivered_at": null
}Response 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Response 400 · application/json · invalid_idempotency_key
{
"error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
"code": "invalid_idempotency_key"
}Response 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Response 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Response 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Response 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Response 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Response 403 · application/json · company_read_only
{
"error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
"code": "company_read_only"
}Response 404 · application/json
{
"error": "not found: 41",
"code": "not_found"
}Response 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Response 409 · application/json · disabled
{
"error": "subscription disabled: enable it first",
"code": "subscription_disabled"
}Response 409 · application/json · pending
{
"error": "delivery is pending: it is attempted again at its next attempt time",
"code": "delivery_is_pending"
}Response 409 · application/json · idempotency_key_in_use
{
"error": "idempotency key in use: retry later",
"code": "idempotency_key_in_use"
}Response 409 · application/json · idempotency_key_used
{
"error": "idempotency key used: the response is too large to replay",
"code": "idempotency_key_used"
}Response 409 · application/json · idempotency_key_unrecorded
{
"error": "idempotency key used: the request ran but its response was not recorded",
"code": "idempotency_key_used"
}Response 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Response 422 · application/json
{
"error": "idempotency key mismatch: the key was used with another request",
"code": "idempotency_key_mismatch"
}Response 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}