Skip to content

FlyWP API

If you manage multiple servers or sites, or you want to automate repetitive tasks without clicking through the dashboard, the FlyWP API (Application Programming Interface, a way for software to communicate with FlyWP) is your solution. Use it to create servers and sites, deploy, take backups, and more, all from scripts, deployment pipelines, or your own tools.

The FlyWP API is a RESTful JSON API (a standard web-based interface that uses plain HTTP requests and returns data as JSON, a widely supported text format). It covers servers, sites, domains, certificates, backups, deployments, and bulk actions. A few areas of the dashboard, such as cron jobs, databases, firewall rules, daemons, and DNS, are not in the API yet.

All API requests go to:

https://api.flywp.com/v1

Every API request must include a Bearer token (a secret credential that proves your identity) in the Authorization header. You create tokens in your team settings. See Generating API Tokens below.

Authorization: Bearer your-api-token-here

Treat tokens like passwords. Store them in environment variables or a secrets manager, and never commit them to version control.

Every request must also include an X-Team-Id header with the ID of the team it should act on. There is no default team. A request without this header fails with a 422 error.

X-Team-Id: your-team-id

FlyWP expects and returns JSON. Include these headers with every request:

  • Content-Type: application/json
  • Accept: application/json
  • All request bodies should be JSON-encoded

A token carries a list of permissions chosen when it was created, and every endpoint asks for one of them. Calling an endpoint the token has no permission for returns 403.

PermissionWhat it allows
server:listList and view servers
server:createCreate servers
server:updateUpdate servers, install the monitoring agent, change alert thresholds
server:deleteDelete servers
server:scaleView scale options and scale a server
server:statusRead server metrics and alert thresholds
server:keys:listList a server's SSH keys
server:keys:createAdd SSH keys
server:keys:deleteDelete SSH keys you added
server:keys:delete-othersDelete SSH keys other people added
site:listList and view sites, and read static site details
site:createCreate sites
site:deleteDelete sites
site:updateEverything else under a site: domains, backups, certificates, deployments, nginx, OpenLiteSpeed, wp-config, and cloning. This includes reads.
team:manageTeam alert thresholds, and including team or creator details in responses

The token page also offers permissions for cron, daemons, firewall rules, supervisor, and DNS. Ticking them has no effect on the API yet.

All paths below are relative to https://api.flywp.com/v1.

ResourceEndpointsDescription
ServersGET /servers, POST /servers, GET /servers/{id}, PUT /servers/{id}, DELETE /servers/{id}List, create, inspect, update, and delete servers
Server metrics and alertsGET /servers/{id}/metrics, POST /servers/{id}/monitoring-agent, GET /servers/{id}/alert-thresholds, PUT /servers/{id}/alert-thresholds, DELETE /servers/{id}/alert-thresholdsRead metrics, install the monitoring agent, and manage alert thresholds
ScalingGET /servers/{id}/scale-options, POST /servers/{id}/scales, GET /servers/{id}/scales/{scale}Resize a server
SSH KeysGET /servers/{id}/ssh-keys, POST /servers/{id}/ssh-keys, DELETE /servers/{id}/ssh-keys/{key}Manage SSH keys (secure login credentials) on a server
Team alertsGET /team/alert-thresholds, PUT /team/alert-thresholdsTeam-wide alert thresholds
SitesGET /sites, POST /sites, GET /sites/{id}, DELETE /sites/{id}List, create, inspect, and delete sites. Sites are top level, not nested under a server.
Site actionsPOST /sites/{id}/clone, POST /sites/{id}/sleep, POST /sites/{id}/wake, POST /sites/{id}/maintenance-modeClone a site, put it to sleep or wake it, and toggle maintenance mode
DomainsGET/POST /sites/{id}/domains, PUT/DELETE /sites/{id}/domains/{domain}Manage a site's domains
CertificatesGET/POST /sites/{id}/certificates, DELETE /sites/{id}/certificates/{certificate}, POST /sites/{id}/certificates/{certificate}/activateManage SSL certificates
BackupsGET /sites/{id}/backups, POST /sites/{id}/backups, DELETE /sites/{id}/backups/{backup}, POST /sites/{id}/backups/{backup}/restoreList, create, delete, and restore site backups
DeploymentsGET /sites/{id}/deployments, POST /sites/{id}/deployments, GET /sites/{id}/deployments/{deployment}Trigger and review Git deployments
Deploy key and environmentGET /sites/{id}/deploy-key, GET/PUT /sites/{id}/environmentRead the deploy key and manage environment variables
ConfigurationGET/PUT /sites/{id}/nginx-config, GET/PUT /sites/{id}/ols-config, GET/PUT /sites/{id}/wp-configRead and update web server and wp-config settings
Static sitesGET/POST/DELETE /sites/{id}/static-site, GET/POST /sites/{id}/static-site/deploymentsManage a site's static copy
Bulk actionsPOST /bulk-actions/preview, POST /bulk-actions, GET /bulk-actions/{id}, POST /bulk-actions/{id}/cancel, POST /bulk-actions/{id}/retryRun one action across many sites
UtilityGET /ping, GET /verify-api-keyCheck connectivity and confirm your token works

Anything that has to reach a server, such as creating a site, adding an SSH key, or restoring a backup, returns 202 Accepted right away with the record as it stands. The work itself runs in the background. Fetch the resource again to see when it finishes.

To keep the service stable for everyone, FlyWP limits how many API requests each token can send:

  • 60 requests per minute per token
  • Every response includes X-RateLimit-Limit and X-RateLimit-Remaining headers so your code can track usage
  • Going over the limit returns 429 Too Many Requests with a Retry-After header that says how long to wait

Creating a server or a site is capped by your plan. If your team has reached its limit, the create request fails. See Billing.

The API doesn't support CORS (cross-origin requests from a web page). Call it from a server or script, never from browser code. A bearer token shouldn't be visible in a web page.

Every error comes back as JSON with a message. A validation error also includes an errors object keyed by field.

Status CodeMeaning
200Success
201Resource created
202Accepted. The work was queued and runs in the background
401Unauthorized: invalid or missing token
403Forbidden: the token lacks the required permission
404Not found (including a team the token can't access)
422Validation error, or a missing X-Team-Id header
429Rate limit exceeded
500Server error: contact support if this persists

Before you can make API calls, you need a token:

  1. Open Team Settings > API Tokens.
  2. Click Create New Token. API Tokens in the Team Settings sidebar, and the Create New Token button
  3. Enter a name, choose the permissions, and optionally set an expiry date.
  4. Copy the token immediately. FlyWP only shows it once.

Creating a token requires two-factor authentication on your account. For details, see API Tokens.

Still stuck? How can we help?

View as Markdown