# `POST /v1/jobs/{job_id}/webhook/replay`: replay a webhook

Source: https://bobabanana.com/docs/api/reference/replay-webhook/

> POST /v1/jobs/{job_id}/webhook/replay: send a finished job's webhook again. Parameters, example request and response, and errors.

**`POST /v1/jobs/{job_id}/webhook/replay` is the endpoint to send a finished job's webhook again.** Sends the job's final event again from the first attempt, with fresh result links and the same event id.

**At a glance**

- **Endpoint:** `POST /v1/jobs/{job_id}/webhook/replay`
- **Base URL:** `https://bobabanana.com/api/v1`
- **Auth:** `Authorization: Bearer bb_...`
- **Success:** `200`
- **Safe to retry:** no
- **Guide:** [Webhooks](https://bobabanana.com/docs/api/webhooks/)

## Request

### Path parameters

| Name | Type | Required | Default | Limits | Description |
|---|---|---|---|---|---|
| `job_id` | string | yes |  |  | The job's id, e.g. x_8d21c0f4a9b3. |

### Headers

| Header | Required | Description |
|---|---|---|
| `Authorization` | yes | `Bearer bb_...`: your API key (or send `X-API-Key: bb_...`) |

## Example request

```bash
curl -X POST https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3/webhook/replay \
  -H "Authorization: Bearer $BOBABANANA_API_KEY"
```

```python
import os

import requests

r = requests.post(
    "https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3/webhook/replay",
    headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"},
    timeout=60,
)
r.raise_for_status()
print(r.json())
```

```javascript
const res = await fetch("https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3/webhook/replay", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
  },
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());
```

## Response

**200** ([JobWebhook](https://bobabanana.com/docs/api/reference/objects/#job-webhook)): Successful Response

```json
{
  "status": "pending",
  "attempts": 0,
  "last_status": 200
}
```

## Errors

Errors use the [error object](https://bobabanana.com/docs/api/reference/objects/#error). The codes this endpoint can return (what to do about each is in [Error codes](https://bobabanana.com/docs/api/errors/)):

| Status | Code | Meaning |
|---|---|---|
| 400 | [`bad_request`](https://bobabanana.com/docs/api/errors/#bad_request) | The `Content-Length` header is not a number. |
| 401 | [`invalid_api_key`](https://bobabanana.com/docs/api/errors/#invalid_api_key) | The key is wrong, revoked or belongs to no workspace. |
| 401 | [`missing_api_key`](https://bobabanana.com/docs/api/errors/#missing_api_key) | No API key was sent. |
| 403 | [`workspace_suspended`](https://bobabanana.com/docs/api/errors/#workspace_suspended) | The workspace that owns the key is suspended. |
| 404 | [`job_not_found`](https://bobabanana.com/docs/api/errors/#job_not_found) | No job with this id for this API key (another key's jobs are invisible). |
| 409 | [`job_active`](https://bobabanana.com/docs/api/errors/#job_active) | The job has not finished yet. |
| 409 | [`no_webhook`](https://bobabanana.com/docs/api/errors/#no_webhook) | The job was created without a `webhook_url`. |
| 409 | [`webhook_pending`](https://bobabanana.com/docs/api/errors/#webhook_pending) | The job's webhook is still being delivered. `Retry-After`: 60 s. |
| 413 | [`too_large`](https://bobabanana.com/docs/api/errors/#too_large) | The request body is over the limit for this endpoint (JSON bodies 100 MB, uploads 64 MB). |
| 429 | [`too_many_attempts`](https://bobabanana.com/docs/api/errors/#too_many_attempts) | Too many requests with wrong keys came from your address. `Retry-After` is set. |
| 500 | [`internal_error`](https://bobabanana.com/docs/api/errors/#internal_error) | Something went wrong on our side. |
| 503 | [`maintenance`](https://bobabanana.com/docs/api/errors/#maintenance) | BobaBanana is being updated; changes are paused for a few minutes. Reads still work. `Retry-After` is set. |

## Related

- Guide: [Webhooks](https://bobabanana.com/docs/api/webhooks/)
- [All endpoints](https://bobabanana.com/docs/api/reference/)
- [Objects](https://bobabanana.com/docs/api/reference/objects/)
- [Error codes](https://bobabanana.com/docs/api/errors/)
