HTTP API
All endpoints are under /api. Authentication uses the YACSSESSION cookie set by /api/init or a login endpoint. Request bodies are JSON unless noted; uploads are multipart/form-data.
Endpoints that return protobuf messages respond with binary protobuf when you send Accept: application/x-protobuf, and protobuf JSON otherwise. See Architecture → Wire format.
Requests are rate limited (100 per minute per client by default). Errors use standard status codes with a message body — 401 unauthenticated, 404 not found, 413 upload too large, 422 validation error, 429 rate limited, 503 feature not configured.
Session
| Method | Path | Auth | Description |
|---|
GET | /init | — | Returns the current session, or creates a guest user and device and sets the cookie. |
GET | /config | — | Client config: VAPID public key, Google client ID, max image size. |
GET | /login/:token | — | Consume a one-time device login token and redirect to /. |
POST | /login/google | guest | Body { token } (Google ID token). Signs in or upgrades the guest. |
POST | /logout | ✓ | Sign out and remove the current device. |
GET | /me | ✓ | Current session (user, device, token). |
GET | /health | — | Health check used by Docker. |
Profile & account
| Method | Path | Description |
|---|
GET | /profile | Current user's profile. |
PUT | /profile | Update name, about, labels, etc. |
PUT | /profile/avatar | Upload avatar (photo field, multipart). |
DELETE | /profile/avatar | Remove avatar. |
PUT | /profile/location | Update location for Nearby. |
PUT | /profile/searchable | Toggle Nearby visibility. |
POST | /profile/notifications/subscribe | Register a Web Push subscription. |
POST | /profile/notifications/setting | Update notification preferences. |
DELETE | /account | Delete the account. |
Devices
| Method | Path | Description |
|---|
GET | /devices | List devices (_id, ip, name). |
POST | /devices | Create a device and a one-time login token valid for 2 hours. Returns { device, token }; the login URL is /api/login/<token>. |
DELETE | /devices/:device | Remove a device. |
Users & discovery
| Method | Path | Description |
|---|
GET | /users/:user | A user's public profile. |
POST | /connect/:user | Open (or find) a direct conversation with a user. |
GET | /discover/users | Nearby users. Query: distance (km, default 1), label[] (repeatable). |
GET | /discover/users/:user | A discoverable user's profile. |
GET | /labels | All labels. |
Conversations
| Method | Path | Description |
|---|
GET | /conversations | List conversations. |
POST | /conversations | Create a conversation (returns its invitation code). |
POST | /conversations/accept | Body { code }. Accept an invitation. |
GET | /conversations/:conversation | Get one conversation. |
PUT | /conversations/:conversation | Update (e.g. group name). |
DELETE | /conversations/:conversation | Leave/delete. |
GET | /conversations/:conversation/users | Members. |
POST | /conversations/:conversation/users | Add members (groups). |
DELETE | /conversations/:conversation/users/:user | Remove a member. |
POST | /conversations/:conversation/connect | Body { username }. Invite a public user by username. |
Messages
| Method | Path | Description |
|---|
GET | /conversations/:conversation/messages | Message history. |
POST | /conversations/:conversation/send-file | Upload an image (file field, multipart). |
POST | /conversations/:conversation/messages/remove | Delete messages. |
POST | /conversations/:conversation/messages/synced | Mark messages as synced to this device. |
PUT | /messages/:message | Edit a message. |
POST | /envelopes | Relay an envelope (yacs.v1.EnvelopeSend). |
Calls
| Method | Path | Description |
|---|
POST | /conversations/:conversation/call | Start a call. |
POST | /calls/:message/reject | Reject an incoming call. |
GET | /calls/ice-servers | STUN/TURN servers with short-lived TURN credentials. |
Example
# Create a guest session and keep the cookie
curl -c jar.txt http://localhost:3000/api/init
# List conversations as JSON
curl -b jar.txt http://localhost:3000/api/conversations