suo
API reference

API overview

Base URL, authentication, headers and versioning for every route.

Base URL

https://api.usesuo.com/1

The 1 segment is the API version. Every route in this reference is relative to this base.

Authentication

Send your key in the x-suo-key header:

curl https://api.usesuo.com/1/indexes/docs/search \
  -H "x-suo-key: suo_search_YOUR_KEY" \
  -H "content-type: application/json" \
  -d '{ "q": "quickstart" }'

There are three key types, and a route only accepts the ones with enough privilege:

PrefixTypeCan
suo_admin_adminEverything, including settings and key management
suo_write_writeWrite and delete records; cannot search
suo_search_searchSearch only; public, index- and referrer-restricted

A scoped token (suo_scoped_…, minted by you — see Scoped tokens) is sent the same way, in x-suo-key.

Response headers

HeaderMeaning
x-suo-data-versionThe index's current data version at the time of this response
x-suo-degradedPresent and true when a read was served in a degraded mode (see Errors and limits)
x-suo-request-idA unique ID for this request, worth including if you report an issue

Versioning

The API is versioned by URL segment (/1/…). A new major version would ship as /2/… while /1/… keeps working; there is no silent breaking change within a version.

Errors

Every error is JSON with a stable code:

{ "error": { "code": "rate_limited", "message": "Too many requests.", "retryAfterSeconds": 4 } }

See the full list of codes, what triggers each one, and the numeric limits behind them in Errors and limits.

Routes

RouteMethodPurpose
/1/indexes/:index/searchPOSTSearch
/1/indexes/:index/recordsPOSTWrite records
/1/indexes/:index/records/:objectIDGETGet a record
/1/indexes/:index/partitions/:partitionDELETEClear a partition
/1/indexes/:index/settingsGET, PUTSettings
/1/indexesGETList indexes
/1/events/clickPOSTClick events
/1/tasks/:taskIdGETTasks
/1/healthGETHealth

The TypeScript SDK

Everything here is also available typed, generated from the same contract:

import { createSuoClient } from '@suo/client';

const client = createSuoClient({ host: 'https://api.usesuo.com', apiKey: process.env.SUO_SEARCH_KEY });
const results = await client.search('docs', { q: 'quickstart' });

On this page