---
seo:
  description: >-
    The HTTP API of a Luna deployment for developers: accounts, organisations,
    projects, environments, tenants, deploys, secrets, keys, data, telemetry,
    usage and…
sidebar:
  label: Overview
title: Luna API
---
The HTTP API of a Luna deployment for developers: accounts, organisations, projects, environments, tenants, deploys, secrets, keys, data, telemetry, usage and billing. The `luna` CLI and the Console call this same API.

## Authentication

Send a credential in the `Authorization` header as `Bearer <TOKEN>`. Three kinds work:

- An account key (`la_…`) acts as your account, with the roles you hold when it is used.
- An API key (`lt_…`) holds the permissions it was made with, in one project or across one organisation.
- A session token (`ls_…`) is what logging in returns.

Each operation lists the permission it needs. A role is a fixed set of the same permissions. `GET /_luna/permissions` returns the full list.

## Errors

A failed request answers with a 4xx or 5xx status and a JSON body of the form `{"error": {"message": "…"}}`.

Version 0.0.28

Base URL: `https://{host}`

## Account

Sign up, log in and manage the keys that act as your account.

- [`GET /_luna/auth/options`](/reference/account/auth-options) — Get sign-in options.
- [`POST /_luna/auth/signup`](/reference/account/signup) — Sign up.
- [`POST /_luna/auth/login`](/reference/account/login) — Log in.
- [`POST /_luna/auth/logout`](/reference/account/logout) — Log out.
- [`GET /_luna/auth/me`](/reference/account/me) — Get the current account.
- [`PATCH /_luna/auth/me`](/reference/account/change-me) — Rename the current account.
- [`GET /_luna/auth/keys`](/reference/account/list-account-keys) — List account keys.
- [`POST /_luna/auth/keys`](/reference/account/create-account-key) — Create an account key.
- [`DELETE /_luna/auth/keys/{id}`](/reference/account/revoke-account-key) — Revoke an account key.
- [`POST /_luna/auth/device`](/reference/account/device-start) — Start a device login.
- [`POST /_luna/auth/device/token`](/reference/account/device-token) — Collect a device login.
- [`POST /_luna/auth/invites/accept`](/reference/account/accept-invite) — Accept an invitation by code.
- [`POST /_luna/auth/invites/{id}/accept`](/reference/account/accept-my-invite) — Accept an invitation.
- [`POST /_luna/auth/invites/{id}/decline`](/reference/account/decline-my-invite) — Decline an invitation.
- [`GET /_luna/auth/notifications`](/reference/account/list-notifications) — List notifications.
- [`POST /_luna/auth/notifications/read`](/reference/account/read-notifications) — Mark notifications as read.

## Organisations

Organisations own projects, members and billing.

- [`GET /_luna/orgs`](/reference/organisations/list-orgs) — List organisations.
- [`POST /_luna/orgs`](/reference/organisations/create-org) — Create an organisation.
- [`GET /_luna/orgs/{org}`](/reference/organisations/get-org) — Get an organisation.
- [`DELETE /_luna/orgs/{org}`](/reference/organisations/delete-org) — Delete an organisation.
- [`PATCH /_luna/orgs/{org}`](/reference/organisations/change-org) — Update an organisation.
- [`GET /_luna/orgs/{org}/audit`](/reference/organisations/read-audit) — Read the audit log.

## Members

The people in an organisation, their roles and their invitations.

- [`GET /_luna/orgs/{org}/members`](/reference/members/list-members) — List members.
- [`PUT /_luna/orgs/{org}/members/{account}`](/reference/members/set-member) — Change a member's role.
- [`DELETE /_luna/orgs/{org}/members/{account}`](/reference/members/remove-member) — Remove a member.
- [`GET /_luna/orgs/{org}/invites`](/reference/members/list-invites) — List invitations.
- [`POST /_luna/orgs/{org}/invites`](/reference/members/invite-member) — Invite a member.
- [`DELETE /_luna/orgs/{org}/invites/{id}`](/reference/members/revoke-invite) — Revoke an invitation.
- [`POST /_luna/orgs/{org}/invites/{id}/resend`](/reference/members/resend-invite) — Resend an invitation.

## Projects

A project is one app. It holds the app's environments.

- [`GET /_luna/orgs/{org}/projects`](/reference/projects/list-projects) — List projects.
- [`POST /_luna/orgs/{org}/projects`](/reference/projects/create-project) — Create a project.
- [`GET /_luna/orgs/{org}/projects/{project}`](/reference/projects/get-project) — Get a project.
- [`DELETE /_luna/orgs/{org}/projects/{project}`](/reference/projects/delete-project) — Delete a project.
- [`PATCH /_luna/orgs/{org}/projects/{project}`](/reference/projects/change-project) — Update a project.
- [`GET /_luna/resolve`](/reference/projects/resolve) — Resolve a project path.

## Environments

An environment is one running copy of a project, such as production or staging.

- [`GET /_luna/orgs/{org}/projects/{project}/environments`](/reference/environments/list-environments) — List environments.
- [`POST /_luna/orgs/{org}/projects/{project}/environments`](/reference/environments/create-environment) — Create an environment.
- [`GET /_luna/orgs/{org}/projects/{project}/environments/{env}`](/reference/environments/get-environment) — Get an environment.
- [`DELETE /_luna/orgs/{org}/projects/{project}/environments/{env}`](/reference/environments/delete-environment) — Delete an environment.
- [`POST /_luna/orgs/{org}/projects/{project}/environments/{env}/copy`](/reference/environments/retry-copy) — Retry a data copy.

## Tenants

Every environment has a default tenant. A platform adds one tenant per customer.

- [`GET /_luna/tenants`](/reference/tenants/list-tenants) — List tenants.
- [`POST /_luna/tenants`](/reference/tenants/create-tenant) — Create a tenant.
- [`GET /_luna/tenants/{tenant}`](/reference/tenants/describe-tenant) — Get a tenant.
- [`PUT /_luna/tenants/{tenant}`](/reference/tenants/configure-tenant) — Replace a tenant's settings.
- [`DELETE /_luna/tenants/{tenant}`](/reference/tenants/delete-tenant) — Delete a tenant.
- [`POST /_luna/tenants/{tenant}/deploy`](/reference/tenants/deploy-tenant) — Deploy source files to a tenant.
- [`POST /_luna/tenants/{tenant}/restore`](/reference/tenants/restore-tenant) — Restore lunas to an earlier moment.
- [`POST /_luna/tenants/{tenant}/fork`](/reference/tenants/fork-tenant) — Fork a luna.
- [`POST /_luna/tenants/{tenant}/fork-all`](/reference/tenants/fork-all) — Copy every luna to another tenant.
- [`GET /_luna/tenants/{tenant}/openapi.json`](/reference/tenants/tenant-openapi) — Get a tenant's OpenAPI document.

## Deploys

Put code into an environment.

- [`POST /_luna/deploy`](/reference/deploys/deploy) — Deploy an app.
- [`POST /_luna/preflight`](/reference/deploys/preflight) — Preview a deploy.

## Secrets

Values an environment's code reads at run time. A secret's value is never read back.

- [`GET /_luna/secrets/{tenant}`](/reference/secrets/list-secrets) — List secrets.
- [`PUT /_luna/secrets/{tenant}/{name}`](/reference/secrets/put-secret) — Set a secret.
- [`DELETE /_luna/secrets/{tenant}/{name}`](/reference/secrets/delete-secret) — Delete a secret.

## Domains

Your own domains for an environment's HTTP routes, with certificates Luna gets and renews.

- [`GET /_luna/domains/{tenant}`](/reference/domains/list-domains) — List domains.
- [`POST /_luna/domains/{tenant}`](/reference/domains/add-domain) — Add a domain.
- [`DELETE /_luna/domains/{tenant}/{name}`](/reference/domains/remove-domain) — Remove a domain.
- [`POST /_luna/domains/{tenant}/{name}/verify`](/reference/domains/verify-domain) — Verify a domain.
- [`PUT /_luna/domains/{tenant}/{name}/certificate`](/reference/domains/upload-certificate) — Upload a certificate.

## App keys

The keys an app's clients and servers call it with.

- [`GET /_luna/tenants/{tenant}/keys`](/reference/app-keys/list-keys) — List app keys.
- [`POST /_luna/tenants/{tenant}/keys`](/reference/app-keys/create-key) — Create an app key.
- [`DELETE /_luna/tenants/{tenant}/keys/{id}`](/reference/app-keys/revoke-key) — Revoke an app key.
- [`PATCH /_luna/tenants/{tenant}/keys/{id}`](/reference/app-keys/change-key) — Update an app key.
- [`POST /_luna/tenants/{tenant}/keys/{id}/rotate`](/reference/app-keys/rotate-key) — Rotate an app key.

## API keys

Scoped keys for scripts and CI that call this API.

- [`GET /_luna/tokens`](/reference/api-keys/list-tokens) — List API keys.
- [`POST /_luna/tokens`](/reference/api-keys/create-token) — Create an API key.
- [`DELETE /_luna/tokens/{id}`](/reference/api-keys/revoke-token) — Revoke an API key.
- [`POST /_luna/tokens/{id}/rotate`](/reference/api-keys/rotate-token) — Rotate an API key.

## Data

Browse and edit what an environment's lunas hold: tables, files and indexes.

- [`GET /_luna/tenants/{tenant}/lunas/{type}`](/reference/data/list-lunas) — List the lunas of a type.
- [`POST /_luna/tenants/{tenant}/lunas/{type}/release`](/reference/data/release-luna) — Let a quarantined luna run again.
- [`GET /_luna/tenants/{tenant}/data/{type}/{table}`](/reference/data/list-rows) — List the rows of a table.
- [`POST /_luna/tenants/{tenant}/data/{type}/{table}`](/reference/data/insert-row) — Add a row.
- [`DELETE /_luna/tenants/{tenant}/data/{type}/{table}/{rowid}`](/reference/data/delete-row) — Delete a row.
- [`PATCH /_luna/tenants/{tenant}/data/{type}/{table}/{rowid}`](/reference/data/update-row) — Change a value in a row.
- [`GET /_luna/tenants/{tenant}/files/{type}/{bucket}`](/reference/data/list-files) — List the files in a folder.
- [`DELETE /_luna/tenants/{tenant}/files/{type}/{bucket}`](/reference/data/delete-file) — Delete a file.
- [`POST /_luna/tenants/{tenant}/files/{type}/{bucket}/sign`](/reference/data/sign-file) — Sign a URL for a file.
- [`GET /_luna/tenants/{tenant}/indexes/{index}`](/reference/data/read-index) — Read an index.
- [`GET /_luna/tenants/{tenant}/sandboxes`](/reference/data/list-sandboxes) — List the sandboxes.
- [`DELETE /_luna/tenants/{tenant}/sandboxes/{type}/{name}`](/reference/data/delete-sandbox) — Delete a sandbox.
- [`POST /_luna/tenants/{tenant}/sandboxes/{type}/{name}/stop`](/reference/data/stop-sandbox) — Stop a sandbox.

## Telemetry

Logs, traces and metrics of an environment.

- [`GET /_luna/telemetry/{tenant}/logs`](/reference/telemetry/query-logs) — Query logs.
- [`GET /_luna/telemetry/{tenant}/logs/tail`](/reference/telemetry/tail-logs) — Tail logs.
- [`GET /_luna/telemetry/{tenant}/traces`](/reference/telemetry/query-traces) — Query traces.
- [`GET /_luna/telemetry/{tenant}/metrics`](/reference/telemetry/query-metrics) — Query metrics.

## Usage

What a tenant, a project or an organisation has used.

- [`GET /_luna/usage`](/reference/usage/get-usage) — Get usage and its cost.
- [`GET /_luna/tenants/{tenant}/usage`](/reference/usage/get-tenant-usage) — Get a tenant's usage.
- [`GET /_luna/orgs/{org}/usage`](/reference/usage/get-organisation-usage) — Get an organisation's usage.

## Billing

An organisation's plan, spending limits and payment details.

- [`GET /_luna/orgs/{org}/billing`](/reference/billing/get-billing) — Get the billing summary.
- [`PUT /_luna/orgs/{org}/billing/limits`](/reference/billing/set-billing-limits) — Set spending limits.
- [`GET /_luna/orgs/{org}/billing/in-use`](/reference/billing/get-billing-in-use) — Get what is in use now.
- [`GET /_luna/orgs/{org}/billing/usage`](/reference/billing/get-billing-month) — Get a month's bill.
- [`POST /_luna/orgs/{org}/billing/checkout`](/reference/billing/start-checkout) — Start a checkout.
- [`POST /_luna/orgs/{org}/billing/portal`](/reference/billing/open-billing-portal) — Open the billing portal.
- [`GET /_luna/orgs/{org}/billing/details`](/reference/billing/get-payment-details) — Get the payment details.
- [`GET /_luna/orgs/{org}/plans`](/reference/billing/list-plans) — List the plans.
- [`POST /_luna/orgs/{org}/billing/plan`](/reference/billing/choose-plan) — Choose a plan.

## General

The permission catalog and this document.

- [`GET /_luna/permissions`](/reference/general/list-permissions) — List permissions.
- [`GET /_luna/openapi.json`](/reference/general/openapi-json) — Get the OpenAPI document.
