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

# Error Codes

> Standard HTTP error responses across all Earn API endpoints.

All endpoints return errors in a consistent shape with `code`, `status`, `error` string, and `context` object.

<CodeGroup>
  ```json Error Response Shape theme={null}
  {
    "code": 400,
    "status": "INVALID_ARGUMENT",
    "error": "Description of what went wrong",
    "context": {
      "field": "Additional context about the error"
    }
  }
  ```
</CodeGroup>

## Error reference

| Status Code               | Error              | When It Occurs                                    | How to Handle                                                                               |
| ------------------------- | ------------------ | ------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| 400 Bad Request           | `INVALID_ARGUMENT` | Invalid parameters or missing required fields     | Check request body and query params against the API reference                               |
| 401 Unauthorized          | `UNAUTHORIZED`     | Invalid or missing API key                        | Verify your `pk_live_` or `sk_live_` key is correctly set in the `X-API-Key` header         |
| 404 Not Found             | `NOT_FOUND`        | Opportunity or membership not found               | Confirm the `opportunityId` exists and the wallet is registered as a member                 |
| 409 Conflict              | `CONFLICT`         | Membership already exists for this wallet address | Call `GET /v1/membership` first to check before creating                                    |
| 500 Internal Server Error | `INTERNAL`         | Server-side failure                               | Retry with exponential backoff, contact [support](https://discord.turtle.xyz) if persistent |
