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

# Errors

> Learn how to handle errors in the Capital Check In API

# Errors

The Capital Check In API uses conventional HTTP response codes to indicate the success or failure of an API request.

## HTTP Status Codes

| Code | Description                             |
| ---- | --------------------------------------- |
| 200  | OK - Request successful                 |
| 201  | Created - Resource created successfully |
| 400  | Bad Request - Invalid request syntax    |
| 401  | Unauthorized - Authentication required  |
| 403  | Forbidden - Insufficient permissions    |
| 404  | Not Found - Resource not found          |
| 422  | Unprocessable Entity - Validation error |
| 429  | Too Many Requests - Rate limit exceeded |
| 500  | Internal Server Error - Server error    |

## Error Response Format

All error responses follow a consistent format:

```json theme={null}
{
  "error": "error_code",
  "message": "Human-readable error message",
  "details": {
    "field": "Additional error details"
  }
}
```

## Common Error Codes

### Authentication Errors

```json theme={null}
{
  "error": "invalid_credentials",
  "message": "Invalid email or password"
}
```

```json theme={null}
{
  "error": "token_expired",
  "message": "Access token has expired"
}
```

### Validation Errors

```json theme={null}
{
  "error": "validation_error",
  "message": "Validation failed",
  "details": {
    "email": "Invalid email format",
    "password": "Password must be at least 8 characters"
  }
}
```

### Resource Errors

```json theme={null}
{
  "error": "resource_not_found",
  "message": "Collaborator not found"
}
```

```json theme={null}
{
  "error": "resource_already_exists",
  "message": "User with this email already exists"
}
```

## Error Handling Best Practices

* Always check the HTTP status code first
* Parse the error response for detailed information
* Implement proper error logging
* Handle rate limiting with exponential backoff
* Provide user-friendly error messages
* Retry transient errors (5xx status codes)
