Set Webhook
Create or replace an agent's webhook.
The configured URL receives ALL of that agent's event types — call lifecycle
(`call.received`, `call.completed`, `call.failed`), SMS (`sms.received`),
and future events — as signed JSON POSTs. Each agent may have at most one
webhook; POSTing again replaces it.
- `agent_id`: the agent whose events this webhook receives (required).
- `secret`: HMAC signing secret. Omit to auto-generate.
The response returns the full `secret` **once** — store it to verify the
`X-AgentLine-Signature` header on deliveries.
### Responses:
**200**: Successful Response (Success Response)
Content-Type: application/json
**Example Response:**
```json
{
"agent_id": "Agent Id",
"url": "Url",
"secret": "Secret"
}
```
**Output Schema:**
```json
{
"properties": {
"agent_id": {
"type": "string",
"title": "Agent Id",
"description": "Agent this webhook is scoped to"
},
"url": {
"type": "string",
"title": "Url",
"description": "Configured webhook URL"
},
"secret": {
"type": "string",
"title": "Secret",
"description": "Full signing secret. Save it now \u2014 it is masked on subsequent reads."
},
"created_at": {
"title": "Created At",
"description": "When the webhook was last (re)configured"
}
},
"type": "object",
"required": [
"agent_id",
"url",
"secret"
],
"title": "WebhookCreated",
"description": "Returned on POST \u2014 exposes the full secret this one time."
}
```
**422**: Validation Error
Content-Type: application/json
**Example Response:**
```json
{
"detail": [
{
"loc": [],
"msg": "Message",
"type": "Error Type",
"ctx": {}
}
]
}
```
**Output Schema:**
```json
{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
},
"input": {
"title": "Input"
},
"ctx": {
"type": "object",
"title": "Context"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}
```