Create a webhook endpoint
/developer/v1/webhook-endpoint/create/documentRegisters an HTTPS address that receives the event types you choose, with a signing secret of
its own. The secret is shown here, in secret, and can be read again in the developer
console. Verify every delivery with it. The URL must be public: https only, no user name or
password, no fragment, no localhost or private IP address. Choose at least one event type,
each once; ping cannot be chosen. Your key's scopes must let it see every type you choose,
otherwise the call answers scope_not_granted. A company has at most 10 endpoints per mode;
the 11th answers webhook_endpoint_limit_reached. The endpoint is made in the mode of your key.
Events are thin: an event holds a type and ids, never the object itself, so fetch the object with your API key. Each endpoint has its own signing secret; verify every delivery with it.
Request body
descriptionstringnullableWhat the endpoint is for. Optional, at most 500 characters.
Max length 500
eventsarray of enumrequiredThe event types the endpoint receives: at least one, no duplicates.
pingcannot be chosen, it is only sent by a test. Your key's scopes must let it see each type.urlstringrequiredThe HTTPS address events are sent to. It must be a public address: no
http, no user name or password, no fragment, nolocalhostor private IP address, at most 2000 characters.Min length 1
Response 201
endpointWebhookEndpointrequiredThe endpoint.
Show child attributesHide child attributes
company_idstringrequiredThe ID of the company the endpoint belongs to.
created_atstring (date-time)requiredWhen the endpoint was created, in UTC.
descriptionstringrequirednullableWhat the endpoint is for, or
null.endpoint_idstringrequiredThe ID of the endpoint.
eventsarray of enumrequiredThe event types the endpoint receives.
is_enabledbooleanrequiredWhether events are sent to the endpoint.
modeenumrequiredtestfor the sandbox,prodfor production.testprod
previous_secret_expires_atstring (date-time)requirednullableAfter a roll, when the old secret stops being valid, in UTC.
nullwhen there is no old secret to accept.secret_last_fourstringrequiredThe last four characters of the signing secret, to tell secrets apart.
updated_atstring (date-time)requiredWhen the endpoint was last changed, in UTC.
urlstringrequiredThe HTTPS address events are sent to.
secretstringrequiredThe signing secret of the endpoint, starting with
nk-whsec-. Verify every delivery with it. Keep it private.
Errors
Every error has this shape. Branch on code, not on message. request_id equals the X-Request-Id response header.
{
"error": {
"code": "not_found",
"message": "The object does not exist.",
"request_id": "req_0123456789abcdef0123456789abcdef"
}
}| Status | Code | Meaning |
|---|---|---|
401 | invalid_api_key | The API key is missing or not valid. |
403 | company_archived | This company is archived. |
403 | company_not_live | The company must be live to use prod keys. |
403 | company_suspended | This company is suspended. |
403 | scope_not_granted | This API key does not have the scope to receive: order.created. |
409 | webhook_endpoint_limit_reached | A company can have at most 10 webhook endpoints in one mode. |
422 | validation_error | body.url: Field required |
429 | rate_limited | Too many requests. Wait before calling again. |
500 | internal_error | Something went wrong on our side. Please try again later. |
502 | upstream_error | A Nurish'd service could not complete the request. |
503 | upstream_unavailable | A Nurish'd service is unavailable. Please try again later. |
504 | upstream_timeout | A Nurish'd service did not answer in time. Please try again. |