API reference

Every site has history. The same actions as over SSH and MCP. Within /v1, changes are only additive. The base address is https://satama.dev, and the full contract, in OpenAPI 3.1.0, is at https://satama.dev/v1/openapi.json. This page lists its 57 routes.

Using it

  • Sign with a token. Send Authorization: Bearer sat_..., a token made over SSH with token add <name>. a personal API token (sat_...), created over SSH with: token add <name>.
  • Errors are problems (application/problem+json) with a stable code and a detail written for people.
  • Long actions are operations. A route that answers 202 returns an Operation; follow it with GET /v1/operations/{id}?wait=30. Send an Idempotency-Key header to retry a create safely.
  • Changes stay additive within /v1: fields and routes are added, never taken away.
curl -H "Authorization: Bearer $TOKEN" https://satama.dev/v1/me

Fields marked * are required. Every SSH command and its route are side by side in Commands.

You and operations

GET/v1/me

Who this token acts as, and the org's health checks that are failing or aren't being run

Returns: Me

GET/v1/me/ssh-keys

The SSH keys of the person this token acts for (add and remove them over SSH)

Returns: [SSHKeyView]

DELETE/v1/me/ssh-keys/{key}

Remove one of your SSH keys: refused for API tokens and apps, so this answers 403; remove keys over SSH (ssh-key rm)

Returns: SSHKeyView

GET/v1/operations/{id}

An operation; ?wait=N waits up to N seconds (at most 30) for it to finish

Query: wait

Returns: Operation

POST/v1/operations/{id}/secret

Take an operation's one-time secret (shown once, to whoever started it)

Returns: Secret

Your org: people, tokens and apps

GET/v1/orgs/{org}/audit

The audit log: who did what, when, and what happened (query: server, machine, who, since, limit). Owners and admins see everything; a member their own entries, and what was done in the projects they reach, without others' commands, addresses, tokens and apps

Query: server, project, machine, who, since, limit

Returns: [AuditView]

GET/v1/orgs/{org}/invites

The invites that are waiting (never their codes)

Returns: [InviteView]

DELETE/v1/orgs/{org}/invites/{invite}

Withdraw an invite by its id: its code stops working (owners and admins)

Returns: InviteView

GET/v1/orgs/{org}/mcp

The apps that can act in the org over MCP (a person approves one over SSH: mcp approve <code>)

Returns: [AppView]

DELETE/v1/orgs/{org}/mcp/{app}

End an app's access at once, by its number (admins any app; members the ones they approved)

Returns: AppView

GET/v1/orgs/{org}/members

Who is in the org, with their roles and the projects they're held to, and the invites that are waiting (for a member held to projects, who can get into those). Inviting, changing roles and projects and removing people are done over SSH (member add, member projects, member role, member rm, org leave): a token can't change who is in an org

Returns: MembersView

GET/v1/orgs/{org}/operations

The org's latest operations, newest first (?limit=N, at most 200; a member sees their own)

Query: limit

Returns: [Operation]

GET/v1/orgs/{org}/tokens

List API tokens (create them over SSH); for a member held to projects, their own

Returns: [TokenView]

DELETE/v1/orgs/{org}/tokens/{name}

Revoke an API token

Returns: Revoked

Servers

GET/v1/orgs/{org}/servers

List servers (for a member held to projects, those their projects are on, by name and status)

Returns: [ServerView]

POST/v1/orgs/{org}/servers

Add a server of a size, on a node satama runs (an operation); the org's allowance says how many, of which sizes

Body (AddServerRequest): location string, name* string, size* string

Headers: Idempotency-Key

Returns: 202, Operation

DELETE/v1/orgs/{org}/servers/{server}

Delete a server with every site and save on it, for good (an operation)

Returns: 202, Operation

GET/v1/orgs/{org}/servers/{server}/backups

What is off-site for a server's machines: the newest backed-up save, how many backups and their size

Returns: [MachineBackups]

POST/v1/orgs/{org}/servers/{server}/resize

Give a server another size (an operation)

Body (ResizeServerRequest): size* string

Headers: Idempotency-Key

Returns: 202, Operation

GET/v1/orgs/{org}/servers/{server}/stats

What a server (or ?machine=<name>, with ?project=<name>) used over time: ?since=2h, 24h (the default), 7d, up to 30d

Query: machine, project, since

Returns: Stats

GET/v1/orgs/{org}/servers/{server}/templates

The templates for new machines, and their state on this server

Returns: [TemplateView]

GET/v1/orgs/{org}/servers/{server}/usage

What a server and its machines are using right now (?project=<name> for one project)

Query: project

Returns: Usage

Projects

GET/v1/orgs/{org}/servers/{server}/projects

A server's client projects, their machines, and how many it may have (for a member held to projects, theirs alone)

Returns: ProjectList

POST/v1/orgs/{org}/servers/{server}/projects

Make an empty project on a server (owners and admins); otherwise the first machine in a project makes it

Body (AddProjectRequest): name* string

Headers: Idempotency-Key

Returns: ProjectView

DELETE/v1/orgs/{org}/servers/{server}/projects/{project}

Remove an empty project from a server, with its network (off its last server, the people held to it lose it)

Returns: ProjectView

Machines

GET/v1/orgs/{org}/servers/{server}/machines

List a server's machines (?project=<name> for one project)

Query: project

Returns: [Machine]

POST/v1/orgs/{org}/servers/{server}/machines

Create a machine (an operation)

Body (CreateMachineRequest): autosave boolean, branch string, build string, build_memory string, cpu string, dir string, disk string, memory string, name* string, os string, port integer, processes string, project string, public boolean, repo string, site boolean, template string

Headers: Idempotency-Key

Returns: 202, Operation

GET/v1/orgs/{org}/servers/{server}/machines/{machine}

Get a machine

Query: project

Returns: Machine

DELETE/v1/orgs/{org}/servers/{server}/machines/{machine}

Delete a machine, its site and all its saves, for good (an operation)

Query: project

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/copy

Copy a machine as it is now, while it keeps running (an operation); a WordPress site moves to its new address

Query: project

Body (CopyRequest): name* string, project string

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/exec

Run a command in a machine as root, through its shell, and return its output (at most 50 seconds and 1 MiB per stream)

Query: project

Body (ExecRequest): command* string

Returns: CommandResult

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/limits

Give a machine its own memory, CPU, disk or process limit within its server's, change one, or take it away ("none"); unset fields stay as they are (owners and admins)

Query: project

Body (LimitsRequest): cpu string, disk string, memory string, processes string

Headers: Idempotency-Key

Returns: Machine

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/logs

What an app (made with repo) printed: its last lines, oldest first, and a cursor where they end; with after=<that cursor>, only the lines that came since (query: limit, 1 to 1000, default 100; after)

Query: project, limit, after

Returns: AppLogs

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/rename

Rename a machine (an operation; a running machine restarts, and its web address stays)

Query: project

Body (RenameRequest): keep_hostname boolean, name* string

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/restart

Restart a machine, by force after 30 seconds (an operation; a stopped machine is started)

Query: project

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/start

Start a machine (an operation; a running machine stays as it is)

Query: project

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/stop

Stop a machine, by force after 30 seconds (an operation; a stopped machine stays as it is)

Query: project

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/update

Build an app's new version from the newest commit of its branch and put it in the app's place (an operation; rebuild: true builds the same commit again)

Query: project

Body (UpdateRequest): build_memory string, rebuild boolean

Headers: Idempotency-Key

Returns: 202, Operation

Saves, changes and restores

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/autosave

Turn a machine's automatic saves on or off. Off stops its hourly saves and, because they're made from those, its off-site backups; saves made by hand keep working, and the saves and backups it has stay and run out as they would have (owners and admins)

Query: project

Body (AutosaveRequest): on* boolean

Headers: Idempotency-Key

Returns: Machine

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/changes

What changed in a machine's files since a save (query: since, until, all=1); the machine must be running

Query: project, since, until, all

Returns: Changes

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/changes/file

One file line by line, since a save (query: path, since, until); the machine must be running

Query: project, path, since, until

Returns: FileDiff

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/restore

Restore a machine to a save (an operation)

Query: project

Body (RestoreRequest): no_check boolean, save* string

Headers: Idempotency-Key

Returns: 202, Operation

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/saves

A machine's history (saves, including from before restores)

Query: project

Returns: [Save]

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/saves

Save a machine now

Query: project

Body (SaveRequest): name string, replace_oldest boolean

Headers: Idempotency-Key

Returns: Save

DELETE/v1/orgs/{org}/servers/{server}/machines/{machine}/saves/{save}

Delete a save, for good (the newest of that name in the machine's history)

Query: project

Returns: Save

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/undo

Undo a machine's latest restore or update (an operation; undoing again redoes it)

Query: project

Headers: Idempotency-Key

Returns: 202, Operation

Sites and sharing

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/access

Who gets a machine's site: private (only browsers let in with a share link) or public, and its links without their secrets

Query: project

Returns: SiteAccess

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/access

Make a machine's site public ({"public": true}) or private ({"public": false}); a new site and every copy start private

Query: project

Body (AccessRequest): public* boolean

Headers: Idempotency-Key

Returns: SiteAccess

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/access/links

A share link into a machine's private site, for you or anyone you give it to, no account needed: reusable until it expires or is removed, and the browsers that used it get in until then. The link is a secret, returned once; tools can send its key (its last path segment) in a Satama-Key header

Query: project

Body (ShareLinkRequest): days integer, note string

Returns: SiteLink

DELETE/v1/orgs/{org}/servers/{server}/machines/{machine}/access/links/{link}

Remove one of a site's links by its id: it stops working, and so does every browser that got in with it

Query: project

Returns: Removed

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/requests

A site's latest requests, newest first (query: since=1h, after=<RFC 3339 time>, status=5xx or 404, limit); visitors' addresses stay on the server

Query: project, since, after, status, limit

Returns: [RequestEntry]

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/site

Give a machine a web address ({"on": true}) or take it away ({"on": false}); a WordPress site keeps its address (an operation)

Query: project

Body (SiteRequest): on* boolean, port integer

Headers: Idempotency-Key

Returns: 202, Operation

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/site/port

Say which port of the machine its site's requests go to ({"port": 3000}): 80 unless set, for a web server; an app listening elsewhere needs its port named. Nothing in the machine is changed

Query: project

Body (PortRequest): port* integer

Headers: Idempotency-Key

Returns: SiteAccess

Health checks

GET/v1/orgs/{org}/servers/{server}/machines/{machine}/check

A machine's health check and its last run, without running it (404 when it has none)

Query: project

Returns: MachineCheck

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/check

Give a machine a health check, or replace its check. One of: an HTTP request made from outside it, on its network, passing when it answers 200 to 399 ({"http": "/health"}, on its site's port or 80 unless "port" is given); a connection to a port ({"port": 6379}); or a command run in it as root with sh -c, passing when it exits 0, like Docker's HEALTHCHECK ({"command": "mysqladmin ping"}). With interval_seconds 30, timeout_seconds 10, retries 3 and start_period_seconds 0 unless given (a timeout with http or port is at most 10). It's run once first and kept only if it passes. Programs in the machine can see the command while it runs, so a password belongs in a file it reads

Query: project

Body (CheckRequest): command string, http string, interval_seconds integer, port integer, retries integer, start_period_seconds integer, timeout_seconds integer

Headers: Idempotency-Key

Returns: MachineCheck

DELETE/v1/orgs/{org}/servers/{server}/machines/{machine}/check

Take a machine's health check away

Query: project

Returns: Removed

POST/v1/orgs/{org}/servers/{server}/machines/{machine}/check/run

Run a machine's health check now; the answer says whether it passed and, if not, why

Query: project

Headers: Idempotency-Key

Returns: MachineCheck