webhooks
7 thao tác
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
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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 |
Ví dụ phản hồi
Phản hồi 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
}
]
}Phản hồi 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks
Register a webhook subscription (secret shown once)
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Nội dung yêu cầu
WebhookSubscriptionCreate (bắt buộc)
Kiểu nội dung: application/json
Ví dụ yêu cầu · application/json
{
"url": "https://erp.buyer.example/hooks/croppath",
"event_types": [
"lot.sealed",
"shipment.departed"
],
"description": "Buyer ERP"
}Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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 |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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. |
Ví dụ phản hồi
Phản hồi 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="
}Phản hồi 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Phản hồi 400 · application/json · url
{
"error": "invalid url: https:// only",
"code": "invalid_url"
}Phản hồi 400 · application/json · private
{
"error": "invalid url: the host resolves to an address that is not a public one",
"code": "invalid_url"
}Phản hồi 400 · application/json · resolve
{
"error": "invalid url: the host does not resolve",
"code": "invalid_url"
}Phản hồi 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"
}Phản hồi 400 · application/json · description
{
"error": "invalid description: at most 200 characters on one line",
"code": "invalid_description"
}Phản hồi 400 · application/json · unknown
{
"error": "unknown fields: secret",
"code": "unknown_fields"
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 400 · application/json · idempotency_key_not_supported
{
"error": "idempotency key not supported",
"code": "idempotency_key_not_supported"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Phản hồi 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Phản hồi 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"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 409 · application/json
{
"error": "subscription limit reached: at most 20 per tenant",
"code": "subscription_limit_reached"
}Phản hồi 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}Phản hồi 503 · application/json
{
"error": "webhooks unavailable: no key-encryption key is configured",
"code": "webhooks_unavailable"
}GET /v1/webhooks/{id}
One webhook subscription
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Tham số
| Tên | Vị trí | Kiểu | Mô tả |
|---|---|---|---|
idbắt buộc | path | string | The subscription id. |
Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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 |
Ví dụ phản hồi
Phản hồi 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
}Phản hồi 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}PATCH /v1/webhooks/{id}
Change, disable or enable a webhook subscription
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Tham số
| Tên | Vị trí | Kiểu | Mô tả |
|---|---|---|---|
idbắt buộc | path | string | The subscription id. |
Nội dung yêu cầu
WebhookSubscriptionUpdate (bắt buộc)
Kiểu nội dung: application/json
Ví dụ yêu cầu · application/json
{
"enabled": false
}Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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 |
Ví dụ phản hồi
Phản hồi 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
}Phản hồi 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}Phản hồi 400 · application/json · url
{
"error": "invalid url: https:// only",
"code": "invalid_url"
}Phản hồi 400 · application/json · private
{
"error": "invalid url: the host resolves to an address that is not a public one",
"code": "invalid_url"
}Phản hồi 400 · application/json · resolve
{
"error": "invalid url: the host does not resolve",
"code": "invalid_url"
}Phản hồi 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"
}Phản hồi 400 · application/json · description
{
"error": "invalid description: at most 200 characters on one line",
"code": "invalid_description"
}Phản hồi 400 · application/json · unknown
{
"error": "unknown fields: secret",
"code": "unknown_fields"
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 400 · application/json · empty
{
"error": "nothing to change: give url, event_types, description or enabled",
"code": "nothing_to_change"
}Phản hồi 400 · application/json · enabled
{
"error": "invalid enabled: true or false",
"code": "invalid_enabled"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Phản hồi 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Phản hồi 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"
}Phản hồi 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks/{id}/rotate-secret
Replace a webhook subscription's secret (shown once)
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Tham số
| Tên | Vị trí | Kiểu | Mô tả |
|---|---|---|---|
idbắt buộc | path | string | The subscription id. |
Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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 |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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. |
Ví dụ phản hồi
Phản hồi 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="
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 400 · application/json · idempotency_key_not_supported
{
"error": "idempotency key not supported",
"code": "idempotency_key_not_supported"
}Phản hồi 401 · application/json · credentials
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 401 · application/json · reauthentication
{
"error": "reauthentication required: confirm your password with POST /v1/auth/reauth",
"code": "reauthentication_required"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Phản hồi 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Phản hồi 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"
}Phản hồi 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}Phản hồi 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
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Tham số
| Tên | Vị trí | Kiểu | Mô tả |
|---|---|---|---|
idbắt buộc | path | string | The subscription id. |
statuskhông bắt buộc | query | "pending" | "delivered" | "failed" | Only deliveries of this status. |
limitkhông bắt buộc | query | integer | 1 to 200 (default 50). |
cursorkhông bắt buộc | query | string | The previous page's |
Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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 |
Ví dụ phản hồi
Phản hồi 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
}Phản hồi 400 · application/json · status
{
"error": "invalid status: one of pending, delivered, failed",
"code": "invalid_status"
}Phản hồi 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}Phản hồi 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 404 · application/json
{
"error": "not found: 3",
"code": "not_found"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/webhooks/{id}/deliveries/{delivery}/redeliver
Send a delivered or failed delivery again
Xác thực: cookie, bearer, oauth2 · Phạm vi OAuth2: 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.
Tham số
| Tên | Vị trí | Kiểu | Mô tả |
|---|---|---|---|
idbắt buộc | path | string | The subscription id. |
deliverybắt buộc | path | string | The delivery id. |
Idempotency-Keykhông bắt buộc | 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 |
Phản hồi
| Mã trạng thái | Kiểu | Mô tả |
|---|---|---|
| 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. |
Header của phản hồi
| Tên | Mã trạng thái | Kiểu | Mô tả |
|---|---|---|---|
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 |
Ví dụ phản hồi
Phản hồi 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
}Phản hồi 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}Phản hồi 400 · application/json · invalid_idempotency_key
{
"error": "invalid idempotency key: one header of 1 to 255 visible ASCII characters",
"code": "invalid_idempotency_key"
}Phản hồi 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}Phản hồi 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}Phản hồi 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}Phản hồi 403 · application/json · csrf
{
"error": "csrf token missing or invalid",
"code": "csrf_token_missing_or_invalid"
}Phản hồi 403 · application/json · origin
{
"error": "origin not allowed",
"code": "origin_not_allowed"
}Phản hồi 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"
}Phản hồi 404 · application/json
{
"error": "not found: 41",
"code": "not_found"
}Phản hồi 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}Phản hồi 409 · application/json · disabled
{
"error": "subscription disabled: enable it first",
"code": "subscription_disabled"
}Phản hồi 409 · application/json · pending
{
"error": "delivery is pending: it is attempted again at its next attempt time",
"code": "delivery_is_pending"
}Phản hồi 409 · application/json · idempotency_key_in_use
{
"error": "idempotency key in use: retry later",
"code": "idempotency_key_in_use"
}Phản hồi 409 · application/json · idempotency_key_used
{
"error": "idempotency key used: the response is too large to replay",
"code": "idempotency_key_used"
}Phản hồi 409 · application/json · idempotency_key_unrecorded
{
"error": "idempotency key used: the request ran but its response was not recorded",
"code": "idempotency_key_used"
}Phản hồi 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}Phản hồi 422 · application/json
{
"error": "idempotency key mismatch: the key was used with another request",
"code": "idempotency_key_mismatch"
}Phản hồi 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}