Skip to main content

How to read a worked sample

Every endpoint guide in these docs ships a worked sample — a request you can copy verbatim, and the exact response envelope the platform returns. This index shows you how to turn a sample into a running call, and where the rest of the worked examples live.

Reading an endpoint’s sample

A worked sample is a complete request: method, path, headers, and body. Nothing in it is a placeholder except your API key — so translating the curl block to your language is mechanical.
  1. Copy the request as written. Base URL is always https://api.orbit.devotel.io/api/v1; substitute a Test key (dv_test_sk_…) for X-API-Key and the sample runs against the sandbox.
  2. Translate it per language. The headers and JSON body carry over unchanged — only the HTTP client differs.
cURL
fetch
The Node SDK collapses the same call to one line — orbit.messages.send({ channel: "sms", to, body }) — and returns the same data the raw response carries. Pick whichever you read faster; the envelope below is identical either way.

The four envelope shapes

Every response the platform returns is one of four shapes. Recognize the shape at a glance and you know how to read the body:
  1. Success envelope{ data, meta }, HTTP 2xx. The resource (or a resource id) sits under data; meta carries the request correlation id:
  2. Success with pagination — the same { data, meta }, with meta.pagination telling you how to fetch the next page:
  3. 207 Multi-Status batch envelope — bulk endpoints answer 207 on partial success and give you one row per recipient; branch on status per row, never blanket-retry the batch:
    Canonical sample: Bulk sends (207 and all) and the Verify API.
  4. Error envelope{ error, meta } on any non-2xx status. Branch on the stable error.code, never on the human-readable error.message:
    Canonical sample: API error handling by example.

Where the worked examples live

Samples are spread across the docs deliberately — each sits next to the endpoint it exercises. This page is the index:

Pagination in one paragraph

List endpoints paginate one of two ways, and the response tells you which: most endpoints are cursor-based — read meta.pagination.cursor when has_more is true and pass it back as ?cursor=…; a smaller set of dashboard-oriented families is offset-based — the page metadata (items, total, limit, offset) lives inside the data envelope instead. The shape of the response you’re holding identifies the style. The full contract, with both loops in code: Pagination.