# Extend a batch's deliveries

`POST https://api.parasend.com/v1/batches/{id}/extend_expiry`

Source: https://parasend.com/docs/api/batches/extend-expiry

Authentication: `Authorization: Bearer <API key>` (a `ps_test_` key in test mode, `ps_live_` in live mode).
Send an `Idempotency-Key` header: a retry with the same key returns the first answer.

Gives the batch's pending deliveries longer to be confirmed: never past a year, nor past their documents' deletion.

## Path parameters

- `id` (string, required): The batch's ID, starting `bat_`.

## Body (application/json)

- `expires_at` (string · date-time, optional)
- `add_days` (integer, optional)
- `dry_run` (boolean, optional)

## Example: Give everyone 7 more days, as a preview

```bash
curl -X POST "https://api.parasend.com/v1/batches/bat_01M6R27T8SXWNM911FS53W4S9F/extend_expiry" \
  -H "Authorization: Bearer $PARASEND_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "add_days": 7,
    "dry_run": true
  }'
```

```js
const res = await fetch('https://api.parasend.com/v1/batches/bat_01M6R27T8SXWNM911FS53W4S9F/extend_expiry', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PARASEND_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    add_days: 7,
    dry_run: true,
  }),
});
const data = await res.json();
```

## Response 200

How many were extended, and how many stopped short at their limit.

```json
{
  "object": "expiry_extension",
  "dry_run": true,
  "pending": 2,
  "extended": 0,
  "capped": 2,
  "latest_allowed": "2026-12-06T09:15:05.587Z",
  "documents_retention_days": 30
}
```

Errors: one shape, `{"error": {type, code, message, param, request_id}}`; every code is listed at https://parasend.com/docs/errors.
