# API reference

URL: https://docs.astor.sh/api-reference

Endpoints and request schemas generated from the running API contract.

## Authentication and project scope

REST uses a project-scoped API key in the Authorization header. Select the project, open your profile menu and choose **Connected tools → Build with the Astor API → Create an API key**. Current membership, role and granted scope apply to each operation. See [connection setup](https://docs.astor.sh/integrations).

This reference is generated at build time from Astor’s actual OpenAPI document. Download the [snapshot for this release](https://docs.astor.sh/openapi.json), or read the [live platform contract](https://astor.sh/api/v1/openapi.json).

## Requests and responses

Use JSON bodies where shown. Write operations require the inputs in their schema, including version/revision and idempotency fields where applicable. Retry uncertain writes with the same payload and key.

The source contract currently documents request shapes and common error statuses. Some response bodies have no detailed schema; that omission does not mean the response is empty.

## Workspace ticket review

This explicit contract is available only where workspace ticket review is configured and the actual project-scoped API key has current owner, admin or product authority. A quote requires `tickets:read`; acceptance and included answers require both `tickets:read` and `tickets:write`. Linked Live evidence also requires `live:read`. OAuth tokens remain restricted to MCP. Free or unconfigured policy does not gain AI from a schema or profile marker.

Read the current full ticket, then request `GET /api/v1/work-quote?action=analysis&ticket_id=<uuid>&version=<current version>`. Supply `ticket_id` and a positive safe-integer `version` together, only for `action=analysis`; duplicate or extra query parameters are refused. The returned workspace quote includes `ticketId`, `version`, `amount`, `reviewDigest` and `stage: review_only`. Its false permission fields grant no work authority. HTTP **200** reserves no capacity: the quote can show the six-unit total when fewer units remain, and acceptance can return **402** without allocating it.

A product owner must request the root review. Show the actual returned total and obtain explicit user confirmation, or honor already explicit bounded approval. Do not manufacture consent from the confirmation literal.

| Request | Exact JSON body fields |
| --- | --- |
| New root: `POST /api/v1/tickets/:ticket_id/analysis` | `version`, `review_digest` copied from returned `reviewDigest`, `confirmation: accept_workspace_analysis_total`, UUID `idempotency_key` |
| Included answer: same path | `version`, nonempty `message`, current `analysis_id`, UUID `idempotency_key` |

The path supplies `ticket_id`; any explicitly supplied body ID must match it. Send no root `message`, caller work ID, amount, paid flag or session field. Reading a quote does not accept it. A changed ticket, user, access or quote can require a fresh review and approval.

Read `analysis.canFollowUp`, `analysis.followUpQuestions` and the actual current `analysis.id` before answering. A necessary user-supplied answer to those accepted questions adds zero units, even without new-review capacity, and needs no new paid approval. A first message, resolved question or changed scope does not create an included review. A valid answer stopped by the accepted estimated cost ceiling may return a saved `blocked` analysis and clarification history, without a new model attempt or extra units.

For an uncertain write, retain the original body and key and read the current ticket. An explicit exact-key replay stays with its original accepted review; only its genuinely pending attempt can continue. Running, paused or unknown provider work is not retried, and no replacement review or automatic refund follows. **503** can mean the configured workspace review is unavailable; it is not permission to fall back to an implicit root review.

## Existing project analysis contract

Eligible existing guided project agreements keep their action-only quote and empty-message six-unit new-review contract. Their nonempty `message` must answer current saved open questions with the current `analysis_id`; first, resolved or changed questions return **409** instead of free model work. The new paired workspace quote fields are not accepted as a replacement for that legacy contract.

## Screenshots and recordings

On Starter and Pro, an API key with `tickets:write` can attach a file to an open ticket with `POST /api/v1/tickets/:ticket_id/attachments`. Send the raw file as the body with its `Content-Type`: `image/jpeg` or `image/png` up to 2 MB, or on Pro `video/webm` or `video/mp4` up to 4 MB. Put optional details as JSON in the `Astor-Attachment` header: `label`, `page`, a `highlight` area on a screenshot, and `duration_ms` and `focus` zoom points on a recording. Areas use fractions from 0 to 1 of the frame. `GET` on the same path lists attachments, `GET` and `DELETE` on `/attachments/:attachment_id` read or remove one. A ticket holds at most 10 files. A wrong type returns **415**, and a file whose content does not match its type returns **400**.

## Request limits

A request sent too quickly can return **429**. Wait before retrying. For a write with an uncertain result, retain the original idempotency key and payload while your access is unchanged; do not create a new operation just to retry. Request limits do not change your project’s AI budget or charge for reading.

The endpoint reference is generated from the API contract: https://docs.astor.sh/openapi.json
