| title | Apps |
|---|---|
| description | Machines API Apps resource: create, get, list by org_slug, and delete Fly Apps, plus allocating IPs, setting secrets, and isolated app networks. |
You can use the Apps resource to create and manage Fly Apps. A Fly App is an abstraction for a group of Machines running your code, along with the configuration, provisioned resources, and data we need to keep track of to run and route to your Machines. Learn more about Fly Apps.
POST /apps
Machines must be associated with a Fly App. App names must be unique.
Name of the app to create Request a wildcard TLS certificate for `*.svc..fly.dev`. Defaults to false. Certificate provisioning is asynchronous; this does not create services or configure their routing. Slug of the org in which to create the app Name for an IPv6 private network to segment the app onto.curl -i -X POST \\
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \\
"${FLY_API_HOSTNAME}/v1/apps" \\
-d '{
"app_name": "my-app-name",
"org_slug": "personal",
"network": "my-optional-network"
}'{
"id":"z4k69dxd8r31p5mx",
"created_at":1708631799000
}To segment the app into its own network, you can pass a network argument in the JSON body, for example: "network": "some-arbitrary-name". Any Machine started in such an app will not be able to access other apps within their organization over the private network. However, Machines within such an app can communicate to each other, and the fly-replay header can still be used to route requests to Machines within a segmented app.
If you intend for Machines to be accessible to the internet, you’ll need to allocate an IP address to the app. Currently this is done using flyctl or the Fly.io GraphQL API. This offers your app automatic, global routing via Anycast. Read more about this in the Networking section.
Example:
```sh cmd fly ips allocate-v4 -a my-app-name ``` ```output output TYPE ADDRESS REGION CREATED AT v4 37.16.9.52 global 7s ago ```The app will answer on this IP address, and after a small delay, at my-app-name.fly.dev.
GET /apps/{app_name}
Get details about an app, like its organization slug and name. Also, to check if the app exists!
The name of the Fly App to get the details of.curl -i -X GET \\
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \\
"${FLY_API_HOSTNAME}/v1/apps/my-app-name"{
"id": "jlyv9r5d56v18xrg",
"name": "my-app-name",
"status": "pending",
"organization": {
"name": "My Org",
"slug": "personal"
}
}For sensitive environment variables, such as credentials, you can set secrets on the app:
fly secrets set DATABASE_URL=postgres://example.com/mydb <my-app-name>Machines inherit secrets from the app. Existing Machines must be updated to pick up secrets set after the Machine was created.
For non-sensitive information, you can configure environment variables per Machine when you create or update the Machine.
DELETE /apps/{app_name}
Machines should be stopped before attempting deletion. Append ?force=true to the URI to stop and delete immediately.
curl -i -X DELETE \\
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \\
"${FLY_API_HOSTNAME}/v1/apps/my-app-name"no bodyGET /apps?org_slug=
curl -i -X GET \\
-H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" \\
"${FLY_API_HOSTNAME}/v1/apps?org_slug=personal"{
"total_apps": 4,
"apps": [
{
"id": "682kqp6pdno9d543",
"name": "my-app-1",
"machine_count": 3,
"volume_count": 2,
"network": "default"
},
...
]
}- Working with the Machines API
- Machines resource reference
- Tokens resource reference
- Volumes resource reference