# Endpoints

> Guide, proposals, assets, icons, gallery, screens, renders, exports, checks and tokens.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://design.docs.sypnia.com/api/endpoints/

For agents: Design API endpoints under /projects/{project}: GET guide (?version), GET guide/versions, GET tokens (?format=json|css); proposals GET/POST, GET {id}, POST {id}/approve|reject (person); assets POST (multipart: logo, font with licence, image), GET, DELETE {id}; icons GET, POST (draft), GET {name}; gallery GET (pieces, combinations, patterns); screens GET, GET {case}, PUT {case} (draft), POST {case}/approve (person); renders POST {target: screen|piece|state, themes, widths} → 202 job, GET {id}; exports POST {kind: pdf|print|assets} → 202, GET {id}; checks POST {ref} → findings, GET {id}; repository GET/PUT (link to Sypnia Git/GitHub); tokens GET/POST/DELETE (API tokens).

Every path below starts with `/projects/{project}`.

## Guide and tokens

| Method and path                | Does                                                                  |
| ------------------------------ | --------------------------------------------------------------------- |
| `GET /guide?version=`          | The guide in words and its values, at a version (default: the latest) |
| `GET /guide/versions`          | Every version, who approved it and when                               |
| `GET /tokens?format=json\|css` | The tokens, as `tokens.json` or `tokens.css`                          |

## Proposals

| Method and path                                               | Does                                                                              |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `GET /proposals`, `POST /proposals`                           | List; open one `{ kind, reason, changes }` → `202` while renders are made         |
| `GET /proposals/{id}`                                         | The proposal, its before-and-after pictures and its check results                 |
| `POST /proposals/{id}/approve`, `POST /proposals/{id}/reject` | Approve (opens the pull request) or reject with a reason; a person's session only |

## Assets and icons

| Method and path                      | Does                                                                                       |
| ------------------------------------ | ------------------------------------------------------------------------------------------ |
| `POST /assets`                       | Upload a logo (SVG, PNG), a font (WOFF2, TTF, OTF, with `licence`) or an image (multipart) |
| `GET /assets`, `DELETE /assets/{id}` | List, remove                                                                               |
| `GET /icons`, `GET /icons/{name}`    | The icon set and one icon                                                                  |
| `POST /icons`                        | Draw an icon as a draft `{ name, idea }`                                                   |

## Gallery and screens

| Method and path                       | Does                              |
| ------------------------------------- | --------------------------------- |
| `GET /gallery`                        | Pieces, combinations and patterns |
| `GET /screens`, `GET /screens/{case}` | Screen files and their status     |
| `PUT /screens/{case}`                 | Save a draft screen file          |
| `POST /screens/{case}/approve`        | Approve; a person's session only  |

## Renders, exports and checks

| Method and path     | Does                                                                              |
| ------------------- | --------------------------------------------------------------------------------- |
| `POST /renders`     | `{ target, themes, widths }` → `202 { id }`; pictures of a screen, piece or state |
| `GET /renders/{id}` | Its status and image links (signed, valid 1 hour)                                 |
| `POST /exports`     | `{ kind: pdf \| print \| assets }` → `202 { id }`                                 |
| `GET /exports/{id}` | Its status and download link                                                      |
| `POST /checks`      | `{ ref }` (a branch or commit) → the findings of `design check`                   |
| `GET /checks/{id}`  | A past check                                                                      |

## Repository and tokens

| Method and path                                    | Does                                                                           |
| -------------------------------------------------- | ------------------------------------------------------------------------------ |
| `GET /repository`, `PUT /repository`               | The linked repository in Sypnia Git or GitHub, and the branch Design writes to |
| `GET\|POST /api-tokens`, `DELETE /api-tokens/{id}` | API tokens with scopes `read`, `write`, `admin`                                |

The OpenAPI document is in the engine's repository, at `spec/openapi.yaml`.
