> For the complete documentation index, see [llms.txt](https://docs.pixiebrix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pixiebrix.com/developer-api/making-an-api-request.md).

# Making an API Request

## Base URL

The PixieBrix API base URL is <https://app.pixiebrix.com/api/>.

## Authentication

To authenticate with the REST API, provide an `Authorization` header with the token for the user, where “YOURTOKEN” is the token for your [Service Accounts](/developer-api/service-accounts.md):

```
Authorization: Token YOURTOKEN
```

## Version

The PixieBrix API is versioned using the `Accept` header. We follow [Semver](https://semver.org/) and will increment the major version on any backward incompatible changes.

The latest version of the API is version=2.0:

```
Accept: "application/json; version=2.0"
```

## Content-Type

The PixieBrix API accepts and responds with JSON. However, certain endpoints can also return other formats (notably, CSV). Refer to the OpenAPI specification for which content types a given endpoint supports

To control the response format, vary the mime type in the `Accept` header:

```
Accept: "application/json; version=2.0"
Accept: "text/csv; version=2.0"
```

## Pagination

Pagination is supported for API version >= 2.0, see [#version](#version "mention").

Pagination metadata is returned in the `Link` response header. See [RFC 8288](https://datatracker.ietf.org/doc/html/rfc8288) for how relation types (`first`, `prev`, `next`, `last`) work.

Most languages have library support for working with `Link` headers:

* [The Python requests package](https://docs.python-requests.org/en/master/_modules/requests/utils/)
* [The npm parse-link-header package](https://www.npmjs.com/package/parse-link-header)

Responses also include an `X-Total-Count` header, which is the total number of items across all pages.

Exception: `GET /api/databases/:databaseId/records/` does not include an `X-Total-Count` or a `last` link, because those require a full record count which performs poorly for very large databases.

You can request a specific page with the `page` query parameter. For example:

```
GET /api/databases/:databaseId/records/?page=2
```

You can control the page size with the `page_size` query parameter. For example:

```
GET /api/databases/:databaseId/records/?page_size=150
```

If `page_size` is omitted, the default is 100. The maximum allowed `page_size` is 1000.

Replace `:databaseId` with your database's id. You must have access to that database for the request to succeed.

## Throttling

The API endpoints are throttled on a per-token basis to prevent abuse. If you make too many requests within a given minute, the server will respond with `429 Too many requests`.

## Cross-Origin Resource Sharing (CORS)

The Developer API is intended to be used with service accounts (see [Service Accounts](/developer-api/service-accounts.md)). The Developer API does not currently support [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

To make a Developer API call from a custom web application, proxy requests through a backend or CORS Proxy.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pixiebrix.com/developer-api/making-an-api-request.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
