Skip to main content
POST
Create Machine

Authorizations

Authorization
string
header
required

A Fly API token with access to the requested organization or resource. Send it as Authorization: Bearer <Fly API token>.

Path Parameters

app_name
string
required

Fly App Name

Body

application/json

Create machine request

config
object

An object defining the Machine configuration

lease_ttl
integer

Acquire a lease on the new Machine that lasts this many seconds. The response's nonce field holds the lease nonce.

min_secrets_version
integer

The minimum version of the app's secrets the Machine must run with. Set it to the version returned by the endpoints that set or delete app secrets, so that the Machine is guaranteed to see those changes. This field belongs at the top level of the request body, not in config. If omitted, the app's current secrets version is looked up for you.

name
string

Name for this Machine. If omitted, one is generated for you. Names are not required to be unique.

region
string

The region to create the Machine in, such as iad. Also accepts a comma-separated list of regions and region groups (any, us, na, sa, eu, apac, africa, asia_pacific, europe, north_america, south_america), in which case Fly.io picks one with capacity. If the Machine mounts a volume, defaults to the volume's region; the region must include it. Otherwise defaults to the region of the API server handling the request, which is usually the one closest to you.

skip_launch
boolean

Create the Machine without starting it. It ends up stopped; start it with the Start Machine endpoint. Not allowed for spot Machines.

skip_secrets
boolean

Don't look up the app's current secrets version. The Machine still gets the app's secrets, but may not see recent changes to them. Takes precedence over min_secrets_version.

skip_service_registration
boolean

Create the Machine cordoned, so Fly Proxy doesn't route requests to it until it is uncordoned. Its services are still registered.

Response

200 - application/json

OK

checks
object[]

Status of each health check: the Machine's top-level checks and its services' checks.

config
object

The Machine's configuration, as provided when it was created or last updated, with metadata and mounts reflecting their current values. Null when the host is not reachable (host_status is not ok) or summary=true was requested; see incomplete_config.

cordoned
boolean

Whether the Machine is cordoned, meaning Fly Proxy does not route requests to it. See the Cordon Machine endpoint.

created_at
string

When the Machine was created.

events
object[]

Up to 5 of the most recent events of the current Machine version, newest first. Use the List Events endpoint for more.

host_features
string[]

Features of the Machine's host, for comparison with config.guest.required_host_features. Only returned when the request sets the fly-include-host-features: true header.

host_status
enum<string>

Whether Fly.io could reach the Machine's host: ok if it could, unreachable if it could not, in which case the response is built from last known state. unknown if the host's status was not reported.

Available options:
ok,
unknown,
unreachable
id
string

Unique ID of the Machine.

image_ref
object

The image the Machine runs, as resolved when it was last created or updated.

incomplete_config
object

Last known configuration, returned in place of config when the host could not be reached (host_status is not ok) or when listing Machines with summary=true. It comes from Fly.io's replicated state rather than the host, so it may be stale or lack fields.

instance_id
string

Same value as version.

Deprecated: use version.

lease
object

The lease currently held on the Machine. Only returned when include_leases=true was requested and a lease is held.

name
string

Name of the Machine. Generated when not provided at creation. Names are not required to be unique.

nonce
string

Nonce of the lease acquired on the Machine at creation. Only returned when creating a Machine with lease_ttl set. Pass it in the fly-machine-lease-nonce header to act on the Machine while the lease is held.

private_ip
string

The Machine's address on the organization's private (6PN) IPv6 network.

region
string

Code of the region the Machine runs in, such as iad.

state
string

Current state of the Machine, taken from the status of its most recent event. One of created, starting, started, stopping, stopped, suspending, suspended, replacing, replaced, destroying, destroyed, failed, migrating, migrated, archived, or pending. See https://fly.io/docs/machines/machine-states/.

updated_at
string

Time of the Machine's most recent event, truncated to whole seconds. The zero time (0001-01-01T00:00:00Z) if the host could not be reached. With summary=true, the time Fly.io last recorded a change to the Machine.

version
string

Unique ID of this version of the Machine. Every update creates a new version. Pass it as current_version when updating the Machine to reject the update if the Machine has changed since this version.