> ## Documentation Index
> Fetch the complete documentation index at: https://stage-docs.oktivo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry Logic

> Configure automatic retries for failed or unanswered calls

# Retry Logic

Oktivo supports automatic retries when a call fails to connect (busy, no answer, network error). Configure retry behavior per-call via the `retryConfig` object.

## Configuration

Pass `retryConfig` when triggering a call:

```json theme={null}
{
  "phone": "+14155551234",
  "name": "John Doe",
  "agentId": "agent_abc123",
  "retryConfig": {
    "retryCount": 3,
    "retryDelays": [5, 15, 30]
  }
}
```

### Parameters

**retryConfig** `object`

Optional retry configuration for the call.

**retryConfig properties**

**retryCount** `integer` *required*

Number of retry attempts. Must be between **1** and **5**.

**retryDelays** `array` *required*

Array of delay values in minutes before each retry. Length must equal `retryCount`.
Each value must be between **1** and **60** minutes.

## How Retries Work

1. The initial call is placed immediately
2. If the call fails (busy, no answer, error), the system waits for the first delay
3. Before each retry, credits are re-checked if insufficient, the retry is skipped
4. The process repeats until either:
   * A call connects successfully
   * All retry attempts are exhausted
   * The call is cancelled via API

```
Initial call ──▶ FAIL ──▶ wait 5min ──▶ Retry 1 ──▶ FAIL ──▶ wait 15min ──▶ Retry 2 ──▶ SUCCESS
```

## Retry Delays Example

| retryCount | retryDelays | Behavior |
| - | - | - |
| 1 | `[5]` | One retry after 5 minutes |
| 2 | `[5, 15]` | Two retries: after 5min, then 15min |
| 3 | `[5, 15, 30]` | Three retries with increasing intervals |
| 5 | `[1, 1, 5, 15, 60]` | Aggressive then backs off |

## Credit Pre-Check on Retry

Before each retry attempt, the system verifies your account has sufficient credits:

* If credits are available → retry proceeds
* If credits are insufficient → retry is skipped, contact marked as `failed`

This prevents unexpected charges when your balance is low.

## Cancelling Retries

Cancel a call and all pending retries:

```bash theme={null}
curl -X DELETE https://client-backend.oktivo.com/api/v1/crm/calls/{contactUID} \
  -H "Authorization: Bearer okt_your_token_here"
```

The contact status changes to `stopped` and no further retries are attempted.

## Monitoring Retries

Check the current retry state via the call status endpoint:

```bash theme={null}
curl https://client-backend.oktivo.com/api/v1/crm/calls/{contactUID} \
  -H "Authorization: Bearer okt_your_token_here"
```

The response includes:

* `attempts` how many attempts have been made so far
* `retryConfig` the original retry configuration
* `status` current contact status (`pending`, `in_progress`, `completed`, `failed`, `stopped`)
* `lastError` reason for the most recent failure

## Best Practices

* **Start with short delays** (5 min) for first retry, increase for subsequent attempts
* **Use 2–3 retries** for most use cases more than 3 rarely improves connection rates
* **Monitor credit consumption** each retry attempt consumes credits independently
* **Set up webhooks** for `call.failed` to track contacts that exhaust all retries
* **Consider time of day** longer delays may push retries into off-hours


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.