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

# Error Handling

> Understanding and handling API errors

# Error Handling

The Heify API uses standard HTTP status codes to indicate the success or failure of requests. This guide explains how to handle errors effectively.

## HTTP Status Codes

| Status Code | Meaning | Description |
| :- | :- | :- |
| `200 OK` | Success | Request completed successfully |
| `201 Created` | Resource Created | New resource created successfully (e.g., configuration) |
| `400 Bad Request` | Client Error | Invalid request format or parameters |
| `403 Forbidden` | Authentication Failed | Invalid or missing API key |
| `404 Not Found` | Resource Not Found | Requested resource doesn't exist |
| `429 Too Many Requests` | Rate Limit Exceeded | Too many requests in a short period |
| `500 Internal Server Error` | Server Error | Unexpected error on Heify servers |

***

## Error Response Format

All error responses follow a consistent JSON structure:

```json theme={null}
{
  "message": "Descriptive error message explaining what went wrong"
}
```

### Example Error Response

```json theme={null}
{
  "message": "Configuration not found"
}
```

***

## Common Errors by Status Code

### 400 Bad Request

The most common error type. Occurs when the request is malformed or contains invalid parameters.

#### Common Causes

> [accordion] Missing required fields
>
> **Error**: `"Missing required field: configuration_id"`
>
> **Solution**: Ensure all required parameters are included in the request body.
>
> ```json theme={null}
> {
>   "configuration_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef"
> }
> ```

> [accordion] Invalid JSON format
>
> **Error**: `"Invalid JSON format"`
>
> **Solution**: Validate your JSON before sending. Common issues:
>
> * Missing commas between fields
> * Trailing commas
> * Unescaped quotes in strings
>
> Use a JSON validator or library to ensure correctness.

> [accordion] Invalid audio format
>
> **Error**: `"Unsupported audio format"`
>
> **Solution**: Ensure your audio file is in a supported format:
>
> * Supported: `aac`, `aiff`, `amr`, `asf`, `flac`, `mp3`, `ogg`, `wav`, `webm`, `m4a`, `mp4`
> * Max size: 200 MB
> * Max duration: 2 hours (7200 seconds)

> [accordion] Invalid group value
>
> **Error**: `"Invalid group value"`
>
> **Solution**: Use only allowed group values:
>
> * `PENDING_REVIEW`
> * `UNDER_REVIEW`
> * `ARCHIVED`
> * `""` (empty string to remove group)

> [accordion] Exceeded configuration limit
>
> **Error**: `"Maximum of 20 configurations per client exceeded"`
>
> **Solution**: Delete unused configurations before creating new ones:
>
> ```bash cURL theme={null}
> curl -X POST https://api.heify.com/delete-configuration \
>   -H "Content-Type: application/json" \
>   -H "x-api-key: YOUR_API_KEY" \
>   -d '{
>     "configuration_id": "old-config-id"
>   }'
> ```
>
> ```python Python theme={null}
> response = requests.post(
>     "https://api.heify.com/delete-configuration",
>     headers={"x-api-key": "YOUR_API_KEY"},
>     json={"configuration_id": "old-config-id"}
> )
> ```

***

#### Solutions

**1. Verify account status**

Check your account status and available resources in your Heify Dashboard

**2. Contact support**

If you believe this is an error, contact Heify [support](https://www.heify.com/contact.html) for assistance

***

### 403 Forbidden

Authentication failed. Your API key is invalid, missing, or inactive.

#### Common Causes

| Cause | Solution |
| :- | :- |
| Missing `x-api-key` header | Add the header to your request |
| Invalid API key | Verify the key in your dashboard |
| Deactivated API key | Generate a new key |
| Wrong header name | Use `x-api-key`, not `Authorization` |

#### Example Fix

```bash cURL (Wrong) theme={null}
curl -X POST https://api.heify.com/details \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY"  # Wrong header
```

```bash cURL (Correct) theme={null}
curl -X POST https://api.heify.com/details \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY"  # Correct header
```

***

### 404 Not Found

Returned when a resource does not exist, or when the endpoint URL itself is incorrect.

#### Resource not found

```json theme={null}
{
  "message": "Configuration not found"
}
```

The API returns `404` whenever a referenced resource (configuration, transcription, evaluator, or participant) does not exist in your account. Verify the ID is correct by listing the resource first:

```bash cURL theme={null}
curl -X POST https://api.heify.com/get-configurations \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{}'
```

```python Python theme={null}
response = requests.post(
    "https://api.heify.com/get-configurations",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={}
)
configs = response.json()["data"]["configurations"]
for config in configs:
    print(config["configuration_id"])
```

#### Wrong endpoint URL

```json theme={null}
{
  "message": "Endpoint not found"
}
```

#### Common causes

* Typo in the endpoint path
* Using GET instead of POST
* Incorrect base URL

| Correct | Incorrect |
| :- | :- |
| `POST https://api.heify.com/details` | `GET https://api.heify.com/details` |
| `POST https://api.heify.com/submit` | `POST https://api.heify.com/submits` |

***

### 429 Too Many Requests

You've exceeded the rate limit for the endpoint.

#### Solutions

> [accordion] Implement exponential backoff
>
> ```python Python theme={null}
> import time
>
> def request_with_retry(func, max_retries=3):
>     for attempt in range(max_retries):
>         try:
>             response = func()
>
>             if response.status_code == 429:
>                 # Exponential backoff
>                 wait_time = (2 ** attempt) * 5  # 5, 10, 20 seconds
>                 print(f"Rate limited. Waiting {wait_time} seconds...")
>                 time.sleep(wait_time)
>                 continue
>
>             return response
>
>         except Exception as e:
>             if attempt == max_retries - 1:
>                 raise
>             time.sleep(5)
>
>     raise Exception("Max retries exceeded")
> ```

> [accordion] Respect rate limits
>
> See the [Rate Limits](https://docs.heify.com/core/limits) documentation for endpoint-specific limits.

***

### 500 Internal Server Error

An unexpected error occurred on Heify's servers.

#### What to Do

**1. Retry the request**

The error may be temporary. Wait a few seconds and try again.

**2. Contact support**

If the issue persists, contact [hola@heify.com](mailto:hola@heify.com) or in the [contact page](https://www.heify.com/contact.html).

***

## Next Steps

> [card] [Authentication](https://docs.heify.com/core/authentication)
>
> Learn how to authenticate your API requests

> [card] [API Reference](https://docs.heify.com/api-reference/configuration/create.md)
>
> Explore endpoint documentation


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