> For the complete documentation index, see [llms.txt](https://docs.astronomyapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.astronomyapi.com/requests-and-response/error-responses.md).

# Error Responses

Error response from the API should return a JSON object with the key `error` describing the nature of the error. A request validation failure will cause a `422` HTTP code to be produced.

### Sample validation error response

The below response was caused by not providing the value for the `latitude` parameter.

```javascript
 {
    "statusCode": 422,
    "errors": [
        {
            "path": [],
            "property": "instance",
            "message": "requires property \"latitude\"",
            "schema": {
                "latitude": {
                    "type": "string"
                },
                "longitude": {
                    "type": "string"
                },
                "elevation": {
                    "type": "string"
                },
                "from_date": {
                    "type": "string"
                },
                "to_date": {
                    "type": "string"
                },
                "time": {
                    "type": "string"
                },
                "required": [
                    "latitude",
                    "longitude",
                    "elevation",
                    "from_date",
                    "to_date",
                    "time"
                ]
            },
            "instance": {
                "elevation": "1000",
                "from_date": "2017-12-20",
                "longitude": "-84.39733",
                "time": "08:00:00",
                "to_date": "2017-12-27"
            },
            "name": "required",
            "argument": "latitude",
            "stack": "instance requires property \"latitude\""
        }
    ]
}
```


---

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

```
GET https://docs.astronomyapi.com/requests-and-response/error-responses.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.
