Create your first twin.
Goal: look at the templates, choose layers, create a synthetic twin and find it again among the twins of your project.
STEP 1 Keep your key in the environment#
Use a project key with the read and write scopes (see the quickstart). Never paste it into code you commit. The TypeScript and CLI tabs use the SDK and the command line, which are not published as packages yet.
export STARCO_KEY="starco_dk_…"
export API="https://api.starco.dev/v1"import os, requests
API = "https://api.starco.dev/v1"
H = {"Authorization": f"Bearer {os.environ['STARCO_KEY']}"}import { Client } from '@starco/sdk';
const c = new Client({ baseUrl: "https://api.starco.dev/v1", apiKey: process.env.STARCO_KEY });starco config # the address and the key that `starco keys create --save` kept; the secret is never printedSTEP 2 Look at the templates Beta#
The catalogue has three parts: the templates, the layers and every observation kind with its unit and accepted bounds.
curl -s "$API/templates" -H "Authorization: Bearer $STARCO_KEY" | jq '.templates[] | {id, layers}'cat = requests.get(f"{API}/templates", headers=H).json()
for t in cat["templates"]:
print(t["id"], t["layers"], t["wellness_kinds"][:3])const cat = await c.templates.list();
for (const t of cat.templates) console.log(t.id, t.layers, t.wellness_kinds.slice(0, 3));starco templates{ "templates": [
{ "id": "daily_movement", "name": "…", "focus": "…", "layers": ["wellness", "biomarkers"],
"wellness_kinds": ["exercise_minutes", "steps", "sitting_breaks", "strength_sessions", "sleep_hours", …] },
{ "id": "sleep_optimization", … }, … ],
"layers": ["wellness", "biomarkers"],
"kinds": [
{ "kind": "sleep_hours", "layer": "wellness", "unit": "h", "accepted_min": 0, "accepted_max": 24, "integer": false },
{ "kind": "steps", "layer": "wellness", "unit": "steps", "accepted_min": 0, "accepted_max": 100000, "integer": true },
{ "kind": "resting_heart_rate", "layer": "biomarkers", "unit": "bpm", "accepted_min": 20, "accepted_max": 200, "integer": false },
… ] }A template orders the wellness kinds by what it focuses on; every kind of a layer is accepted on any twin that has the layer. The bounds only check that a value is recordable: they are not reference ranges.
STEP 3 Create the twin Beta#
Choose a template and switch on only the layers you need. The label is optional and is for you: up to 64 letters, digits, spaces, _, . or -, and it must not look like a real identifier.
curl -X POST "$API/twins" -H "Authorization: Bearer $STARCO_KEY" -H "Content-Type: application/json" \
-d '{"template": "daily_movement", "layers": ["wellness", "biomarkers"], "label": "tutorial-01"}'twin = requests.post(f"{API}/twins", headers=H, json={
"template": "daily_movement", "layers": ["wellness", "biomarkers"], "label": "tutorial-01"}).json()["twin"]
twin_id = twin["id"]
print(twin)const twin = await c.twins.create({ template: "daily_movement", layers: ["wellness", "biomarkers"], label: "tutorial-01" });
console.log(twin);starco twins create --template daily_movement --layers wellness,biomarkers --label tutorial-01{ "twin": { "id": "3a9d5e2c-8b14-4f7a-a6d1-c2e09f4b7d31", "template": "daily_movement",
"layers": ["wellness", "biomarkers"], "custom_layers": [],
"label": "tutorial-01", "origin": "api",
"data_class": "synthetic", "created_at": "2026-11-19T15:42:07Z", "updated_at": "2026-11-19T15:42:07Z" } }Mistakes come back with a stable code: unknown_template (with the expected list), validation_failed for a layer that does not exist, identifier_not_accepted for a label that looks like a real identifier, such as a phone number.
STEP 4 Fetch it Beta#
export TWIN=3a9d5e2c-8b14-4f7a-a6d1-c2e09f4b7d31
curl "$API/twins/$TWIN" -H "Authorization: Bearer $STARCO_KEY"print(requests.get(f"{API}/twins/{twin_id}", headers=H).json()["twin"]["layer_status"])console.log((await c.twins.get(twin.id)).layer_status);starco twins show <twin> # <twin> is the id the step before printed[ { "layer": "biomarkers", "observation_count": 0, "computed_at": "2026-11-19T15:42:07Z" },
{ "layer": "wellness", "observation_count": 0, "computed_at": "2026-11-19T15:42:07Z" } ]STEP 5 List the twins of the project Beta#
Your project already had 8 twins: the synthetic cohort it was created with, each with the 14 days that end yesterday. Yours is the ninth. Pages hold up to 200 twins; follow next_after when it is not null.
curl -s "$API/twins?limit=50" -H "Authorization: Bearer $STARCO_KEY" | jq '.data[] | [.origin, .template, .label]'page = requests.get(f"{API}/twins", headers=H, params={"limit": 50}).json()
for t in page["data"]:
print(t["origin"], t["template"], t["label"])
print("next_after:", page["next_after"])const page = await c.twins.list({ limit: 50 });
for (const t of page.data) console.log(t.origin, t.template, t.label);
console.log("next_after:", page.next_after);starco twins list --limit 50synthetic_cohort sleep_optimization synthetic-01
synthetic_cohort daily_movement synthetic-02
…
api daily_movement tutorial-01
next_after: NoneWhat just happened
The template gave the twin its starting shape and you switched on two layers. The twin exists but is empty: each layer has been computed once with no observations, and reading it now returns null values, not zeros. Every call you made is a row of the project's audit chain.