Complete programs, ready to run.
Eight small programs, each one whole: it creates what it needs, does one useful thing and prints the result. Every example comes in curl, Python, TypeScript and the command line; choose a language once and every page follows.
The gallery#
A device twin with a series and daily totals
A wristband sends step counts several times a day. Keep every reading as a point of the series, then read the week as one total per day, with the days without data left empty.
Example 02 · 4 minA derived measure the server keeps up to date
Define a layer of your own with a measure computed from two others. Write the inputs; read the result. The server recomputes it in the same transaction, and refuses anyone who tries to write it.
Example 03 · 3 minTwo writers and one version: safe updates
Two processes read the same measure and both want to change it. With the version they read in the request, the second one is refused instead of silently overwriting the first, and retries with fresh data.
Example 04 · 5 minEvents by cursor, and a webhook receiver that verifies signatures
Read what changed in a project with a cursor, and write the one function every webhook receiver needs: the check that a delivery really comes from STARCO and is not a replay.
Example 05 · 2 minExport a twin and check its fingerprint
Download a twin as one JSON document and prove that the bytes you stored are the bytes the server sent.
Example 06 · 4 minVerify the audit chain away from the server
Read every row of your project's audit chain and recompute its hashes on your own machine. No secret is involved, so anyone you give the rows to can do the same.
Example 07 · 4 minA read-only assistant over MCP
Give an AI assistant one hour of read-only access to the twins of one project, list the tools it gets and call one the way the assistant would. It never holds your project key.
Example 08 · 4 minImport a batch and handle what was refused
Send a batch of observations from a file. Each line is judged on its own: the good ones are stored, the bad ones come back with the index of the line and a stable reason, and sending the same batch again stores nothing twice.
Before you run one#
- You need a project key with the
readandwritescopes inSTARCO_KEY. The quickstart gets you one in five minutes. - curl tabs use
jq. Python tabs userequests. TypeScript and CLI tabs use the SDK and the command line, which are not published in a package registry yet. - Everything is synthetic. Do not send real personal or health data.