SDKs and the command line.
Two SDKs and a command line over the same API: Python, TypeScript and starco. They add nothing the HTTP API does not have: they save you the plumbing, check hashes for you and turn refusals into typed errors.
pip install or npm install command that works today, and this page does not give one. Until they are distributed, every guide on this site also shows plain HTTP with curl, which needs nothing installed. If you have an account, ask us for the source of the SDKs.What there is#
| Piece | Runs on | Dependencies | Status |
|---|---|---|---|
Python SDK (starco) | Python 3.8 or later | None: standard library only | Beta · in development |
TypeScript and JavaScript SDK (@starco/sdk) | Node 18 or later, browsers, Deno (ES modules, global fetch and Web Crypto) | None | Beta · in development |
Command line (starco) | Python 3.8 or later | The Python SDK | Beta · in development |
The type definitions of the TypeScript SDK are written by hand. They are compiled with the TypeScript compiler in strict mode against a program that uses every resource, together with a list of misuses the types must refuse, and a test compares them with what the SDK exports and does at run time. The SDK itself is tested as JavaScript.
The same task, four ways#
Read the current value of a measure, set it only if nobody changed it meanwhile, and read a week of a series by day. Choose a language once: every code block of this site follows your choice.
V=$(curl -s "$API/twins/$TWIN/state/wellness.mood_level" -H "Authorization: Bearer $STARCO_KEY" | jq -r .version)
curl -s -X PUT "$API/twins/$TWIN/state/wellness.mood_level" -H "Authorization: Bearer $STARCO_KEY" \
-H "Content-Type: application/json" -H "If-Match: \"$V\"" -d '{"value": 4}'
curl -s "$API/twins/$TWIN/series/wellness.sleep_hours?bucket=1d&agg=avg" -H "Authorization: Bearer $STARCO_KEY"import os, starco
c = starco.Client(api_key=os.environ["STARCO_KEY"])
mood = c.state.get(TWIN_ID, "wellness.mood_level") # value, version
c.state.set(TWIN_ID, "wellness.mood_level", 4, if_version=mood["version"])
week = c.series.range(TWIN_ID, "wellness.sleep_hours", bucket="1d", agg="avg")import { Client } from '@starco/sdk';
const c = new Client({ apiKey: process.env.STARCO_KEY });
const mood = await c.state.get(TWIN_ID, 'wellness.mood_level'); // value, version
await c.state.set(TWIN_ID, 'wellness.mood_level', 4, { ifVersion: mood.version });
const week = await c.series.range(TWIN_ID, 'wellness.sleep_hours', { bucket: '1d', agg: 'avg' });starco twin get $TWIN wellness.mood_level
starco twin set $TWIN wellness.mood_level 4 --if-version 3
starco series range $TWIN wellness.sleep_hours --bucket 1d --agg avgWhat they do for you#
- typed errors
- A refusal becomes an exception that carries the API's
code: a 409 on a version is a version-conflict error withcurrent_version; the command line prints(error) <code>: …and exits 1. The codes are the ones of errors by code. - verified exports
- Exporting a twin checks that the SHA-256 of the bytes received equals
X-Content-SHA256, and fails if it does not. - the audit chain, recomputed
- One call reads the whole chain of the project and recomputes every hash on your machine, with no secret.
- webhook signatures
- A helper verifies
X-Starco-Signature(t=<unix time>,v1=<hex>) with a tolerance for the timestamp, in constant time. - no revalidation
- The SDKs do not second-guess the server: buckets, aggregations, types and URLs are validated there, and the refusal reaches you with its code.
- no surprises with null
- A measure without a value is
None,nullor(nil). Never zero.
How they are tested#
The SDKs and the command line are run against a real server of the API, not a stand-in for it: state with versions and conflicts, transactions, series with gaps, events, webhook signatures, the read-only MCP and the audit chain. The code blocks of the guides of this site are extracted from the published pages and executed the same way, so what you read is what ran.