# Error handling

#### 1. Not Found (404)

If a requested resource is not found in the database, API Builder returns a `404 Not Found` status code. This response indicates that the server has not found a match for the requested endpoint or resource.

#### 2. Authentication Error (401)

When a request is made without proper authentication or with invalid credentials, API Builder responds with a `401 Not Authenticated` status code. This error signifies that the request has not been applied because it lacks valid authentication credentials for the target resource.

\
ChatGPT

Translated and adapted into documentation style, the text would be:

***

### Handling API Responses and Errors

API Builder is designed to provide clear and informative responses to API requests. This includes specific error handling mechanisms for situations where requests cannot be fulfilled due to various reasons, such as authentication issues or data not found in the database. Below are the guidelines on how API Builder handles these scenarios:

#### 1. Not Found (404)

If a requested resource is not found in the database, API Builder returns a `404 Not Found` status code. This response indicates that the server has not found a match for the requested endpoint or resource.

**Example:**

```json
jsonCopy code{
  "error": "Resource not found"
}
```

#### 2. Authentication Error (401)

When a request is made without proper authentication or with invalid credentials, API Builder responds with a `401 Not Authenticated` status code. This error signifies that the request has not been applied because it lacks valid authentication credentials for the target resource.

**Example:**

```json
jsonCopy code{
  "error": "Not authenticated"
}
```

#### 3. Parameter Validation (400)

API Builder validates request parameters to ensure they match the expected data types and formats. If a parameter is of an incorrect type—for instance, if a request expects a string type parameter but receives a boolean—the request will be rejected with a `400 Bad Request` status code. This response indicates that the server cannot process the request due to an apparent client error (e.g., malformed request syntax).


---

# 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://www.apibuilder.com/home/endpoints/error-handling.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.
