Logo

Command Palette

Search for a command to run...

GET/stacks/:id
Get Stackpublic

Required Parameters

idstring
Unique identifier of the stack

Retrieve the details of the stack specified in the request.

Related Models:Stack

Stack status values

StatusCodeDescription
STK_QUEUED0Pending analysis
STK_SUCCESS1Deployed successfully
STK_FAILED2Deployment failed
STK_ANALYSING3Analyzing
STK_ANALYSED4Analyzed
STK_QUEUED_FOR_DEPLOYING5Queued for deployment
STK_DEPLOYING6Deploying
STK_TERMINAL_FAILURE7Unable to analyze

Stack health status values

StatusCodeDescription
HLT_UNKNOWN0Unknown
HLT_BUILDING1Building
HLT_PARTIAL2Impaired
HLT_OK3Healthy
HLT_BROKEN4Failed

Request

GET
/stacks/:id
curl -X GET \
  "https://app.cloud66.com/api/3/stacks/:id" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": {
    "uid": "5999b763474b0eafa5fafb64bff0ba80",
    "name": "Awesome App",
    "git": "http://github.com/cloud66-samples/awesome-app.git",
    "git_branch": "fig",
    "environment": "production",
    "cloud": "DigitalOcean",
    "fqdn": "awesome-app.dev.c66.me",
    "language": "ruby",
    "framework": "rails",
    "status": 1,
    "health": 3,
    "last_activity": "2014-08-14T01:46:53+00:00",
    "last_activity_iso": "2014-08-14T01:46:53+00:00",
    "maintenance_mode": false,
    "has_loadbalancer": false,
    "created_at": "2014-08-14 00:38:14 UTC",
    "updated_at": "2014-08-14 01:46:52 UTC",
    "deploy_directory": "/var/deploy/awesome_app",
    "cloud_status": "partial",
    "created_at_iso": "2014-08-14T00:38:14Z",
    "updated_at_iso": "2014-08-14T01:46:52Z",
    "redeploy_hook": "http://hooks.cloud66.com/stacks/redeploy/b806f1c3344eb3aa2a024b23254b75b3/6d677352a6b2eefec6e345ee2b491521"
  }
}
GET/stacks/:stack_id/actions/:id

Required Parameters

stack_idstring
Unique identifier of the stack
idinteger
Identifier of the asynchronous action

Retrieve the details of an asynchronous action performed for the the stack specified in the request based on the supplied action ID.

Related Models:Stack

Request

GET
/stacks/:stack_id/actions/:id
curl -X GET \
  "https://app.cloud66.com/api/3/stacks/:stack_id/actions/:id" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": {
    "id": 6566418,
    "user": "person@company.com",
    "resource_type": "stack",
    "action": "application_deployment",
    "resource_id": "84195",
    "started_via": "api",
    "started_at": "2023-10-11T11:43:57Z",
    "finished_at": "2023-10-11T11:47:42Z",
    "finished_success": true,
    "finished_message": "Completed successfully",
    "finished_result": {},
    "metadata": {
      "user_reference": "my-useful-id"
    }
  }
}
GET/stacks

Retrieves a paged list of all the stack objects the user can access.

Related Models:StackPagination

Request

GET
/stacks
curl -X GET \
  "https://app.cloud66.com/api/3/stacks" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": [
    {
      "uid": "5999b763474b0eafa5fafb64bff0ba80",
      "name": "Awesome App",
      "git": "http://github.com/cloud66-samples/awesome-app.git",
      "git_branch": "fig",
      "environment": "production",
      "cloud": "DigitalOcean",
      "fqdn": "awesome-app.dev.c66.me",
      "language": "ruby",
      "framework": "rails",
      "status": 1,
      "health": 3,
      "last_activity": "2014-08-14T01:46:53+00:00",
      "last_activity_iso": "2014-08-14T01:46:53+00:00",
      "maintenance_mode": false,
      "has_loadbalancer": false,
      "created_at": "2014-08-14 00:38:14 UTC",
      "updated_at": "2014-08-14 01:46:52 UTC",
      "deploy_directory": "/var/deploy/awesome_app",
      "cloud_status": "partial",
      "created_at_iso": "2014-08-14T00:38:14Z",
      "updated_at_iso": "2014-08-14T01:46:52Z",
      "redeploy_hook": "http://hooks.cloud66.com/stacks/redeploy/b806f1c3344eb3aa2a024b23254b75b3/6d677352a6b2eefec6e345ee2b491521"
    }
  ],
  "count": 1,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}
GET/stacks/:stack_id/ssl_certificates

Required Parameters

stack_idstring
Unique identifier of the stack
typestring
Type of certificate (manual or lets_encrypt)
ssl_terminationbool
Whether SSL certificate is terminated on the load balancer or not
server_namesstring
comma separated list of domains

Optional Parameters

wildcardbool
Whether the certificate must support wildcarded domain names - only applies to type lets_encrypt
dns_provider_uuidstring
DNS provider to use for the Let's Encrypt DNS challenge
certificatestring
The certificate address
keystring
The certificate key
intermediate_certificatestring
The intermediate certificate chain

You can use this method to query, add, delete or update SSL certificates on a stack.

HTTP Methods

  • GET /stacks/:stack_id/ssl_certificates - List SSL certificates
  • POST /stacks/:stack_id/ssl_certificates - Create SSL certificate
  • GET /stacks/:stack_id/ssl_certificates/:id - Get SSL certificate
  • PATCH /stacks/:stack_id/ssl_certificates/:id - Update SSL certificate
  • PUT /stacks/:stack_id/ssl_certificates/:id - Update SSL certificate
  • DELETE /stacks/:stack_id/ssl_certificates/:id - Delete SSL certificate

POST, PATCH and PUT should use the following object format:

{
  "ssl_certificate": {
    "server_names": "mywebsite.com",
    "ssl_termination": true,
    "type": "lets_encrypt",
    "wildcard": true,
    "dns_provider_uuid": "dp-fbe3dd78cdc600b187b38c4d4b6b016b"
  }
}

Request

GET
/stacks/:stack_id/ssl_certificates
curl -X GET \
  "https://app.cloud66.com/api/3/stacks/:stack_id/ssl_certificates?wildcard=false&intermediate_certificate=-----BEGIN CERTIFICATE----- entire cert hash -----END CERTIFICATE-----" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": [
    {
      "uuid": "ssl-9ad095613rrr4e0b8f718302bab8709e",
      "name": "pp-ticker-prod-cllaz",
      "server_group_id": null,
      "server_names": "www.fyp111.co",
      "sha256_fingerprint": "481f22f00e117e209dbde4c2ae3831401109fc824784943e39a194a3adb64082",
      "ca_name": "Let's Encrypt",
      "type": "lets_encrypt",
      "wildcard": false,
      "dns_provider_uuid": null,
      "ssl_termination": true,
      "has_intermediate_cert": true,
      "status": 3,
      "created_at": "2023-01-26T10:23:34Z",
      "updated_at": "2023-01-26T10:26:29Z",
      "expires_at": "2023-04-26T09:24:32Z",
      "certificate": null,
      "key": null,
      "intermediate_certificate": null
    }
  ],
  "count": 1,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}
GET/stacks/:id/actions

Required Parameters

idstring
Unique identifier of the stack

Optional Parameters

user_referencestring
Returns actions where the metadata matches the query (up to 255 chars)

Retrieve a paged list of all asynchronous actions performed for the stack specified in the request. You can filter actions by your own metadata using user_reference (note: metadata needs to be added to the action when it is invoked to be available here).

Related Models:StackPagination

The stack action object

PropertyData typeDescriptionSample value
idintThe numeric identifier of the stack action. Identifiers increment by one for each performed action.10
user_referencestring (up to 255 chars)Returns actions where the metadata matches the query.useful-reference-123
userstringThe email address of the user who performed the stack action.hello@cloud66.com
resource_typestringThe resource for which the action was performed, which is stack in this case.stack
actionstringThe action that was performed for the stack.restart
resource_idintThe unique ID of the resource283
started_viastringThe process that initiated the action, which is the UI, API, or command line.api
started_atdatetimeThe date and time the action was initiated, in UTC datetime.2014-09-01T19:08:05Z
finished_atdatetimeThe date and time the action was completed, in UTC datetime.2014-09-01T19:08:09Z
finished_successboolWhether the action completed successfully.true
finished_messagestringIf applicable, the system message associated with the completed action.null

Request

GET
/stacks/:id/actions
curl -X GET \
  "https://app.cloud66.com/api/3/stacks/:id/actions?user_reference=useful-reference-123" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Response

{
  "response": [
    {
      "id": 6566418,
      "user": "person@company.com",
      "resource_type": "stack",
      "action": "application_deployment",
      "resource_id": "84195",
      "started_via": "api",
      "started_at": "2023-10-11T11:43:57Z",
      "finished_at": "2023-10-11T11:47:42Z",
      "finished_success": true,
      "finished_message": "Completed successfully",
      "finished_result": {},
      "metadata": {
        "user_reference": "my-useful-id"
      }
    }
  ],
  "count": 1,
  "pagination": {
    "previous": null,
    "next": null,
    "current": 1,
    "per_page": 30,
    "count": 1,
    "pages": 1
  }
}
POST/stacks
Create Stackredeploy

Required Parameters

namestring
New stack name
environmentstring
New stack environment
service_yamlstring
The services definition of the new docker stack

Optional Parameters

manifest_yamlstring
The manifest definition of the new docker stack
cloudstring
Cloud provider to create servers in
key_namestring
Name of the cloud provider key (Default or first available key for the cloud if not specified)
regionstring
Region within the cloud to create servers in
sizestring
Size of the server
build_typestring
Deploy all services to single or multi servers

Create and build a new docker stack. Either manifest definition, or cloud, region, size and build_type must be passed as params.

Related Models:Stack

Request

POST
/stacks
curl -X POST \
  "https://app.cloud66.com/api/3/stacks?manifest_yaml=manifest_yaml_serialised&cloud=aws&key_name=my_key&region=us-east-1&size=t1.micro&build_type=multi" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "new_stack_name",
  "environment": "production",
  "service_yaml": "service_yaml_serialised"
}'

Response

{
  "response": {
    "id": 10,
    "user": "test@cloud66.com",
    "resource_type": "stack",
    "action": "stack_create",
    "resource_id": "283",
    "started_via": "api",
    "started_at": "2015-09-01T19:08:05Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}
POST/stacks/:stack_id/reboot_servers

Required Parameters

stack_idstring
Unique identifier of the stack
strategystring
parallel or serial

Optional Parameters

groupstring
all or web/db/redis etc (default is web)

You can use this method to reboot the stack or specific server group of a stack.

Related Models:StackServer

Request

POST
/stacks/:stack_id/reboot_servers
curl -X POST \
  "https://app.cloud66.com/api/3/stacks/:stack_id/reboot_servers?group=mysql" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "stack_id": "5999b763474b0eafa5fafb64bff0ba80",
  "strategy": "parallel"
}'

Response

{
  "response": {
    "id": 10,
    "user": "test@cloud66.com",
    "resource_type": "stack",
    "action": "stack_reboot",
    "resource_id": "283",
    "started_via": "api",
    "started_at": "2016-01-01T19:08:05Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}
POST/stacks/:stack_id/actions

Required Parameters

stack_idstring
Unique identifier of the stack
commandstring
The action to perform for the stack. Valid values are clear_caches, maintenance_mode, restart, promote_slave_db, resync_slave_db, disable_replication_slave_db, container_restart, service_restart, service_pause, service_resume, process_restart, process_pause, and process_resume.

Perform an asynchronous action for the stack specified in the request. You can use this method to restart the stack, clear the stack's cache, enable maintenance mode, manage database replication, and control containers, services, and processes.

Related Models:Stack

Available Commands

CommandCommentsExtra Parameters
clear_cachesClears all application caches for the stackNone
container_restartRestarts a particular container on the given stackcontainer_id:container-id-or-name
disable_replication_slave_dbDisable replication to the specified slave database serverserver_uid:server-uid
db_type:postgresql, redis, mysql (optional)
maintenance_modeEnable or disable maintenance mode for a stackvalue:1 for enable or 0 for disable
process_pausePauses the specified processprocess_name:process-name (optional)
server_uid:server-uid (optional)
process_restartRestarts the specified processprocess_name:process-name (optional)
server_uid:server-uid (optional)
process_resumeResumes the specified processprocess_name:process-name (optional)
server_uid:server-uid (optional)
promote_slave_dbPromote the specified slave database server to a standalone masterserver_uid:server-uid
db_type:postgresql, redis, mysql (optional)
restartRestarts all stack componentsNone
resync_slave_dbRe-sync the specified slave database server with its master database serverserver_uid:server-uid
db_type:postgresql, mysql (optional)
service_pausePauses all the containers from the given serviceservice_name:service-name (optional)
server_uid:server-uid (optional)
service_restartRestarts all the containers from the given serviceservice_name:service-name (optional)
server_uid:server-uid (optional)
service_resumeResumes all the containers from the given serviceservice_name:service-name (optional)
server_uid:server-uid (optional)

Request

POST
/stacks/:stack_id/actions
curl -X POST \
  "https://app.cloud66.com/api/3/stacks/:stack_id/actions" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "stack_id": "5999b763474b0eafa5fafb64bff0ba80",
  "command": "restart"
}'

Response

{
  "response": {
    "id": 10,
    "user": "test@cloud66.com",
    "resource_type": "stack",
    "action": "clear_caches",
    "resource_id": "283",
    "started_via": "api",
    "started_at": "2014-09-01T19:08:05Z",
    "finished_at": null,
    "finished_success": null,
    "finished_message": null
  }
}