Skip to main content
Everything envctl and the console do goes through one HTTPS API. You can call it directly from scripts and your own tools.

Authentication

Send a CLI token, or an organization API key, as a bearer token:
  • CLI tokens belong to a person and act as them. Create one in the console under Settings → CLI tokens, or with POST /v1/tokens.
  • API keys belong to the organization. Admins create them with POST /v1/keys.
A token is shown once; the API keeps only its hash. Repeated failed attempts from one address are refused with 429 for a minute.

Requests and responses

Bodies are JSON. Lists come back wrapped in an object, such as {"environments": [...]}, so fields can be added without breaking you. Times are RFC 3339 in UTC, and durations are strings like 30m or 6h.

Errors

Errors carry a message, and often a machine-readable code:

The flow envctl follows

  1. POST /v1/sandboxes registers your machine and returns a single-use tailnet key.
  2. POST /v1/environments leases an environment and returns it, with your sandbox’s new configuration.
  3. GET /v1/environments/{id} until state is ready.
  4. DELETE /v1/environments/{id} when you’re done.