# REST API

> The public read API for the wikis (no token) and the account API for your spaces, with the OpenAPI schema.

Source: https://sinapsi.wiki/docs/rest-api/

Machine-readable schema: [OpenAPI (JSON)](https://sinapsi.wiki/api/v1/openapi.json).

## Public wikis (no token)

| Method and path | Returns |
|---|---|
| `GET /api/v1/public/wikis` | the catalogue of public wikis |
| `GET /api/v1/public/wikis/{wiki_id}` | one wiki's details |
| `GET /api/v1/public/wikis/{wiki_id}/pages` | its pages |
| `GET /api/v1/public/wikis/{wiki_id}/pages/{slug}` | one page |
| `GET /api/v1/public/wikis/{wiki_id}/search?q=` | pages matching a query in that wiki |
| `GET /api/v1/public/cerca?q=&wiki=` | site-wide search across wikis (JSON) |
| `GET /search?q=&format=md` | the same search as Markdown, for assistants |

```bash
curl "https://sinapsi.wiki/api/v1/public/wikis/gdpr-damages/search?q=non-material%20damage"
```

## Your spaces (account token)

The account token works on `/api/v1` (space tokens are MCP-only):

```bash
# your spaces
curl -H "Authorization: Bearer $SINAPSI_TOKEN" https://sinapsi.wiki/api/v1/spaces

# ask a space, with citations and frontier notes
curl -H "Authorization: Bearer $SINAPSI_TOKEN" -H "Content-Type: application/json" \
  -d '{"question": "what tone of voice does the brand use?"}' \
  https://sinapsi.wiki/api/v1/spaces/<space-id>/ask
```

## Markdown twins

Every public page has a Markdown twin: add `.md` to its path, e.g. `https://sinapsi.wiki/w/gdpr-damages/p/countries/germany.md`. Each wiki also has `/w/<wiki-id>/llms.txt`, and the site has [llms.txt](https://sinapsi.wiki/llms.txt) and [llms-full.txt](https://sinapsi.wiki/llms-full.txt).
