# Reliable requests
Source: https://docs.simpleserve.ai/docs/resources/reliability
Summary: Use idempotency, background runs, event replay, and request IDs.
Availability: available
Last reviewed: 2026-08-30

Agent work can take longer than one HTTP connection. Use the run ID as the durable handle for the work.

## Prevent duplicate work

Send an `Idempotency-Key` with `POST /v1/runs`, file uploads, and cancellation requests.

```http
Idempotency-Key: customer-order-4821-review
```

Store the key with your local operation. Use the same key and body after a network failure.

## Retrieve accepted work

A run request can return `202`. Read the run URL from `location` and wait for `retry-after` seconds.

```bash
curl https://api.simpleserve.ai/v1/runs/run_01JXYZ1234567890 \
  -H "Authorization: Bearer $SIMPLESERVE_API_KEY"
```

Stop polling when the status is `completed`, `limit_reached`, `cancelled`, or `failed`.

## Resume a stream

Save the latest SSE event ID. Send it as `Last-Event-ID` when you reconnect.

```http
Last-Event-ID: evt_01JXYZ1234567890
```

## Trace a request

Every response includes `x-request-id`. Log it with the run ID and idempotency key.
