# End a call

`POST` `https://goblins-call-api.onrender.com/v1/calls/:id/end`

Closes the room and records the call as ended, with `api` as the reason. Safe to send for a call that has already ended.

Works with a [workspace API key](https://www.cracklehq.com/docs/authentication) or the agent’s own key.

## Path parameters

- `id` (string, required): The `callId` returned when the call was started.

## Errors

- `404`: No call in your workspace has that ID.

Every request can also answer `401`, `429` and `500`: see [Errors](https://www.cracklehq.com/docs/errors).

## Notes

- `DELETE /v1/calls/:id` does the same thing.

Request:

cURL:

```bash
curl -X POST "https://goblins-call-api.onrender.com/v1/calls/8f1c2c1e-7b1a-4e0a-9c55-2f6f0d3b1a90/end" \
  -H "Authorization: Bearer $CRACKLE_API_KEY"
```

Node.js:

```js
const response = await fetch('https://goblins-call-api.onrender.com/v1/calls/8f1c2c1e-7b1a-4e0a-9c55-2f6f0d3b1a90/end', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CRACKLE_API_KEY}`,
  },
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

Python:

```python
import os
import requests

response = requests.post(
    "https://goblins-call-api.onrender.com/v1/calls/8f1c2c1e-7b1a-4e0a-9c55-2f6f0d3b1a90/end",
    headers={"Authorization": f"Bearer {os.environ['CRACKLE_API_KEY']}"},
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

Response · 200 OK:

```json
{
  "call": {
    "id": "8f1c2c1e-7b1a-4e0a-9c55-2f6f0d3b1a90",
    "status": "ended",
    "endReason": "api",
    "durationSeconds": 42,
    …
  }
}
```

Source: https://www.cracklehq.com/docs/reference/calls/end
