> ## 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. Each endpoint page repeats the codes that matter for that call in its own Error Handling section; this table is the cross-cutting reference.

<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 set on the `X-API-Key` header. See [API Keys](/sdk/authentication/api-keys) |
| 404 Not Found             | `NOT_FOUND`        | Opportunity, distributor, or membership not found | Confirm the ID exists and the wallet is a member. See [Register Wallet](/sdk/authentication/register-wallet)            |
| 409 Conflict              | `CONFLICT`         | Membership already exists for this wallet address | Call `GET /v2/membership/` first to check before creating. See [Register Wallet](/sdk/authentication/register-wallet)   |
| 500 Internal Server Error | `INTERNAL`         | Server-side failure                               | Retry with exponential backoff, contact [support](https://discord.turtle.xyz) if persistent                             |
