# OpenAPI document

The API describes itself in an [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.0) document:

```txt
https://api.circuitry.company/v1/openapi.json
```

The document describes each endpoint, request field, response field, and error code. A request for the document needs no API key.

## Uses

* Make a typed client. For example, [openapi-typescript](https://openapi-ts.dev) makes TypeScript types for each request and response.
* Give the document to an agent. Then the agent can call the API without the docs.
* Open the document in a browser tool, such as Swagger UI. The API lets every origin read the document.

```bash
npx openapi-typescript https://api.circuitry.company/v1/openapi.json -o circuitry.d.ts
```

## Error codes

Each response in the document has a schema. Each error response lists the codes that the endpoint can return with that HTTP status. A program can use these codes to make decisions, as [Errors](/errors) describes.

## Docs for agents

Agents can also read these docs as plain text. [llms.txt](https://docs.circuitry.company/llms.txt) lists the pages, and [llms-full.txt](https://docs.circuitry.company/llms-full.txt) has all the pages in one file.
