> For the complete documentation index, see [llms.txt](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/rest-api/errors.md).

# Errors & status codes

All errors come back as:

```json
{ "error": "Human-readable message" }
```

with the appropriate HTTP status code.

## Standard codes

| Status      | Meaning               | When you see it                            |
| ----------- | --------------------- | ------------------------------------------ |
| 200         | OK                    | Success                                    |
| 400         | Bad Request           | Validation failed (Zod)                    |
| 401         | Unauthorized          | Missing / invalid bearer key               |
| 403         | Forbidden             | Blocked by policy                          |
| 404         | Not Found             | Wallet / agent / approval doesn't exist    |
| 409         | Conflict              | Insufficient funds, conflicting state      |
| 422         | Unprocessable Entity  | Recipient is the same as sender            |
| 429         | Too Many Requests     | Rate limit hit                             |
| 500         | Internal Server Error | Bug — please report with the request ID    |
| 502/503/504 | Gateway / Unavailable | Upstream Solana RPC or service degradation |

## Domain-specific errors

| Message                     | Status | Notes                                    |
| --------------------------- | ------ | ---------------------------------------- |
| `Blocked by policy`         | 403    | Check audit log for which rule fired     |
| `Wallet not found`          | 404    | Wrong ID or wrong account                |
| `Insufficient USDC`         | 409    | Top up the wallet                        |
| `Insufficient SOL for fee`  | 409    | Send a fraction of SOL to the wallet     |
| `Invalid recipient address` | 400    | Not valid base58 or wrong length         |
| `Amount must be positive`   | 400    | `amount <= 0`                            |
| `Approval already resolved` | 409    | Trying to approve an already-handled row |

## Debugging

Every response includes a `x-request-id` header. Include this when contacting support.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/rest-api/errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
