# Fly.io

> Manage Fly.io: apps, machines, volumes, secrets, plus public IPs and custom domains.

Manage Fly.io end to end: apps, machines, volumes, secrets via the Machines API, plus public IP allocation and custom domains (TLS certificates) via the GraphQL API - everything needed to fully host a publicly reachable project. Exposes **34 actions** covering the API surface an agent needs - read and write.

## What it can do

| Method | What it does |
| --- | --- |
| `flyio_apps_list` | List all apps - GET /apps. |
| `flyio_app_get` | Get one app by ID - GET /apps/&#123;app_id&#125;. |
| `flyio_app_create` | Create a new app - POST /apps. |
| `flyio_app_delete` | Delete an app - DELETE /apps/&#123;app_id&#125;. |
| `flyio_machines_list` | List machines in an app - GET /apps/&#123;app_id&#125;/machines. |
| `flyio_machine_get` | Get one machine - GET /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;. |
| `flyio_machine_create` | Create a new machine - POST /apps/&#123;app_id&#125;/machines. |
| `flyio_machine_update` | Update a machine configuration - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;. |
| `flyio_machine_start` | Start a stopped machine - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/start. |
| `flyio_machine_stop` | Stop a running machine - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/stop. |
| `flyio_machine_restart` | Restart a machine - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/restart. |
| `flyio_machine_wait` | Wait for a machine to reach a state - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/wait. |
| `flyio_machine_exec` | Execute a command on a machine - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/exec. |
| `flyio_machine_delete` | Delete a machine - DELETE /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;. |
| `flyio_volumes_list` | List volumes in an app - GET /apps/&#123;app_id&#125;/volumes. |
| `flyio_volume_get` | Get one volume - GET /apps/&#123;app_id&#125;/volumes/&#123;volume_id&#125;. |
| `flyio_volume_create` | Create a new volume - POST /apps/&#123;app_id&#125;/volumes. |
| `flyio_volume_extend` | Extend (resize) a volume - POST /apps/&#123;app_id&#125;/volumes/&#123;volume_id&#125;/extend. |
| `flyio_volume_delete` | Delete a volume - DELETE /apps/&#123;app_id&#125;/volumes/&#123;volume_id&#125;. |
| `flyio_secrets_list` | List secrets in an app - GET /apps/&#123;app_id&#125;/secrets. |
| `flyio_secret_set` | Set or update a secret - POST /apps/&#123;app_id&#125;/secrets. |
| `flyio_secret_delete` | Delete a secret - DELETE /apps/&#123;app_id&#125;/secrets/&#123;key&#125;. |
| `flyio_leases_list` | List leases in an app - GET /apps/&#123;app_id&#125;/leases. |
| `flyio_lease_get` | Get one lease - GET /apps/&#123;app_id&#125;/leases/&#123;lease_id&#125;. |
| `flyio_lease_acquire` | Acquire a lease on a machine - POST /apps/&#123;app_id&#125;/machines/&#123;machine_id&#125;/lease. |
| `flyio_lease_release` | Release a lease - DELETE /apps/&#123;app_id&#125;/leases/&#123;lease_id&#125;. |
| `flyio_ips_list` | List an app's allocated IP addresses (GraphQL). |
| `flyio_ip_allocate` | Allocate a public IP for an app (GraphQL) - `shared_v4` (free), `v4`, `v6`, `private_v6`. |
| `flyio_ip_release` | Release an app's IP address (GraphQL). |
| `flyio_certs_list` | List an app's TLS certificates / custom domains (GraphQL). |
| `flyio_cert_get` | Get one certificate, including the DNS records to add (GraphQL). |
| `flyio_cert_add` | Attach a custom domain (add a certificate) and return DNS validation instructions (GraphQL). |
| `flyio_cert_delete` | Remove a custom domain / certificate (GraphQL). |
| `flyio_graphql` | Generic Fly.io GraphQL passthrough for anything else. |

## Public hosting: IPs and custom domains

To make an app reachable on the public internet, allocate an IP address with
`flyio_ip_allocate`. `shared_v4` is free and works for most apps; for a fully
dedicated public endpoint allocate a dedicated `v4` (paid) plus a free `v6`.

To serve a **custom domain**, call `flyio_cert_add` with your hostname (e.g.
`www.example.com`). It returns DNS validation instructions
(`dnsValidationHostname` / `dnsValidationTarget`); add those records at your DNS
provider, then poll `flyio_cert_get` until `clientStatus` is `Ready`.

These networking actions use the Fly.io GraphQL API
(`https://api.fly.io/graphql`) with the same `FLY_API_TOKEN`.

## How to get credentials

This connector uses an **API key / token**. Create one in the provider
dashboard, then paste it into FlyMyAI:

- **`FLY_API_TOKEN`** - Run `fly auth token`, or Fly.io - Account - Access Tokens. (https://fly.io/user/personal_access_tokens)

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `FLY_API_TOKEN` | Run `fly auth token`, or Fly.io - Account - Access Tokens. |

## Troubleshooting

- **`401 Unauthorized` / `403 Forbidden`** - the token is wrong, expired, or missing a required scope; regenerate it.
- **`429 Too Many Requests`** - provider rate limit; retry after a short backoff.
- **Unexpected `4xx` on writes** - double-check required fields; the agent confirms before write actions.

## Links

- [Fly.io API documentation](https://fly.io/docs/machines/api/)
