Skip to content

York HTTP API

Manage files, tokens and sharing over HTTP. Data reads and writes happen in the local file.

Make a request

Send Authorization: Bearer <token> with JSON bodies. Errors return { "error": "..." }. File names use lowercase letters, digits, - or _, up to 63 characters.

After signing in with the CLI and creating notes, mint a read-only token and fetch its description:

YORK_API_TOKEN=$(york token notes --role read)
curl -fsS https://york.so/api/files/notes -H "Authorization: Bearer $YORK_API_TOKEN"

Endpoint reference

York HTTP API endpoints
Method and pathRequest / response
POST /api/device/codeStarts a device login (what york login does): { device_code, user_code, verification_uri, verification_uri_complete, interval, expires_in }. No token needed.
POST /api/device/token{ device_code } polls the login. Returns 400 { error: 'authorization_pending' } until approved in the browser, then { token } (account-wide).
GET /api/whoami{ email, role, file }
GET /api/usageAccount usage (account-wide token).
GET /api/files{ files: [...] }
POST /api/files{ name, description?, notes? } creates a database.
GET /api/files/:nameDescribe: schema, notes, row counts.
GET /api/files/:name/exportSQL dump.
POST /api/files/:name/migrate{ migrations: [{ sql }], notes? }. Returns 202 with an approval when destructive.
DELETE /api/files/:nameReturns 202 with an approval link.
GET /api/approvals/:id{ status: pending | executing | done | denied | failed | expired, error }
POST /api/tokens{ file, role? } mints a scoped token.
DELETE /api/tokens/currentRevokes the calling token.
GET /api/people{ people: [{ id, name, username, nickname }] }, ranked by sharing frequency and recency.
PUT /api/people/nickname{ person, nickname } sets a private nickname; person is a contact id, name, nickname or username.
POST /api/files/:name/shares{ to, role? } invites by exact @username, email or contact name/nickname. Role defaults to write. Returns 200 { invited: true } for a contact, or 202 { approval: { id, url, status } } for someone new; the agent waits for the owner's browser approval.
GET /api/files/:name/sharesOwner only. { people: [{ name, username, nickname, email, role, accepted, handle }] }: guests and pending email invitations. handle is what DELETE accepts.
DELETE /api/files/:name/sharesOwner only. { to } revokes a guest's access or cancels a pending invitation, by @username, email or contact name. Never needs approval; 404 if that person has no access.
GET /api/invites{ invites: [{ name, display_name, from, role, new_person }] }, every invitation waiting for this account.
POST /api/shares/accept{ file } accepts an invitation. Returns 202 with an approval for a first invitation from someone new.
POST /api/shares/decline{ file } declines an invitation.
GET|PUT /api/settings{ browser_approvals: boolean }. When false, requests that would return 202 run immediately for account-wide tokens and return 200.
/api/files/:name/sync/*Push, pull, digest, snapshot and import, used by the york sync daemon. There is no endpoint that runs SQL.