# Endpoints

> Account, organizations, projects, the board, sessions, uploads, credits, limits and notifications.

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

For agents: Endpoints: GET /me, GET /me/devices, DELETE /me/devices/{id}; GET|POST /orgs, GET /orgs/{org}, GET /orgs/{org}/members, PATCH|DELETE /orgs/{org}/members/{user}, POST /orgs/{org}/invitations, DELETE /invitations/{id}; GET|POST /projects, GET /projects/{project}, GET /projects/{project}/board; GET|POST /sessions, GET|PATCH|DELETE /sessions/{id}, POST /sessions/{id}/messages (SSE: text, question, approval, panel, task, done), POST /sessions/{id}/answers (person), POST /sessions/{id}/share; POST /uploads; GET /credits, GET /credits/ledger, POST /credits/top-ups ({ amount } in USD, at least 5, else 400 amount_too_small; → PayPal approval URL; person), GET /credits/top-ups/{id}; GET|PUT /limits; POST /spending-requests, POST /spending-requests/{id}/approve; GET /notifications, POST /notifications/read, GET|PUT /notifications/settings, POST /push-subscriptions; GET /desktop/updates.json.

## You, your devices

| Method and path                              | Does                                  |
| -------------------------------------------- | ------------------------------------- |
| `GET /me`                                    | you, your level, your organizations   |
| `GET /me/devices`, `DELETE /me/devices/{id}` | where you are signed in; sign one out |

## Organizations

| Method and path                                            | Does                                    |
| ---------------------------------------------------------- | --------------------------------------- |
| `GET /orgs`, `POST /orgs`                                  | your organizations; create one          |
| `GET /orgs/{org}/members`                                  | members and roles                       |
| `PATCH /orgs/{org}/members/{user}`, `DELETE …`             | change a role, remove a member          |
| `POST /orgs/{org}/invitations`, `DELETE /invitations/{id}` | invite by e-mail (valid 7 days), cancel |

## Projects and the board

| Method and path                   | Does                                    |
| --------------------------------- | --------------------------------------- |
| `GET /projects`, `POST /projects` | the organization's projects; create one |
| `GET /projects/{project}`         | a project and the products it uses      |
| `GET /projects/{project}/board`   | every card, with when each was read     |

## Sessions

| Method and path                             | Does                                                       |
| ------------------------------------------- | ---------------------------------------------------------- |
| `GET /sessions?project=`, `POST /sessions`  | list, create                                               |
| `GET /sessions/{id}`, `PATCH …`, `DELETE …` | read with its messages, rename/pin/archive, delete         |
| `POST /sessions/{id}/messages`              | send a message; the answer streams as `text/event-stream`  |
| `POST /sessions/{id}/answers`               | answer a question or an approval (people only)             |
| `POST /sessions/{id}/share`                 | share with members, or hand over                           |
| `POST /uploads`                             | attach a file (up to 25 MB) → an id to send with a message |

`POST /sessions/ses_8k2…/messages → text/event-stream`

```text
event: text
data: {"text":"I'd add one case: «Order for today»."}

event: panel
data: {"tab":"map","case":"place-order"}

event: approval
data: {"id":"apr_41…","what":"Approve the case place-order","undo":"Retire the case"}

event: done
data: {}
```

## Credits and limits

| Method and path                                                   | Does                                                                                                                                  |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /credits`                                                    | balance, held credits, and the credits that expire next with their date                                                               |
| `GET /credits/ledger?project=&group=&from=&to=&cursor=`           | the ledger (`Accept: text/csv` for CSV)                                                                                               |
| `POST /credits/top-ups`                                           | start a top-up of `amount` USD (at least 5; less answers `400 amount_too_small`) → a PayPal address for a person to pay (people only) |
| `GET /credits/top-ups/{id}`                                       | its state: `waiting`, `paid`, `failed`                                                                                                |
| `GET /limits`, `PUT /limits`                                      | spending limits                                                                                                                       |
| `POST /spending-requests`, `POST /spending-requests/{id}/approve` | ask to spend; approve (owner or billing)                                                                                              |

## Notifications

| Method and path                                  | Does                                          |
| ------------------------------------------------ | --------------------------------------------- |
| `GET /notifications`, `POST /notifications/read` | list, mark read                               |
| `GET /notifications/settings`, `PUT …`           | what reaches you, where                       |
| `POST /push-subscriptions`                       | register a phone or browser for notifications |

The OpenAPI document is in the App repository, at `spec/openapi.yaml`.
