Introduction
Scroll down for code samples, example requests and responses.
Welcome to the SpinupWP REST API documentation.
This API is currently in BETA, which means it can change at any time. We highly recommend that you subscribe to the What's New email list to be notified in advance of any updates to the API.
We’ve released a very limited set of endpoints to start so that we can gather input from REST API users. We welcome feedback and suggestions, which can be shared with us in the SpinupWP developer community, or via email.
To get started with our API, you will need a SpinupWP account. If you don't have an account yet, you can sign up for a free trial.
Our API accepts form-encoded request bodies and returns JSON responses. All API requests must be made over HTTPS.
Alternatively, we also have a PHP SDK, which provides an expressive interface for interacting with SpinupWP's API. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.
Authentication
Request
curl -X GET https://api.spinupwp.app/v1/servers \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
Once you have a SpinupWP account, you will need an API access token to use our API. The API access token must be sent with each request in the Authorization
header as a Bearer token. API access tokens can be created for your personal account or as part of a team.
To generate a personal API access token, navigate to the API Tokens tab in your “My Account” settings page in SpinupWP. API access tokens you create via the “My Account” page are only relevant to resources created under your personal account.
If you are a team admin or a team owner, you can also generate access tokens from the API Tokens tab on the “Team Settings” page for any of the teams you own/manage. API access tokens you create via the “Team Settings” page are only relevant for resources associated with that team.
Pagination
Request
curl -X GET https://api.spinupwp.app/v1/servers?page=2 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$servers = $spinupwp->servers->list();
// Auto-pagination handles fetching lists of resources without having
// to paginate results and perform subsequent requests manually
foreach ($servers as $server) {
// Do something with $server
}
Response
{
"data": [...],
"pagination": {
"previous": "https://api.spinupwp.app/v1/sites?page=1",
"next": "https://api.spinupwp.app/v1/sites?page=3",
"count": 25
}
}
All “list” endpoints include pagination, and have a limit of 10 objects per page. These endpoints will include a top-level pagination
object with previous
and next
links along with a total count
of objects.
These endpoints accept a page
query parameter, which is the index of the page you want to retrieve. You can also optionally pass a limit
parameter between 1 and 100, which is the limit of the number of objects to be returned. The default limit is 10.
Rate Limiting
The SpinupWP API has limit of 60 requests per minute. If you exceed the allowed limit you will receive a 429 Too Many Attempts
response. To help you determine if you are approaching the limit we include the X-RateLimit-Limit
and X-RateLimit-Remaining
headers on each request.
Servers
The Servers endpoint allows you to view servers.
List all servers
Request
curl -X GET https://api.spinupwp.app/v1/servers \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$servers = $spinupwp->servers->list();
Response
{
"data": [
{
"id": 1,
"name": "turnipjuice-media",
"provider_name": "DigitalOcean",
"ubuntu_version": "24.04",
"ip_address": "10.0.0.1",
"ssh_port": 22,
"timezone": "UTC",
"region": "TOR1",
"size": "1 GB / 1 vCPU",
"disk_space": {
"total": 25210576000,
"available": 20966548000,
"used": 4244028000,
"updated_at": "2024-07-01T12:00:00.000000Z"
},
"database": {
"server": "mysql-8.0",
"host": "localhost",
"port": 3306
},
"ssh_publickey": "ssh-rsa AAAA....",
"git_publickey": "ssh-rsa AAAA....",
"connection_status": "connected",
"reboot_required": true,
"upgrade_required": false,
"install_notes": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "provisioned"
}
],
"pagination": {
"previous": null,
"next": "https://api.spinupwp.app/v1/servers?page=2",
"per_page": 10,
"count": 15
}
}
GET /servers
Retrieves a list of servers. Returns a paginated list of Server objects.
Provision a server
Request
curl -X POST https://api.spinupwp.app/v1/servers \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d 'server_provider[id]'=1 \
-d 'server_provider[region]'="tor1" \
-d 'server_provider[size]'="s-1vcpu-1gb" \
-d 'server_provider[enable_backups]'=true \
-d 'hostname'="turnipjuice-media" \
-d 'timezone'="America/Toronto" \
-d 'database[root_password]'="V9ByakWHYgFN"
-d 'post_provision_script'="apt-get install -q -y nodejs; apt-get install -q -y npm;"
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$server = $spinupwp->servers->create([
'server_provider' => [
'id' => 1,
'region' => 'tor1',
'size' => 's-1vcpu-1gb',
'enable_backups' => true,
],
'hostname' => 'turnipjuice-media',
'timezone' => 'America/Toronto',
'database' => [
'root_password' => 'V9ByakWHYgFN',
],
'post_provision_script' => "apt-get install -q -y nodejs; apt-get install -q -y npm;",
]);
Response
{
"event_id": 1,
"data": {
"id": 1,
"name": "turnipjuice-media",
"provider_name": "DigitalOcean",
"ubuntu_version": "24.04",
"ip_address": "10.0.0.1",
"ssh_port": 22,
"timezone": "UTC",
"region": "TOR1",
"size": "1 GB / 1 vCPU",
"disk_space": {
"total": 25210576000,
"available": 20966548000,
"used": 4244028000,
"updated_at": "2024-07-01T12:00:00.000000Z"
},
"database": {
"server": "mysql-8.0",
"host": "localhost",
"port": 3306
},
"ssh_publickey": "ssh-rsa AAAA....",
"git_publickey": "ssh-rsa AAAA....",
"connection_status": "connected",
"reboot_required": true,
"upgrade_required": false,
"install_notes": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "provisioned"
}
}
POST /servers
Provisions a new server. Returns the event_id
of the create server event along with the created Server object. On average, it takes 10 minutes for a new server to be provisioned, and we’ll email you once your server is ready. You can check the events endpoint for the event_id
to find out when the server has finished provisioning.
Only DigitalOcean Server Providers are currently supported. Needs either the ID of an existing Server Provider or a DigitalOcean API Token.
Parameters
(* indicates a required field)
Name | Type | Description |
---|---|---|
server_provider.id |
integer | The ID of the Server Provider where the server should be provisioned. This can be found in the Account Settings in SpinupWP. Required unless using a DigitalOcean API Token. |
server_provider.api_token |
string | A DigitalOcean API Token. Required unless using a Server Provider ID. |
server_provider.region * |
string | The slug of the region where the server will be provisioned. You can get a list of regions for DigitalOcean here. |
server_provider.size * |
string | The slug of the size for the server to provisioned. You can get a list of sizes for DigitalOcean from their API. |
server_provider.enable_backups |
boolean | If backups should be enabled at the server provider level. Defaults to false . |
hostname * |
string | Hostname for the server. Can only contain alphanumeric characters, dashes, and periods. |
timezone |
string | Configures the server’s timezone, which affects when Unix cron jobs run and the date format of some log files. Here you can find a list of supported timezones. Defaults to UTC . |
database_provider.id |
integer | The ID of an External Database. This can be found in the Account Settings in SpinupWP. The latest version of MySQL will be installed on your server if not provided. |
database.root_password |
string | Database root password. Leave blank to auto generate. |
post_provision_script |
string | This script will run as the root user once your server has successfully provisioned. |
Retrieve a server
Request
curl -X GET https://api.spinupwp.app/v1/servers/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$server = $spinupwp->servers->get($serverId);
Response
{
"data": {
"id": 1,
"name": "turnipjuice-media",
"provider_name": "DigitalOcean",
"ubuntu_version": "24.04",
"ip_address": "10.0.0.1",
"ssh_port": 22,
"timezone": "UTC",
"region": "TOR1",
"size": "1 GB / 1 vCPU",
"disk_space": {
"total": 25210576000,
"available": 20966548000,
"used": 4244028000,
"updated_at": "2024-07-01T12:00:00.000000Z"
},
"database": {
"server": "mysql-8.0",
"host": "localhost",
"port": 3306
},
"ssh_publickey": "ssh-rsa AAAA....",
"git_publickey": "ssh-rsa AAAA....",
"connection_status": "connected",
"reboot_required": true,
"upgrade_required": false,
"install_notes": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "provisioned"
}
}
GET /servers/{id}
Retrieves the details of a single server. Returns a Server object.
Delete a server
Request
curl -X DELETE https://api.spinupwp.app/v1/servers/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d delete_server_on_provider=true \
-G
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->servers->delete($serverId, $deleteOnProvider);
Response
{
"event_id": 1
}
DELETE /servers/{id}
Permanently deletes a server. This cannot be undone. Returns the event_id
of the delete server event.
Parameters
(* indicates a required field)
Name | Type | Description |
---|---|---|
delete_server_on_provider |
boolean | Also, delete the server from the server provider (DigitalOcean, etc.). |
Reboot a server
Request
curl -X POST https://api.spinupwp.app/v1/servers/{id}/reboot \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->servers->reboot($serverId);
Response
{
"event_id": 1
}
POST /servers/{id}/reboot
Reboot a server. Returns the event_id
of the reboot server event.
Restart Nginx service
Request
curl -X POST https://api.spinupwp.app/v1/servers/{id}/services/nginx/restart \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->servers->restartNginx($serverId);
Response
{
"event_id": 1
}
POST /servers/{id}/services/nginx/restart
Restart the Nginx service on a server. Returns the event_id
of the restart Nginx event.
Restart PHP-FPM service
Request
curl -X POST https://api.spinupwp.app/v1/servers/{id}/services/php/restart \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->servers->restartPhp($serverId);
Response
{
"event_id": 1
}
POST /servers/{id}/services/php/restart
Restart all versions of the PHP-FPM service installed on a server. Returns the event_id
of the restart PHP-FPM event.
Restart MySQL service
Request
curl -X POST https://api.spinupwp.app/v1/servers/{id}/services/mysql/restart \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->servers->restartMysql($serverId);
Response
{
"event_id": 1
}
POST /servers/{id}/services/mysql/restart
Restart the MySQL or MariaDB service on a server. Returns the event_id
of the restart MySQL event.
Sites
The Sites endpoint allows you to create, view, and delete sites.
List all sites
Request
curl -X GET https://api.spinupwp.app/v1/sites \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d server_id=1 \
-G
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
// List all sites
$sites = $spinupwp->sites->list();
// List sites by server
$sites = $spinupwp->sites->listForServer($serverId);
Response
{
"data": [
{
"id": 0,
"server_id": 1,
"domain": "turnipjuice.media",
"additional_domains": [
{
"domain": "www.turnipjuice.media",
"redirect": {
"enabled": true
},
"created_at": "2024-07-01T12:00:00.000000Z"
}
],
"site_user": "turnipjuicemedia",
"php_version": "8.3",
"public_folder": "/",
"is_wordpress": true,
"page_cache": {
"enabled": true
},
"https": {
"enabled": true
},
"nginx": {
"uploads_directory_protected": true,
"xmlrpc_protected": true,
"subdirectory_rewrite_in_place": false
},
"database": {
"id": 1,
"user_id": 1,
"table_prefix": "wp_"
},
"backups": {
"files": true,
"database": true,
"paths_to_exclude": "node_modules\\n/files/vendor",
"retention_period": 30,
"next_run_time": "2024-07-01T12:00:00.000000Z",
"storage_provider": {
"id": 1,
"region": "nyc3",
"bucket": "turnipjuice-media"
}
},
"wp_core_update": true,
"wp_theme_updates": 0,
"wp_plugin_updates": 3,
"git": {
"repo": "git@github.com:spinupwp/spinupwp-composer-site.git",
"branch": "main",
"deploy_script": "composer install --optimize-autoload --no-dev",
"push_enabled": true,
"deployment_url": "https://api.spinupwp.app/git/jeJLdKrl63/deploy"
},
"basic_auth": {
"enabled": true,
"username": "turnipjuice"
},
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "deployed"
}
],
"pagination": {
"previous": null,
"next": "https://api.spinupwp.app/v1/sites?page=2",
"per_page": 10,
"count": 15
}
}
GET /sites
Retrieves a list of sites. Optionally filtered by server. Returns a paginated list of Site objects.
Parameters
(* indicates a required field)
Name | Type | Description |
---|---|---|
server_id |
integer | Filter by Server ID |
Create a site
Request
curl -X POST https://api.spinupwp.app/v1/sites \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d 'server_id'=1 \
-d 'domain'=turnipjuice.media \
-d 'additional_domains[1][domain]'=www.turnipjuice.media \
-d 'additional_domains[1][redirect]'=true \
-d 'site_user'=turnipjuicemedia \
-d 'installation_method'=wp \
-d 'page_cache[enabled]'=true \
-d 'https[enabled]'=true \
-d 'database[name]'=turnipjuicemedia \
-d 'database[username]'=turnipjuicemedia \
-d 'wordpress[title]'="Turnip Juice Media" \
-d 'wordpress[admin_user]'=admin \
-d 'wordpress[admin_email]'=abraham@turnipjuice.media \
-d 'wordpress[admin_password]'=DK6Jrfj8gyWzL
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$site = $spinupwp->sites->create($serverId, [
'domain' => 'turnipjuice.media',
'site_user' => 'turnipjuicemedia',
'installation_method' => 'wp',
'page_cache' => [
'enabled' => true,
],
'https' => [
'enabled' => true,
],
'database' => [
'name' => 'turnipjuicemedia',
'username' => 'turnipjuicemedia',
],
'wordpress' => [
'title' => 'Turnip Juice Media',
'admin_user' => 'admin',
'admin_email' => 'abraham@turnipjuice.media',
'admin_password' => 'DK6Jrfj8gyWzL',
]
]);
Response
{
"event_id": 1,
"data": {
"id": 0,
"server_id": 1,
"domain": "turnipjuice.media",
"additional_domains": [
{
"domain": "www.turnipjuice.media",
"redirect": {
"enabled": true
},
"created_at": "2024-07-01T12:00:00.000000Z"
}
],
"site_user": "turnipjuicemedia",
"php_version": "8.3",
"public_folder": "/",
"is_wordpress": true,
"page_cache": {
"enabled": true
},
"https": {
"enabled": true
},
"nginx": {
"uploads_directory_protected": true,
"xmlrpc_protected": true,
"subdirectory_rewrite_in_place": false
},
"database": {
"id": 1,
"user_id": 1,
"table_prefix": "wp_"
},
"backups": {
"files": true,
"database": true,
"paths_to_exclude": "node_modules\\n/files/vendor",
"retention_period": 30,
"next_run_time": "2024-07-01T12:00:00.000000Z",
"storage_provider": {
"id": 1,
"region": "nyc3",
"bucket": "turnipjuice-media"
}
},
"wp_core_update": true,
"wp_theme_updates": 0,
"wp_plugin_updates": 3,
"git": {
"repo": "git@github.com:spinupwp/spinupwp-composer-site.git",
"branch": "main",
"deploy_script": "composer install --optimize-autoload --no-dev",
"push_enabled": true,
"deployment_url": "https://api.spinupwp.app/git/jeJLdKrl63/deploy"
},
"basic_auth": {
"enabled": true,
"username": "turnipjuice"
},
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "deployed"
}
}
POST /sites
Creates a new site. Returns the event_id
of the create site event along with the created Site object. You can check the events endpoint for the event_id
every few minutes to find out when the site is ready.
Parameters
(* indicates a required field)
Name | Type | Description |
---|---|---|
server_id * |
integer | The ID of the server where the site should be created. |
domain * |
string | The site’s primary domain. |
additional_domains |
array | List of Additional Domain objects. |
site_user * |
string | The username for the site user. |
php_version |
string | The site’s PHP version. One of 7.4 , 8.0 , 8.1 , 8.2 , or 8.3 . Defaults to 8.2 . |
public_folder |
string | The site’s public folder. Defaults to / . |
installation_method * |
string | The type of site. One of wp , wp_subdirectory , wp_subdomain , git or blank . |
deploy_script |
string | This script will run after the site has been deployed. The script is executed as the site user from the ~/files directory. |
page_cache.enabled |
boolean | Whether to enable page caching. |
https.enabled |
boolean | Whether to enable HTTPS. |
https.certificate_path |
string | Only required when using a custom HTTPS certificate. Specify a path to the certificate. |
https.private_key_path |
string | Only required when using a custom HTTPS certificate. Specify a path to the prive key. |
database.name |
string | Database name. Only required if adding a database. |
database.username |
string | Database username. Only required if adding a database. |
database.password |
string | Database password. Leave blank to auto generate. |
database.table_prefix |
string | Table prefix for WordPress. Leave blank to auto generate. |
wordpress.title |
string | WordPress site title. Only required when using a WordPress installation method. |
wordpress.admin_user |
string | WordPress admin username. Only required when using a WordPress installation method. |
wordpress.admin_password |
string | WordPress admin password. Only required when using a WordPress installation method. |
wordpress.admin_email |
string | WordPress admin email. Only required when using a WordPress installation method. |
git.repo |
string | Link to repository if enabling git. |
git.branch |
string | Git repository branch to deploy from. |
git.always_run_deploy_script |
boolean | Run the site’s deploy script after each git deployment. If this is not true , the script will run once after the site has been created and will not be saved. |
git.push_to_deploy |
boolean | Enable push to deploy for git. Need to setup a webhook with your git provider to point to the returned git_deployment_url . |
Retrieve a site
Request
curl -X GET https://api.spinupwp.app/v1/sites/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$site = $spinupwp->sites->get($siteId);
Response
{
"data": {
"id": 0,
"server_id": 1,
"domain": "turnipjuice.media",
"additional_domains": [
{
"domain": "www.turnipjuice.media",
"redirect": {
"enabled": true
},
"created_at": "2024-07-01T12:00:00.000000Z"
}
],
"site_user": "turnipjuicemedia",
"php_version": "8.3",
"public_folder": "/",
"is_wordpress": true,
"page_cache": {
"enabled": true
},
"https": {
"enabled": true
},
"nginx": {
"uploads_directory_protected": true,
"xmlrpc_protected": true,
"subdirectory_rewrite_in_place": false
},
"database": {
"id": 1,
"user_id": 1,
"table_prefix": "wp_"
},
"backups": {
"files": true,
"database": true,
"paths_to_exclude": "node_modules\\n/files/vendor",
"retention_period": 30,
"next_run_time": "2024-07-01T12:00:00.000000Z",
"storage_provider": {
"id": 1,
"region": "nyc3",
"bucket": "turnipjuice-media"
}
},
"wp_core_update": true,
"wp_theme_updates": 0,
"wp_plugin_updates": 3,
"git": {
"repo": "git@github.com:spinupwp/spinupwp-composer-site.git",
"branch": "main",
"deploy_script": "composer install --optimize-autoload --no-dev",
"push_enabled": true,
"deployment_url": "https://api.spinupwp.app/git/jeJLdKrl63/deploy"
},
"basic_auth": {
"enabled": true,
"username": "turnipjuice"
},
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "deployed"
}
}
GET /sites/{id}
Retrieves the details of a single site. Returns a Site object.
Delete a site
Request
curl -X DELETE https://api.spinupwp.app/v1/sites/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
-d delete_database=true \
-d delete_backups=true \
-G
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->sites->delete($siteId);
Response
{
"event_id": 1
}
DELETE /sites/{id}
Permanently deletes a site. This cannot be undone. Returns the event_id
of the delete site event.
Parameters
(* indicates a required field)
Name | Type | Description |
---|---|---|
delete_database |
boolean | Delete associated database |
delete_backups |
boolean | Delete associated backups |
Purge page cache
Request
curl -X POST https://api.spinupwp.app/v1/sites/{id}/page-cache/purge \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->sites->purgePageCache($siteId);
Response
{
"event_id": 1
}
POST /sites/{id}/page-cache/purge
Purge the site’s page cache. Returns the event_id
of the purge page cache event.
Purge object cache
Request
curl -X POST https://api.spinupwp.app/v1/sites/{id}/object-cache/purge \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->sites->purgeObjectCache($siteId);
Response
{
"event_id": 1
}
POST /sites/{id}/object-cache/purge
Purge the site’s WordPress object cache. Returns the event_id
of the purge object cache event.
Correct file permissions
Request
curl -X POST https://api.spinupwp.app/v1/sites/{id}/file-permissions/correct \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->sites->correctFilePermissions($siteId);
Response
{
"event_id": 1
}
POST /sites/{id}/file-permissions/correct
Reset all file permissions so that the site’s system user owns the site’s file and folders. Returns the event_id
of the correct file permissions event.
Run a Git deployment
Request
curl -X POST https://api.spinupwp.app/v1/sites/{id}/git/deploy \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$eventId = $spinupwp->sites->gitDeploy($siteId);
Response
{
"event_id": 1
}
POST /sites/{id}/git/deploy
Run a Git deployment which will pull the latest changes from your Git repository to the site on your server, and run your deployment script afterward (if you have one configured). Returns the event_id
of the git deployment event.
Events
The Events endpoint allows you to view events.
List all events
Request
curl -X GET https://api.spinupwp.app/v1/events \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$events = $spinupwp->events->list();
Response
{
"data": [
{
"id": 0,
"initiated_by": "Abraham",
"server_id": 1,
"name": "Creating site turnipjuice.media",
"status": "deployed",
"output": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"started_at": "2024-07-01T12:00:00.000000Z",
"finished_at": "2024-07-01T12:00:00.000000Z"
}
],
"pagination": {
"previous": null,
"next": "https://api.spinupwp.app/v1/events?page=2",
"per_page": 10,
"count": 15
}
}
GET /events
Retrieves a list of events. Returns a paginated list of Event objects.
Retrieve an event
Request
curl -X GET https://api.spinupwp.app/v1/events/{id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');
$event = $spinupwp->events->get($eventId);
Response
{
"data": {
"id": 0,
"initiated_by": "Abraham",
"server_id": 1,
"name": "Creating site turnipjuice.media",
"status": "deployed",
"output": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"started_at": "2024-07-01T12:00:00.000000Z",
"finished_at": "2024-07-01T12:00:00.000000Z"
}
}
GET /events/{id}
Retrieves the details of a single event. Returns an Event object. For operations that return an event_id
you can use this endpoint to check the status of the event. A status
of “deployed” means that the event was successfully completed. If the event fails, the output
field will contain any error messages.
Schemas
Server
{
"id": 1,
"name": "turnipjuice-media",
"provider_name": "DigitalOcean",
"ubuntu_version": "24.04",
"ip_address": "10.0.0.1",
"ssh_port": 22,
"timezone": "UTC",
"region": "TOR1",
"size": "1 GB / 1 vCPU",
"disk_space": {
"total": 25210576000,
"available": 20966548000,
"used": 4244028000,
"updated_at": "2024-07-01T12:00:00.000000Z"
},
"database": {
"server": "mysql-8.0",
"host": "localhost",
"port": 3306
},
"ssh_publickey": "ssh-rsa AAAA....",
"git_publickey": "ssh-rsa AAAA....",
"connection_status": "connected",
"reboot_required": true,
"upgrade_required": false,
"install_notes": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "provisioned"
}
Properties
Name | Type | Description |
---|---|---|
id |
integer | Unique identifier for the server. |
name |
string | The server’s name. For display purposes only. |
provider_name |
string | The server’s provider name. |
ubuntu_version |
string | The version of Ubuntu on the server. One of 18.04 , 20.04 , 22.04 , or 24.04 . |
ip_address |
string | The server’s IP address. |
ssh_port |
integer | Port where the server accepts SSH connections. |
timezone |
string | The server’s timezone. |
region |
string | The server’s region. For display purposes only. |
size |
string | The server’s size. For display purposes only. |
disk_space |
object | Disk space details. |
» total |
integer | Total disk space detected on the server. (In bytes). |
» available |
integer | Available disk space detected on the server. (In bytes). |
» used |
integer | Used disk space detected on the server. (In bytes). |
» updated_at |
string(date-time) | The time that disk space was updated. |
database |
object | Database details. |
» server |
string | The database type on the server. |
» host |
string | The hostname for the database. |
» port |
integer | The port for the database. |
ssh_publickey |
string | The server’s public key. |
git_publickey |
string | The server’s public key for git connections. |
connection_status |
string | The server’s connection status. One of connected or disconnected . |
reboot_required |
boolean | If the server requires a reboot |
upgrade_required |
boolean | If the server has a pending SpinupWP upgrade. |
install_notes |
string | Notes about the server. |
created_at |
string(date-time) | The date the server was created. |
status |
string | The server’s status. One of provisioning , provisioned , or failed . |
Site
{
"id": 0,
"server_id": 1,
"domain": "turnipjuice.media",
"additional_domains": [
{
"domain": "www.turnipjuice.media",
"redirect": {
"enabled": true
},
"created_at": "2024-07-01T12:00:00.000000Z"
}
],
"site_user": "turnipjuicemedia",
"php_version": "8.3",
"public_folder": "/",
"is_wordpress": true,
"page_cache": {
"enabled": true
},
"https": {
"enabled": true,
"certificate_path": "/etc/nginx/ssl/turnipjuice.media/certificate-bundle.crt",
"private_key_path": "/etc/nginx/ssl/turnipjuice.media/private-key.key"
},
"nginx": {
"uploads_directory_protected": true,
"xmlrpc_protected": true,
"subdirectory_rewrite_in_place": false
},
"database": {
"id": 1,
"user_id": 1,
"table_prefix": "wp_"
},
"backups": {
"files": true,
"database": true,
"paths_to_exclude": "node_modules\\n/files/vendor",
"retention_period": 30,
"next_run_time": "2024-07-01T12:00:00.000000Z",
"storage_provider": {
"id": 1,
"region": "nyc3",
"bucket": "turnipjuice-media"
}
},
"wp_core_update": true,
"wp_theme_updates": 0,
"wp_plugin_updates": 3,
"git": {
"repo": "git@github.com:spinupwp/spinupwp-composer-site.git",
"branch": "main",
"deploy_script": "composer install --optimize-autoload --no-dev",
"push_enabled": true,
"deployment_url": "https://api.spinupwp.app/git/jeJLdKrl63/deploy"
},
"basic_auth": {
"enabled": true,
"username": "turnipjuice"
},
"created_at": "2024-07-01T12:00:00.000000Z",
"status": "deployed"
}
Properties
Name | Type | Description |
---|---|---|
id |
integer | Unique identifier for the site. |
server_id |
integer | The site’s server ID. |
domain |
string | The site’s primary domain. |
additional_domains |
[AdditionalDomain] | The site’s additional domains. |
site_user |
string | The username for the site user. |
php_version |
string | The site’s PHP version. |
public_folder |
string | The site’s public folder. |
is_wordpress |
boolean | If a WordPress install was detected. |
page_cache |
object | Page cache details. |
» enabled |
boolean | If page caching is enabled. |
https |
object | HTTPS details. |
» enabled |
boolean | If https is enabled. |
» certificate_path |
string | The path to the certificate when using a custom HTTPS. |
» private_key_path |
string | The path to the private key when using a custom HTTPS. |
nginx |
object | Nginx options. |
» uploads_directory_protected |
boolean | Disallow PHP execution in the uploads folder. |
» xmlrpc_protected |
boolean | Disable xmlrpc.php |
» subdirectory_rewrite_in_place |
boolean | If rewrite rules are enabled for a WordPress Multisite subdirectory install. |
database |
object | Database details. |
» id |
integer | The site’s database ID. |
» user_id |
integer | The site’s database user ID. |
» table_prefix |
string | The site’s WordPress table prefix. |
backups |
object | Backup details. |
» files |
boolean | If file backups are enabled. |
» database |
boolean | If database backups are enabled. |
» paths_to_exclude |
string | Paths to be excluded from the file backups. |
» retention_period |
integer | Number of days to retain the site backups. |
» next_run_time |
string(date-time) | The timestamp in UTC that the next automatically scheduled backup will run. |
» storage_provider |
object | Storage provider details. |
»» id |
integer | The site’s storage provider ID. |
»» region |
string | The site’s storage provider region. |
»» bucket |
string | The site’s storage provider bucket. |
wp_core_update |
boolean | If WordPress core has updates available. |
wp_theme_updates |
integer | Number of WordPress themes that have updates available. |
wp_plugin_updates |
integer | Number of WordPress plugins that have updates available. |
git |
object | Git details. |
» repo |
string | The site’s git repository URL. |
» branch |
string | The site’s git branch. |
» deploy_script |
string | The script that will run after each git deployment. The script is executed as the site user from the ~/files directory. |
» push_enabled |
boolean | If git push to deploy is enabled. |
» deployment_url |
string | URL that git provider needs to make a POST request to for push to deploy. |
basic_auth |
object | Basic auth details. |
» enabled |
boolean | If basic authentication is enabled. |
» username |
string | The basic auth username. |
created_at |
string(date-time) | The date the site was created. |
status |
string | The site’s status. One of deploying , deployed , or failed . |
Event
{
"id": 0,
"initiated_by": "Abraham",
"server_id": 1,
"name": "Creating site turnipjuice.media",
"status": "deployed",
"output": null,
"created_at": "2024-07-01T12:00:00.000000Z",
"started_at": "2024-07-01T12:00:00.000000Z",
"finished_at": "2024-07-01T12:00:00.000000Z"
}
Properties
Name | Type | Description |
---|---|---|
id |
integer | Unique identifier for the event. |
initiated_by |
string | The name of the person that initiated the event. |
server_id |
integer | The event’s server ID. |
name |
string | The name of the event. |
status |
string | The event’s status. One of queued ,creating ,updating ,deleting ,deployed , or failed . |
output |
string | The event’s output. |
created_at |
string(date-time) | The time that the event was created. |
started_at |
string(date-time) | The time that the event was started. |
finished_at |
string(date-time) | The time that the event finished. |
Additional Domain
{
"domain": "www.turnipjuice.media",
"redirect": {
"enabled": true
},
"created_at": "2024-07-01T12:00:00.000000Z"
}
Properties
Name | Type | Description |
---|---|---|
domain |
string | Additional domain name. |
redirect |
object | The domain redirect details. |
» enabled |
boolean | If true the domain will redirect to the primary domain. |
created_at |
string(date-time) | Date the domain was added. |
Pagination
{
"previous": null,
"next": "https://api.spinupwp.app/v1/sites?page=2",
"per_page": 10,
"count": 15
}
Properties
Name | Type | Description |
---|---|---|
previous |
string | Link to the previous page. Null if the current page is the first page. |
next |
string | Link to the previous page. Null if the current page is the last page. |
per_page |
integer | Number of objects per page. |
count |
integer | Total number of objects. |
Errors
The SpinupWP API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request – Your request is invalid. |
401 | Unauthorized – Your API token is wrong or no longer valid. |
402 | Payment Required – The team does not have a valid subscription. |
403 | Forbidden – You do not have permission to access the endpoint. |
404 | Not Found – The specified resource could not be found. |
405 | Method Not Allowed – You tried to access an endpoint with an invalid method. |
422 | Validation Error – Invalid or missing parameters. |
429 | Too Many Attempts – You’ve hit the rate limit on API requests. |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarily offline for maintenance. Please try again later. |