Introduction
The Admin API lets you manage regular organization API keys, inspect organization billing data, and access container-related APIs with an admin API key. Admin API keys are for organizations, not personal accounts.Common use cases
- Automating key management: Create, rotate, or delete API keys programmatically, and set expiration dates or token limits based on your business logic.
- Building custom dashboards: Display usage metrics, cost breakdowns by model, and historical trends using the billing and time-series endpoints.
- Monitoring usage: Query aggregated or per-key usage statistics to track costs and token consumption.
- Managing containers programmatically: Create, validate, update, stop, start, and delete containers. Inspect and update deployments, and manage org secrets, SSH keys, custom domains, and registry credentials.
Authentication
Admin API keys provide programmatic access to your account resources. Admin keys are prefixed withadmin_ and must be included in the Authorization header as a Bearer token.
Need to create an admin API key? Follow our step-by-step guide: Getting a Tinfoil Admin Key
Available endpoints
This page covers the following endpoints:API key management
GET /api/keys- List API keysPOST /api/keys- Create a new API keyPOST /api/keys/update- Update an API key name or token capDELETE /api/keys/:key- Delete an API key
Billing & usage
GET /api/billing/usage- Get aggregated usage statistics for all keysPOST /api/billing/usage/key- Get usage statistics for a specific keyGET /api/billing/time-series- Get time series dataGET /api/billing/transactions- Get transaction history
Container endpoints
- Lifecycle & deployment
POST /api/containers/validate-name- Validate a container name or custom domain before deployPOST /api/containers/validate- Validatetinfoil-config.ymlbefore deployGET /api/containers/hosts- List hosts available to the organizationGET /api/containers- List containersGET /api/containers/:id- Get a specific containerPOST /api/containers- Create a containerPOST /api/containers/:id/relaunch- Relaunch a running or failed containerPOST /api/containers/:id/stop- Stop a running containerPOST /api/containers/:id/start- Start a stopped containerDELETE /api/containers/:id- Delete a containerGET /api/containers/:id/update- Get in-progress update statusPOST /api/containers/:id/update/accept- Promote a ready staged updatePOST /api/containers/:id/update/cancel- Cancel an in-progress updatePOST /api/containers/:id/github-connection- Toggle GitHub App connectionGET /api/containers/:id/metrics- Get resource metrics
- Deployments
GET /api/deployments- List deployments with instance countsPATCH /api/deployments/:id- Update deployment settingsPOST /api/deployments/:id/update- Update all or selected instances
- Related resources
GET /api/secrets- List org secretsPOST /api/secrets- Create a secretGET /api/secrets/:name- Get a secret’s metadataPUT /api/secrets/:name- Update a secretDELETE /api/secrets/:name- Delete a secretGET /api/ssh-keys- List org SSH keysPOST /api/ssh-keys- Create an SSH keyDELETE /api/ssh-keys/:name- Delete an SSH keyGET /api/domains- List custom domainsPOST /api/domains- Add a domainPOST /api/domains/:domain/verify- Verify a domainDELETE /api/domains/:domain- Delete a domainGET /api/registry-credentials- List private registry credential statusPUT /api/registry-credentials/:registry- Create or update private registry credentialsDELETE /api/registry-credentials/:registry- Delete private registry credentials
API Key Management
List API Keys
endpoint
Returns all regular (non-admin) API keys in your organization. Keys you created are returned in full. Keys created by other members are masked (for example,
tk_12345***).Example Request
Response
Create API Key
endpoint
Creates a new regular API key for your organization. Requires active token billing for the organization.
Request Body
string
required
Name for the API key. Must contain only alphanumeric characters, hyphens, underscores, spaces, and periods.
datetime
ISO 8601 timestamp when the key should expire. If not provided, the key doesn’t expire.
integer
Maximum number of tokens this key can use. If not provided, no limit is enforced.
object
Custom metadata to attach to the key. Maximum size: 5KB.
Example Request
Response
Update API Key
endpoint
Updates an existing regular API key in your organization. You can update any non-admin key in the organization, provided you have the full key value.
Request Body
string
required
The API key value to update, as returned by
GET /api/keys.string
New display name for the API key.
integer
New token cap for the key. Set this to
0 to clear the existing cap.Example Request
Response
Delete API Key
endpoint
Deletes a regular API key in your organization. You can delete any non-admin key, provided you have the full key value.
Path Parameters
string
required
The API key value to delete (for example,
tk_your_full_key_value_here).Example Request
Response
Billing & Usage
Get Usage Statistics
endpoint
Retrieves aggregated usage statistics for your organization for the specified time period.
Query Parameters
string
Time period for usage statistics. If omitted, returns all-time usage. Valid values:
5m- Last 5 minutes15m- Last 15 minutes30m- Last 30 minutes1h- Last hour24h- Last 24 hours7d- Last 7 days30d- Last 30 days60d- Last 60 days90d- Last 90 days
Example Request
Response
keys object is grouped by API key name.
Get Usage by Key
endpoint
Retrieves usage statistics for a specific regular API key in your organization.
Query Parameters
string
Time period for usage statistics. If omitted, returns all-time usage. Valid values:
5m- Last 5 minutes15m- Last 15 minutes30m- Last 30 minutes1h- Last hour24h- Last 24 hours7d- Last 7 days30d- Last 30 days60d- Last 60 days90d- Last 90 days
Request Body
string
required
The API key value to query (for example,
tk_your_full_key_value_here), as returned by GET /api/keys.Example Request
Response
Get Time Series Data
endpoint
Retrieves time-series usage data for your organization over the specified period.
Query Parameters
string
default:"24h"
Time period for the time series. Valid values:
5m- Last 5 minutes15m- Last 15 minutes30m- Last 30 minutes1h- Last hour24h- Last 24 hours7d- Last 7 days30d- Last 30 days60d- Last 60 days90d- Last 90 days
5m → 5s, 15m → 15s, 30m → 30s, 1h → 1m, 24h → 15m, 7d → 2h, 30d → 8h, and 60d/90d → 24h. Empty buckets are included as zero-value data points.
Example Request
Response
Get Transaction History
endpoint
Retrieves invoice and standalone charge history for your organization.
Example Request
Response
Containers
Admin API keys can access the same container APIs as a browser session, as long as the key belongs to the target organization.Create, start, and relaunch operations require an active container subscription. Read-only endpoints and cleanup operations such as list, get, stop, and delete do not require an active subscription.
Private registry endpoints require private registry access to be enabled for the organization.
Lifecycle & Deployment
Validate Container Name
endpoint
Checks whether a container name is valid and available for the current organization. You can also validate a custom domain before creating or relaunching a container.
Request Body
string
required
Container name. Must be lowercase alphanumeric with hyphens, max 64 characters.
boolean
Whether to validate the name for debug mode.
string
Custom domain to validate.
string
Existing container UUID when validating a relaunch that keeps the same custom domain.
Example Request
Response
Validate Container Config
endpoint
Validates the
tinfoil-config.yml in a repository tag before create, replace, or relaunch.Request Body
string
required
GitHub repository in
owner/repo format.string
required
Git tag to validate.
string
Existing container UUID. When present, instance-limit checks are skipped for relaunch validation.
string
Existing container UUID. When present, instance-limit checks are skipped for replace validation.
List Hosts
endpoint
Returns the container hosts available to the organization, including the default host and the GPU values available on each host.
Response
List Containers
endpoint
Returns all containers in your organization. Responses may also include
ssh_port, host_name, host_gpu_type, and host_cpu_type when available.Example Request
Response
Get Container
endpoint
Returns details for a specific container.
Path Parameters
string
required
The container UUID.
Example Request
Create Container
endpoint
Creates and deploys a new container. The repository must contain a
tinfoil-config.yml at the specified tag.Request Body
string
required
Container name. Must be lowercase alphanumeric with hyphens.
string
required
GitHub repository in
owner/repo format.string
required
Git tag to deploy. The tag must have a published GitHub release.
object
Environment variables as key-value pairs.
string[]
Names of existing org secrets to inject.
string[]
Names of existing org SSH keys to inject.
boolean
Enable debug mode.
integer
Number of GPUs to allocate. Requires GPU access for the organization.
string
Verified custom domain for the container.
string
Target host name. Requires target host selection to be enabled for the organization.
string
Existing container UUID to replace.
Example Request
Response
Returns the created container object with statusdeploying. The container transitions to ready once the deployment completes.
Relaunch Container
endpoint
Relaunches a running or failed container with a new tag, updated configuration, or both. Running single-GPU and CPU-only containers usually use a blue-green deployment flow. Multi-GPU updates use a different flow and cannot always be canceled once started.
Path Parameters
string
required
The container UUID.
Request Body
All fields are optional. Omitted fields keep their current values.string
New git tag to deploy.
object
New environment variables. This replaces the full existing variable set.
string[]
New secret-name list. This replaces the full existing secret set.
string[]
New SSH key-name list.
integer
New GPU count.
boolean
Toggle debug mode.
string
Set or clear a custom domain. Pass an empty string to revert to the auto-generated domain.
Example Request
Stop Container
endpoint
Stops a running container. The container record is preserved and can be started again later.
Start Container
endpoint
Starts a stopped container. You can optionally pass the same body fields as relaunch to update configuration at start time.
Delete Container
endpoint
Permanently deletes a container and its running enclave. The deployment remains while it has other instances. Outstanding billing is finalized before deletion.
204 No Content on success.
Get Update Status
endpoint
Returns the status of an in-progress relaunch or restart.
Response
Accept Update
endpoint
Promotes a ready staged update and returns the updated container.
Cancel Update
endpoint
Cancels an in-progress update and returns
204 No Content. Multi-GPU updates cannot be canceled once started.Toggle GitHub App Connection
endpoint
Sets whether the container is connected to a GitHub App installation for its repo owner.
Request Body
boolean
required
Whether GitHub App connectivity should be enabled.
Get Container Metrics
endpoint
Returns CPU, GPU, and memory utilization time series for a container. The
time query parameter defaults to 24h.Deployments
A deployment groups all container instances in an organization that use the same GitHub repository.List Deployments
endpoint
Returns deployments with aggregate instance counts and settings.
GET /api/deployments/:id endpoint. Resolve a deployment by ID or repository from the list response.
Update Deployment Settings
endpoint
Updates shared settings and returns the deployment.
boolean
Default staging mode for new instances and deployment-wide updates.
Update Deployment Instances
endpoint
Updates every eligible instance, or a selected set, to one repository tag.
string
required
Repository release tag to deploy.
boolean
Staging override for this request. Omit it to use the deployment default.
string[]
Container UUIDs to update. Omit it to update every instance.
updating, skipped, or failed. Instances are skipped when they are not running or failed, or already have an update in progress.
Related Resources
Secrets
Org secrets are encrypted values injected into containers at deploy time. Secret names must beUPPER_SNAKE_CASE or kebab-case.
endpoint
Returns all org-level secrets as metadata only. Secret values are never returned.
endpoint
Returns metadata for a single secret, including which containers use it.
endpoint
Creates a new org secret.
Request Body
string
required
Secret name.
string
required
Secret value.
endpoint
Updates the value of an existing org secret.
endpoint
Deletes an org secret. If the secret is currently used by any container, the API returns
409 Conflict and includes the blocking container names.SSH Keys
SSH key names must be kebab-case, for examplemy-deploy-key.
endpoint
Returns all org-level SSH keys.
endpoint
Adds a new org SSH key for debug-mode containers.
Request Body
string
required
SSH key name in kebab-case.
string
required
SSH public key, for example
ssh-ed25519 AAAA....endpoint
Deletes an org SSH key. If the key is currently used by any container, the API returns
409 Conflict and includes the blocking container names.Custom Domains
endpoint
Returns all custom domains for the organization, including verification details and which containers use each domain.
endpoint
Adds a custom domain for verification and returns the TXT and CNAME records required for setup.
Request Body
string
required
Domain name to register, for example
api.example.com.endpoint
Checks DNS records and updates the domain’s verification state.
endpoint
Deletes a custom domain. If the domain is currently used by any container, the API returns
409 Conflict and includes the blocking container names.Registry Credentials
Private registry credentials are supported forghcr, gcr, and dockerhub.
endpoint
Returns credential status for each supported registry, including whether credentials exist, whether they are expired, and when they were last updated.
endpoint
Creates or updates credentials for a supported registry.
Path Parameters
string
required
Registry identifier:
ghcr, gcr, or dockerhub.Request Body
Forghcr:
gcr:
dockerhub:
endpoint
Deletes credentials for a supported registry.

