# Errors

### Error Response

All error responses have the same response body structure.

| Attribute | Type     | Description                                                                                                       |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| msg       | `string` | A human-readable message providing you details about the error. Typically, these error can be shown to end users. |
| code      | `string` | An [error code](#error-codes) enum that can be handled programmatically                                           |

### HTTP Errors

Picket uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the

* `2xx` range indicate success
* `4xx` range indicate an error that failed given the request parameters (required parameter was omitted, invalid wallet address format, etc)
* `5xx` range indicate an error with Picket's servers.

| HTTP Error Code                    | Description                                                                           |
| ---------------------------------- | ------------------------------------------------------------------------------------- |
| 200 - OK                           | Everything worked as expected.                                                        |
| 400 - Bad Request                  | The request was not formed as expected, often due to missing a required parameter.    |
| 401 - Unauthorized                 | No valid API key provided.                                                            |
| 404 - Not Found                    | The requested resource doesn't exist.                                                 |
| 409 - Conflict                     | The request conflicts with another request                                            |
| 424 - Failed Dependency            | Upstream failure (potentially due to an upstream node provider)                       |
| 429 - Too Many Requests            | You hit us with more requests than expected. We recommend you space our your requests |
| 500, 502, 503, 504 - Server Errors | Something went wrong on Picket's end. (We're in beta.)                                |

### Error Codes

When an error can be handle programmatically, the response will include an *error code*—a short enumerable string—as a value for the `code` attribute. Below are a list of possible error code values

| Code                      | Description                                                                                                                            |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `account_exists`          | There is already an account associated with the given wallet address                                                                   |
| `api_key_invalid`         | The provided API key is invalid, likely because it doesn't exist or the authorization header is malformed                              |
| `authentication_required` | The request is missing the required authentication header                                                                              |
| `parameter_invalid`       | One or more provided parameters are malformed                                                                                          |
| `resource_not_found`      | The requested resource is not found. This can occur when the resource doesn't exist or you do not have permission to view the resource |
| `permission_denied`       | The user lacks permission, or token ownership                                                                                          |
| `parameter_missing`       | One or more required parameter values are missing                                                                                      |


---

# Agent Instructions: 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:

```
GET https://docs.picketapi.com/picket-docs/reference/concepts/errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
