Account, keys and webhooks ›
Update webhook
PATCH
/v1/webhooks/{id}Change its url, events or description.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const webhook = await agental.updateWebhook("wh_3e8b0c5a9d2f7146", { events: ["sandbox.stopped"] });
Answer200 OK
- {
- "id": string,
- "url": string,
- "events": string[],
- "description": string,
- "createdAt": string,
- "updatedAt": string,
- "signingSecret": string,
- "deliveries": [{
- "id": string,
- "event": string,
- "status": string,
- "httpStatus": integer | null,
- "error": string | null,
- "createdAt": string,
- … 2 more
- }],
- }
Webhook updated.
Path
idrequiredstring |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
urlstring | Where events are POSTed. It has to start with http:// or https:// and be on the public internet. A private, loopback or reserved address is refused here. A name that leads to one is refused each time an event would be sent to it, and that delivery is recorded as failed. Redirects are not followed. |
eventsarray of string | What to send: sandbox.created, sandbox.started, sandbox.stopped, sandbox.archived, sandbox.error, sandbox.moved, sandbox.deleted, sandbox.auto_stop_set, sandbox.labels_changed, prompt.created, template.created, template.updated, template.secrets_changed (named, never with a value), template.labels_changed and template.deleted, or * for all of them, which is what is sent when this is left out. Each event has the same id in every webhook it is sent to, and a sandbox.* event in the log record a collector set with PUT /v1/telemetry is sent. e.g. ["sandbox.created","sandbox.error"] |
descriptionstring |
Returns
200 Webhook updated. Omitted fields stay.
JSON8 fields
idstring
urlstring
eventsstring[]
descriptionstring
createdAtstring
updatedAtstring
signingSecretstring
Returned only on create and rotate.
deliveriesobject[]8 fields
idstring
eventstring
statusstring
httpStatusintegernull
errorstringnull
createdAtstring
eventIdstringnull
The id of the event this was a try of: the id in what was sent.
More
An event that is not taken is tried again, eight times over about a day, under the same id.attemptintegernull
Which try of that event this was, counted from 1.
Errors and other answers
| 400 | Invalid request, or a url that is not one a webhook is sent to. Nothing was changed. |
| 404 | Not found. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.