SynaptraDocs

    Reference

    API guidelines

    How the API behaves and how to call it well: versioning, idempotent run reporting, pagination and quotas.

    #

    Versioning

    • Paths are under /api with no version prefix while the API is in preview.
    • Changes are additive: new fields and endpoints can appear at any time, so ignore fields you don't know.
    • A breaking change gets a new prefix (/api/v2/…), announced in advance, with the old one kept for a transition period.
    • Formats carry their own version: the export is synaptra.harness/1.
    #

    Idempotent run reporting

    Networks fail. A run report retried after a timeout must not count twice. Send an Idempotency-Key header with each write (POST, PATCH, DELETE; a UUID per batch is fine). A retry with the same key and body returns the first answer instead of recording again; the same key with a different body is 409 CONFLICT. Keys are kept for 24 hours, per workspace. Failed requests aren't kept, so retrying one runs it again.

    • Report in batches (a few hundred rows), each with its own key.
    • Give each row a stable task id, and tag draws in meta.axes, so repeated draws are distinct rows, not duplicates.
    • Retry on network errors, 429 and 5xx, with backoff. Don't retry 4xx other than 429: fix the request.
    #

    Pagination

    Lists that can grow (runs, experiments, versions) take limit (default 50, at most 200) and return next_cursor: a string when there's more, null at the end. Pass it back as cursor to continue. Cursors are opaque; don't build them yourself. Short lists (harnesses, tools, live runs, events) answer in one go.

    http
    GET /api/harnesses/support-bot/versions?limit=50&cursor=eyJ2IjoxMH0 HTTP/1.1
    #

    Quotas and good citizenship

    • Respect 429 and Retry-After. Synaptra is free because it costs us little to run; quotas keep it that way.
    • Don't poll tight loops: follow live runs with the live tool or a few-second interval.
    • Report results, not raw data: no datasets, prompts or outputs in meta.
    • Use one token per machine or pipeline, so you can revoke one without stopping the rest.
    #

    Errors your code should expect

    Branch on the status and code, show detail to people. A 409 GATE on close means the variant didn't pass its gate, or hasn't passed the held-out test set yet (it's required to adopt, even if the variant only ran the cheaper tiers): report more runs, close with iterate or reject, or adopt anyway with a written override_reason. A 429 QUOTA won't clear by retrying soon; a 429 RATE_LIMITED will. See Errors and rate limits.

    Something unclear or missing? Email support@synaptra.my.