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

# Sahut REST API Reference

> Overview of the Sahut REST API — base URL, request format, response structure, error codes, and rate limits for building integrations.

The Sahut REST API lets you integrate Sahut programmatically into your systems. Use the API to sync contacts from your CRM, send proactive messages, retrieve conversation history, or build a chatbot that responds automatically to customer messages.

All API requests are made over HTTPS. The API returns JSON for all responses.

## Base URL

```
https://api.sahut.id/v1
```

All endpoints in this reference are relative to this base URL.

## Request format

Send requests as JSON with the `Content-Type: application/json` header. For `GET` requests, pass parameters as query string parameters.

```bash theme={null}
# Example: list conversations
curl https://api.sahut.id/v1/conversations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"
```

## Response format

All responses return a JSON object. Successful responses include a `data` field containing the result. Error responses include an `error` object.

**Success response:**

```json theme={null}
{
  "data": {
    "id": "conv_01HX2B9K3M5N7P",
    "status": "open",
    "created_at": "2024-03-15T08:30:00Z"
  }
}
```

**Error response:**

```json theme={null}
{
  "error": {
    "code": "not_found",
    "message": "Conversation not found",
    "status": 404
  }
}
```

## Error codes

| HTTP Status | Error code         | Meaning                                                  |
| ----------- | ------------------ | -------------------------------------------------------- |
| 400         | `bad_request`      | Request is missing required fields or has invalid values |
| 401         | `unauthorized`     | Missing or invalid API key                               |
| 403         | `forbidden`        | Your API key doesn't have permission for this action     |
| 404         | `not_found`        | The requested resource doesn't exist                     |
| 422         | `validation_error` | Request data failed validation                           |
| 429         | `rate_limited`     | Too many requests — slow down                            |
| 500         | `server_error`     | Sahut server error — try again later                     |

## Rate limits

The API enforces rate limits per API key:

| Plan     | Requests per minute |
| -------- | ------------------- |
| Starter  | 60                  |
| Pro      | 300                 |
| Business | 1,000               |

When you exceed the rate limit, the API returns `429 Too Many Requests` with a `Retry-After` header indicating how many seconds to wait.

## Pagination

List endpoints return paginated results. Use the `page` and `per_page` query parameters to navigate:

```bash theme={null}
GET /conversations?page=2&per_page=25
```

Responses include pagination metadata:

```json theme={null}
{
  "data": [...],
  "meta": {
    "total": 142,
    "page": 2,
    "per_page": 25,
    "total_pages": 6
  }
}
```

## Timestamps

All timestamps in the API are in **ISO 8601** format (UTC): `2024-03-15T08:30:00Z`.
