# API responses

An API response is the data returned by a web service when a client application sends an [API request](https://splootcode.gitbook.io/api-scheduled-apps/application-programming-interfaces-apis/what-apis-look-like/api-requests). This response can be in different formats such as JSON, XML, or plain text, depending on the API's specifications.

An API response typically includes:

* **Status code**\
  A numerical code that indicates whether the request was successful or not. Common status codes include **200** for success, **400** for client errors, and **500** for server errors.
* **Response body**\
  This is the data that is returned in response to the request.

### Example

Here is an example of an API response in JSON format:

```perl
perlCopy code{
   "status": 200,
   "message": "Success",
   "data": {
      "id": 1234,
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone": "+1-123-456-7890"
   }
}
```

In this example, the response code is "200" which means the request was successful, and the response body includes the requested data in the "data" field, which is an object containing the user's ID, name, email, and phone number.

Another example of an API response in plain text format:

```css
cssCopy codeHTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8

The requested resource was not found.
```

In this example, the response code is "404" which means the requested resource was not found, and the response body is a plain text message that explains the error.

And here's some other elements that can be included in the response:

* **Headers**\
  Metadata that provides additional information about the response, such as the content type or length, caching directives, and authentication.
* **Error messages**\
  If the request was unsuccessful, an error message can provide more information about what went wrong.
* **Pagination information**\
  If the response includes a large number of results, pagination information can be included to help the client navigate through the data.
* **Rate limiting information**\
  If the API has rate limiting in place, information about the remaining requests that can be made in a given time period can be included in the response.


---

# 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://splootcode.gitbook.io/api-scheduled-apps/application-programming-interfaces-apis/what-apis-look-like/api-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.
