---
title: "Add a webhook"
method: POST
path: "/agents/{id}/webhooks"
tags: ["Webhooks"]
---

# Add a webhook

`POST /agents/{id}/webhooks`

## Request

- Base URL: `https://app.artil.ai/api`
- URL: `https://app.artil.ai/api/agents/{id}/webhooks`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://mcp.artil.ai/oauth/authorize`
    - Token URL: `https://mcp.artil.ai/oauth/token` scopes: `agent`

Post an agent's events to a URL, signed as Standard Webhooks describes. Adding the same URL again returns its webhook with the same secret.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `url` string, uri, required

## Response `201`

The webhook and its secret

- WebhookSetup
  - `id` string, uuid, required
  - `url` string, uri, required: Where Artil posts the agent's events
  - `deliveredAt` string, date-time, nullable, required
  - `error` string, nullable, required: Why the last delivery failed
  - `erroredAt` string, date-time, nullable, required
  - `attempts` integer, required: How many times the event Artil is retrying has failed
  - `retryAt` string, date-time, nullable, required: When Artil next retries a failed event
  - `createdAt` string, date-time, required
  - `secret` string, required: The Standard Webhooks key each delivery is signed with

## Other responses

- `4XX`: The request failed; the error says why
- `5XX`: The request failed; the error says why

---

[API](https://skmtc.dev/artil/apis/artil-api.md) - [All operations](https://skmtc.dev/artil/apis/artil-api/llms.txt) - [OpenAPI document](https://skmtc.dev/artil/apis/artil-api/revisions/55db0efa0cb8?raw)
