Skip to content

Security checklist

Keep tokens safe: scopes, expiry, allowed addresses, and what to do after a leak.

3 min read Updated

A token can do what its scopes allow, from wherever it's used, until it expires. These habits keep a token that leaks from doing much, and help you notice when one does.

One token for each app

Give each app, script and CI job its own token, named after it. Then you can see what each one does, limit each to what it needs, and revoke one without stopping the others.

Only the access it needs

  • The smallest set of scopes its calls need (see Scopes). Scopes that spend money or delete for good only where they're needed.
  • Only its servers, when it works on some: everything on other servers stays out of its reach.
  • Only its addresses, when it runs from fixed ones (a server, a CI runner with a fixed address): up to 20 addresses or ranges, and a request from anywhere else is refused.
  • An expiry: the shorter, the less a forgotten token is worth to anyone who finds it.

Keep it out of code

  • Keep tokens in environment variables, or your platform's secret store (CI secrets, a vault), and read them from there.
  • Never in a repository, not even a private one, and never in code that runs in a browser or an app people download.
  • In WordPress, never in an option or a setting that other plugins can read: use a constant in wp-config.php or the server's environment.
  • Never in logs, error reports or support tickets: the request id is enough for us to find a request.

Rotate on a schedule

Regenerate long-lived tokens now and then. Choose a grace time (1 hour or 24 hours) and both values work while you roll the new one out; then the old one stops (see Regenerate a token).

If a token leaks

  1. Revoke it at once: in the panel, open API, then the token's menu, and choose Revoke. It stops working straight away.
  2. Turn off the webhook endpoints it added: Revoke lists those still on, with Also turn off these endpoints ticked, so leave it ticked. Then check each one's URL and events before you turn it on again, or delete it.
  3. Read what it did in the request log (below), from when it may have leaked.
  4. Change what it could reach: WordPress passwords if it had access to logins, and anything its requests changed. Then make a new token, kept better.

Read the request log

In the panel, API Activity shows the number of requests a day and lists the requests of the last 30 days that changed something, failed or returned a secret, filtered by token, method or failures. Tries with a token after it was revoked or expired are listed too, as failures: a leaked token still being tried shows there. Successful reads are counted but not listed, and a token's failures are listed up to 20 a minute. Look for requests you don't recognise, from tokens that should be quiet, or failures in a row. We email you whenever a token is made or regenerated, and when support revokes one.

The API page's Activity tab: requests, failures, requests over a rate limit and tokens in use over the last 30 days, a chart of requests a day, and the request log with each request's time, method, path, token, status, address and request id.
Activity: requests a day, and the log of changes, failures and secrets, filtered by token, method or failures.

Verify webhooks

Anyone can send a request to your webhook's URL. Check each delivery's signature with your endpoint's signing secret before acting on it, and keep the secret as safe as a token (see Verify signatures).

Operations that can't be undone

Marked Can't be undone in the reference: what they remove can't be brought back. Ask your user to confirm before your code calls them.

OperationRequest
Revoke the token in use DELETE /v1/token
Destroy a server DELETE /v1/servers/{serverId}
Delete a snapshot DELETE /v1/servers/{serverId}/snapshots/{snapshotId}
Restore a server from a snapshot POST /v1/servers/{serverId}/actions/restore
Clear a server's logs POST /v1/servers/{serverId}/logs/actions/clear
Delete a site DELETE /v1/sites/{siteId}
Remove a domain from a site DELETE /v1/sites/{siteId}/domains/{domainId}
Turn off a server's security POST /v1/servers/{serverId}/security/actions/disable
Turn off Imunify360's WordPress plugin POST /v1/servers/{serverId}/security/wordpress-plugin/actions/disable
Delete a cron job DELETE /v1/sites/{siteId}/cron-jobs/{jobId}
Delete files and folders of a site POST /v1/sites/{siteId}/files/actions/delete
Turn a site's backups off POST /v1/sites/{siteId}/backup/actions/disable
Restore a site from a backup POST /v1/sites/{siteId}/backups/{backupId}/actions/restore
Delete a backup DELETE /v1/sites/{siteId}/backups/{backupId}
Remove backup storage DELETE /v1/backup-destinations/{destinationId}
Refresh the staging copy from the live site POST /v1/sites/{siteId}/staging/actions/refresh
Push the staging copy to the live site POST /v1/sites/{siteId}/staging/actions/push
Undo a push to the live site POST /v1/sites/{siteId}/staging/actions/undo-push
Delete a restore point DELETE /v1/sites/{siteId}/staging/restore-points/{runId}
Delete the staging copy DELETE /v1/sites/{siteId}/staging
Delete a webhook endpoint DELETE /v1/webhooks/endpoints/{endpointId}

Answers that hold secrets or personal data

Marked Holds secrets or personal data in the reference: the answer holds a password, a key or a sign-in link, or personal data such as a billing address. Show it to the person who asked, and don't log or store it. Each of these requests is in the request log, so you can see when one was made.

OperationRequest
Get the connect command of your own server GET /v1/servers/{serverId}/connection
Make a new connect command POST /v1/servers/{serverId}/connection/actions/renew
Get the site's WordPress login GET /v1/sites/{siteId}/wordpress-login
Reset the WordPress administrator's password POST /v1/sites/{siteId}/actions/reset-admin-password
List a site's cron jobs GET /v1/sites/{siteId}/cron-jobs
List a cron job's runs GET /v1/sites/{siteId}/cron-jobs/{jobId}/runs
Read a text file of a site GET /v1/sites/{siteId}/files/content
Download a file or folder of a site GET /v1/sites/{siteId}/files/download
Download a backup's files or database GET /v1/sites/{siteId}/backups/{backupId}/download
Connect backup storage POST /v1/backup-destinations
Get the staging copy's password GET /v1/sites/{siteId}/staging/password-protection
Get Rabbitflare SMTP on a site GET /v1/sites/{siteId}/smtp
Turn on Rabbitflare SMTP for a site POST /v1/sites/{siteId}/smtp/actions/enable
Turn off Rabbitflare SMTP for a site POST /v1/sites/{siteId}/smtp/actions/disable
Turn Rabbitflare SMTP on again after a pause POST /v1/sites/{siteId}/smtp/actions/resume
Add a notice or reply address to a site's SMTP POST /v1/sites/{siteId}/smtp/addresses
Send an address's confirmation email again POST /v1/sites/{siteId}/smtp/addresses/{addressId}/actions/send-confirmation
Remove an address from a site's SMTP DELETE /v1/sites/{siteId}/smtp/addresses/{addressId}
Get an address of a site's SMTP GET /v1/sites/{siteId}/smtp/addresses/{addressId}
Add a webhook endpoint POST /v1/webhooks/endpoints
Rotate an endpoint's signing secret POST /v1/webhooks/endpoints/{endpointId}/actions/rotate-secret

Still have a question?

Our team answers support tickets about the API, and other developers answer in the community.

Contact support

Popular

API docs