Examples
Working code for the jobs people automate first. Each one uses only what the API and contracts above document.
Sync your client stores into your database
Node.js 20. Needs a key with workspace:read. Reads every page and honours rate limits.
const base = `https://deploteka.com/api/agent/v1/tenants/${process.env.DEPLOTEKA_TENANT_ID}`;
const headers = { authorization: `Bearer ${process.env.DEPLOTEKA_API_TOKEN}` };
export async function allStores() {
const stores = [];
let after = null;
do {
const url = new URL(`${base}/workspace/stores`);
url.searchParams.set('limit', '100');
if (after) url.searchParams.set('after', after);
const response = await fetch(url, { headers });
if (response.status === 429) {
await new Promise((r) => setTimeout(r, Number(response.headers.get('retry-after') ?? 5) * 1000));
continue;
}
if (!response.ok) throw new Error(`DeploTeka answered ${response.status}`);
const page = await response.json();
stores.push(...page.items); // { id, shopDomain, status }
after = page.nextCursor;
} while (after);
return stores;
}
Check access before onboarding a client
Python. Needs collaboration:write to send the request. The idempotency key makes a retry safe: the same key and body never send a second request.
import os, requests
base = f"https://deploteka.com/api/agent/v1/tenants/{os.environ['DEPLOTEKA_TENANT_ID']}/shopify"
headers = {"Authorization": f"Bearer {os.environ['DEPLOTEKA_API_TOKEN']}"}
shop = "client-store-shopify-demo.myshopify.com"
seen = requests.get(f"{base}/access", params={"shopDomain": shop}, headers=headers, timeout=30)
seen.raise_for_status()
if seen.json()["relationship"] == "none":
receipt = requests.post(f"{base}/access-requests", headers=headers, timeout=30, json={
"shopDomain": shop,
"permissions": ["analytics_reports"],
"context": {"system": "other", "projectRef": "onboarding", "taskRef": shop},
"idempotencyKey": f"onboarding:{shop}:access:v1",
})
receipt.raise_for_status()
print(receipt.json()["requestId"], receipt.json()["nextAction"])
Read the receipt later with GET /shopify/access-requests/{requestId}. The merchant approves the request in Shopify.
Ask an AI assistant about your fleet
Add the workspace server from MCP for AI tools, then ask “Which of my client stores are not installed yet?”. The assistant calls workspace_stores_list and reads the status of each store.
Receive merchant tokens in your backend
A complete receiver in Express and in FastAPI is on the Token delivery page. For a Shopify app with code, see the Fleet contract example.
Keep the deploy agent running
On a computer or server that stays on, in the app’s repository. The pass comes from the Deploy agent page, lasts 90 days and sees only this app:
shopify auth login
export DEPLOTEKA_TOKEN=dpa_… # a pass for this app
npx deploteka-deploy-agent
Run it under systemd, pm2 or anything that restarts it. Every new client store of the app releases while it runs.