REST API

Everything the console does goes through this API — there are no private endpoints with extra powers. Base URL: https://animica.dev/api/cloud/v1. All money fields are integer nANM strings.

Authentication

two ways in
# API key (create in the Developer Center; scoped, prefix anm_mkt_)
curl -H "authorization: Bearer anm_mkt_…" https://animica.dev/api/cloud/v1/me

# or a signed-in browser session cookie (the console uses this)

Write operations accept an idempotency-key header — retrying with the same key returns the original result instead of repeating the action. Errors are uniform:

error shape
{ "error": { "code": "insufficient_funds", "message": "…", "details": { … } } }

Notable codes: 401 unauthorized · 402 insufficient_funds / quota_exceeded / plan_limit / billing_past_due · 403 capability_denied / suspended / code_denied · 409 conflict / not_active · 422 validation_failed / unsupported_package · 429 rate_limited / concurrency_limit / free_tier_limit · 503 busy / validator_unavailable / disabled.

Execution

methodpathpurposeauth
GET/POST/fn/{owner}/{slug}the public endpoint of a deployed function — GET query params or POST JSON body become the function's request; CORS-openoptional*
POST/functions/{id}/invokeauthenticated invoke by id: { payload?, maxSpendNanm? } — the console's Run button; returns result + logs + full receiptkey/session
POST/estimatepre-execution price estimate: typical + worst case, full per-line breakdown, at your real fee ratekey/session
POST/validatethe exact deploy-time static validator, for editors (findings with line numbers)key/session

* anonymous callers reach public, auth-optional, zero-surcharge functions inside the free tier.

cost headers on every /fn response
x-animica-request-id: rq_…       # ties the response to the execution + receipt
x-animica-cost-nanm:  5255894    # exact charge for this call, integer nANM
x-animica-status:     succeeded  # succeeded | failed | timeout

Functions & deployments

methodpathpurposeauth
GET | POST/functionslist my functions · create a function shellkey/session
GET | PATCH | DELETE/functions/{id}detail · update config (slug immutable) · archive (history preserved)key/session
GET | POST/functions/{id}/versionsimmutable version history · push new source as version max+1 and deploy itkey/session
POST/functions/{id}/deploy{version?} redeploy an existing version · {deploymentId?} resume a stalled attemptkey/session
POST/functions/{id}/rollback{version} — a NEW deployment of an OLD versionkey/session
GET/functions/{id}/deploymentsdeployment history with per-step logs and anchor statuskey/session
GET/functions/{id}/executionsexecution history: status, usage, exact moneykey/session
GET/functions/{id}/logsexecution logs, secret-redacted, cursor-pagedkey/session

Apps & marketplace

methodpathpurposeauth
GET | POST/appspublic catalog (filters, real popularity) · create an apppublic / key
GET | PATCH/apps/{slug}listing detail · update my appkey/session
POST/apps/{slug}/publishpublish / unpublishkey/session
POST/apps/{slug}/purchasebuy (one-time or subscription period) — exact split settlementkey/session
POST/apps/{slug}/authorizegrant the app capabilities with spend boundskey/session
GET | POST/apps/{slug}/reviewsreviews (verified users only)key/session
POST/reportsreport an app / function / developerpublic / key

Agents, schedules, secrets, grants

methodpathpurposeauth
GET | POST/agentslist my agents · create (function binding, budgets, own address)key/session
GET | PATCH | DELETE/agents/{slug}detail · pause/resume/update budgets · deletekey/session
POST/agents/{slug}/runrun the agent now (budgets enforced server-side)key/session
GET | POST | PATCH | DELETE/schedulesCRUD scheduled invocations (interval or 5-field UTC cron)key/session
GET | POST | DELETE/secretsnames+hints only · create/rotate (values are write-only) · deletekey/session
GET | POST | DELETE/grantsmy authorizations · create/update · revoke (immediate)key/session

Account

methodpathpurposeauth
GET/meresolved plan + entitlements + LIVE usage against every limit + balance + creditskey/session
GET/me/earningssettled vs pending earnings, by function and by daykey/session
GET/me/analyticsexecution analytics for my functionskey/session
GET | POST/developers/handleclaim / check my public handlekey/session
GET/developers/{handle}public developer profilepublic
POST/enterpriseenterprise / dedicated-capacity inquirypublic

Compute providers (the fleet)

methodpathpurposeauth
POST/providers/registerself-register a provider (payout address, capabilities); bearer token minted/held by youprovider token
POST/providers/claimatomically claim the next job (lease-based; 204 when none)provider token
POST/providers/heartbeatliveness + extend a job leaseprovider token
POST/providers/resultsubmit a job outcome — settles the provider share as spendable ANMprovider token
POST/providers/failreport a failed attempt (bounded retries)provider token
GET/providers/runtimethe runtime image + protocol the fleet must runprovider token
GET/providerspublic fleet statspublic
Admin endpoints exist under /api/cloud/v1/admin/* (pricing policy versions, finance rollups, reconciliation reports, denylist, suspensions…). They require platform-admin auth and are documented in the operator reference (docs/python-cloud.md in the repository), not here.