# Retry

Zeplo automatically retries failed requests based on the `retries` field set when enqueuing.

### How it works

When you enqueue a request, set `retries` to control how many additional attempts Zeplo can make after the first delivery fails:

```bash
curl -X POST "https://api.zeplo.io/queues/enqueue" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "POST",
    "url": "https://your-api.com/webhook",
    "body": "{\"event\": \"payment.completed\"}",
    "retries": 5
  }'
```

With `retries: 5`, Zeplo will make up to 6 total calls — 1 initial attempt plus 5 retries.

The default is **3 retries** if not specified.

### Backoff

Retries use automatic exponential backoff. The delay between retries increases with each attempt, giving your endpoint time to recover from transient failures.

### What is considered a failure?

A request attempt is considered failed if:

- The HTTP response status code is **≥ 400**
- The request **times out** (30 second default)
- The target URL is **unreachable** (DNS failure, connection refused, etc.)

### Final failure

After all attempts are exhausted, the request status is set to **failed**. You can monitor failed requests in the dashboard or get notified via [webhooks](/docs/webhooks).

### Retry with schedules

When a [schedule](/docs/schedule) triggers a request, the `retries` from the schedule's request template applies to each individual execution. If one scheduled execution fails all its retries, the schedule continues — the next cron tick will create a fresh request.
