# Build with AI agents

> Give coding agents and LLMs the Duty API docs as llms.txt, Markdown pages and the OpenAPI document, with a prompt to start from.

This documentation is built to be read by coding agents (Claude Code, Cursor, Copilot, Codex…) as well as by people.

## What agents can read

| Resource | URL | Use it for |
| --- | --- | --- |
| `llms.txt` | [`/llms.txt`](/llms.txt) | The index: what Duty is and links to every page. |
| `llms-full.txt` | [`/llms-full.txt`](/llms-full.txt) | Every page of the English docs in one file. |
| `llms-small.txt` | [`/llms-small.txt`](/llms-small.txt) | The same, trimmed for small context windows. |
| OpenAPI 3.1 | [`/openapi/v1.json`](/openapi/v1.json) | The exact contract: paths, parameters, schemas. Generate typed clients from it. |
| Markdown pages | Add `index.md` to any page URL | One topic, without navigation or markup. |

Every page also has **Copy as Markdown** under its title, ready to paste into a chat.

## A prompt to start from

```md
You are integrating with the Duty service desk API (v1).
- Docs: https://docs.client.service-desk.goldmaster.io/llms-full.txt
- OpenAPI: https://docs.client.service-desk.goldmaster.io/openapi/v1.json
- Base URL: https://api.client.service-desk.goldmaster.io/v1
- Auth: `Authorization: Bearer $DUTY_API_KEY`, read from the environment. Never hard-code it.

Rules:
- Responses wrap the payload in `data`; lists add `pagination` (perPage up to 100).
- Identify requests by `number` (e.g. GM-000123). Compare `status.code`, display `status.name`.
- On errors read `error` (stable key) and `fields`; log `traceId`.
- Honor `Retry-After` on 429. Verify webhook signatures over the raw body.

Task: <describe what to build>
```

## Generate a typed client

The OpenAPI document works with standard generators:

```sh
# TypeScript types
npx openapi-typescript https://docs.client.service-desk.goldmaster.io/openapi/v1.json -o duty-api.d.ts

# Any language supported by OpenAPI Generator
npx @openapitools/openapi-generator-cli generate \
  -i https://docs.client.service-desk.goldmaster.io/openapi/v1.json -g python -o duty-client
```

## Keep agents safe

- Give agents a key with only the scopes the task needs; a key with `read` cannot change anything.
- Let agents read the key from an environment variable, never from the prompt or the code.
- Review any code that sends `PATCH` or `DELETE` before running it against your production workspace.
