> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nemu.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# REST API

> Read and write Context from your own code

Base URL `https://app.nemu.cc/api/v1/context`. Authenticate with a Context key
(`Authorization: Bearer nctx_...`) or an OAuth token holding `context:read` or `context:write`.
Requests and responses are JSON, every body is validated, and unknown fields are refused.

| Method and path | Does |
| - | - |
| `GET /projects` | List projects with note counts |
| `POST /projects` | Open or create: `{ "name", "root_commit"?, "remote_url"? }` |
| `GET`, `PATCH`, `DELETE /projects/{id}` | Read, update (`{ "name"?, "accent_color"? }`, at least one) or delete with all notes |
| `GET /projects/{id}/entries` | List notes; `tag`, `device`, `limit`, `cursor` |
| `POST /projects/{id}/entries` | Save one note |
| `POST /projects/{id}/entries/batch` | Save up to 100: `{ "entries": [...] }` |
| `GET /projects/{id}/load?branch=` | The text an agent gets at session start, plus its parts |
| `GET /projects/{id}/search?q=` | Search; `tag`, `device`, `limit` up to 50 |
| `POST /projects/{id}/stale` | Mark notes stale or fresh by name |
| `GET`, `PATCH`, `DELETE /entries/{id}` | Read, edit or delete one note |
| `GET /export` | Everything, as one JSON document |
| `GET`, `POST /devices`, `PATCH`, `DELETE /devices/{id}` | Devices (nemu CLI sign in only) |
| `GET`, `POST /keys`, `DELETE /keys/{id}` | Context keys (nemu CLI sign in only) |

```bash theme={null}
curl -s https://app.nemu.cc/api/v1/context/projects \
  -H "Authorization: Bearer $NEMU_CONTEXT_KEY"

curl -s https://app.nemu.cc/api/v1/context/projects/$PROJECT/entries \
  -H "Authorization: Bearer $NEMU_CONTEXT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"decision/queue_choice","subject":"Why BullMQ","body":"We need Redis anyway and BullMQ gives retries and rate limits for free."}'
```

Send `X-Nemu-Device: dev_...` to attribute writes to a device. A key bound to a device always writes
as that device.

`accent_color` picks the color of the project's banner and card in the console: `red`, `blue`,
`white`, `magenta`, `ember`, `amber`, `lime`, `emerald`, `teal`, `violet`, `rose` or `sage`. A
project without one gets a color chosen from its id, so it never changes on its own.

## Errors

Errors are `{ "error", "code" }` with a matching status: `400` invalid input, `401` missing or bad
credentials, `403` a limit reached, a missing scope or a revoked device, `404` not found, `409` a
near duplicate, `429` rate or daily limit. A `500` also carries `reference`, which you can quote
to support.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.