pydo.apps.create()

Description

Create a new app by submitting an app specification. For documentation on app specifications (AppSpec objects), please refer to the product documentation.

Request Sample

import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

create_resp = client.apps.create(
    {
        "spec": {
            "name": "web-app",
            "region": "nyc",
            "services": [
                {
                    "name": "api",
                    "github": {},
                    "run_command": "bin/api",
                    "environment_slug": "node-js",
                    "instance_count": 2,
                    "instance_size_slug": "apps-s-1vcpu-0.5gb",
                    "routes": [],
                }
            ],
        }
    }
)

Responses

See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.

A JSON or YAML of a spec object.

Click to expand an example response for app.
{
  "value": {
    "app": {
      "id": "c2a93513-8d9b-4223-9d61-5e7272c81cf5",
      "owner_uuid": "a4e16f25-cdd1-4483-b246-d77f283c9209",
      "spec": {
        "name": "sample-golang",
        "services": [
          {
            "name": "web",
            "github": {
              "repo": "ChiefMateStarbuck/sample-golang",
              "branch": "main"
            },
            "run_command": "bin/sample-golang",
            "environment_slug": "go",
            "instance_size_slug": "apps-s-1vcpu-0.5gb",
            "instance_count": 1,
            "http_port": 8080,
            "routes": [
              {
                "path": "/"
              }
            ]
          }
        ],
        "region": "ams",
        "domains": [
          {
            "domain": "sample-golang.example.com",
            "zone": "example.com",
            "minimum_tls_version": "1.3"
          }
        ]
      },
      "default_ingress": "https://sample-golang-zyhgn.ondigitalocean.app",
      "created_at": "2021-02-10T16:45:14Z",
      "updated_at": "2021-02-10T17:06:56Z",
      "active_deployment": {
        "id": "991dfa59-6a23-459f-86d6-67dfa2c6f1e3",
        "spec": {
          "name": "sample-golang",
          "services": [
            {
              "name": "web",
              "github": {
                "repo": "ChiefMateStarbuck/sample-golang",
                "branch": "main"
              },
              "run_command": "bin/sample-golang",
              "environment_slug": "go",
              "instance_size_slug": "apps-s-1vcpu-0.5gb",
              "instance_count": 1,
              "http_port": 8080,
              "routes": [
                {
                  "path": "/"
                }
              ]
            }
          ],
          "region": "ams",
          "domains": [
            {
              "domain": "sample-golang.example.com",
              "zone": "example.com",
              "minimum_tls_version": "1.3"
            }
          ]
        },
        "services": [
          {
            "name": "web",
            "source_commit_hash": "db6936cb46047c576962962eed81ad52c21f35d7"
          }
        ],
        "phase_last_updated_at": "2021-02-10T17:06:53Z",
        "created_at": "2021-02-10T17:05:30Z",
        "updated_at": "2021-02-10T17:06:53Z",
        "cause": "manual",
        "progress": {
          "success_steps": 6,
          "total_steps": 6,
          "steps": [
            {
              "name": "build",
              "status": "SUCCESS",
              "steps": [
                {
                  "name": "initialize",
                  "status": "SUCCESS",
                  "started_at": "2021-02-10T17:05:35.572347485Z",
                  "ended_at": "2021-02-10T17:05:36.093995229Z"
                },
                {
                  "name": "components",
                  "status": "SUCCESS",
                  "steps": [
                    {
                      "name": "web",
                      "status": "SUCCESS",
                      "component_name": "web",
                      "message_base": "Building service"
                    }
                  ],
                  "started_at": "2021-02-10T17:05:36.094015928Z",
                  "ended_at": "2021-02-10T17:06:19.461737040Z"
                }
              ],
              "started_at": "2021-02-10T17:05:35.572287990Z",
              "ended_at": "2021-02-10T17:06:19.807834070Z"
            },
            {
              "name": "deploy",
              "status": "SUCCESS",
              "steps": [
                {
                  "name": "initialize",
                  "status": "SUCCESS",
                  "started_at": "2021-02-10T17:06:25.143957508Z",
                  "ended_at": "2021-02-10T17:06:26.120343872Z"
                },
                {
                  "name": "components",
                  "status": "SUCCESS",
                  "steps": [
                    {
                      "name": "web",
                      "status": "SUCCESS",
                      "steps": [
                        {
                          "name": "deploy",
                          "status": "SUCCESS",
                          "component_name": "web",
                          "message_base": "Deploying service"
                        },
                        {
                          "name": "wait",
                          "status": "SUCCESS",
                          "component_name": "web",
                          "message_base": "Waiting for service"
                        }
                      ],
                      "component_name": "web"
                    }
                  ],
                  "started_at": "2021-02-10T17:06:26.120385561Z",
                  "ended_at": "2021-02-10T17:06:50.029695913Z"
                },
                {
                  "name": "finalize",
                  "status": "SUCCESS",
                  "started_at": "2021-02-10T17:06:50.348459495Z",
                  "ended_at": "2021-02-10T17:06:53.404065961Z"
                }
              ],
              "started_at": "2021-02-10T17:06:25.143932418Z",
              "ended_at": "2021-02-10T17:06:53.404104185Z"
            }
          ]
        },
        "phase": "ACTIVE",
        "tier_slug": "basic"
      },
      "last_deployment_created_at": "2021-02-10T17:05:30Z",
      "live_url": "https://sample-golang-zyhgn.ondigitalocean.app",
      "pending_deployment": {
        "id": "3aa4d20e-5527-4c00-b496-601fbd22520a",
        "spec": {
          "name": "sample-php",
          "services": [
            {
              "name": "sample-php",
              "git": {
                "repo_clone_url": "https://github.com/digitalocean/sample-php.git",
                "branch": "main"
              },
              "run_command": "heroku-php-apache2",
              "environment_slug": "php",
              "instance_size_slug": "apps-s-1vcpu-0.5gb",
              "instance_count": 1,
              "http_port": 8080,
              "routes": [
                {
                  "path": "/"
                }
              ]
            }
          ],
          "region": "fra",
          "domains": [
            {
              "domain": "sample-php.example.com",
              "type": "PRIMARY",
              "zone": "example.com",
              "minimum_tls_version": "1.3"
            }
          ]
        }
      },
      "region": {
        "slug": "ams",
        "label": "Amsterdam",
        "flag": "netherlands",
        "continent": "Europe",
        "data_centers": [
          "ams3"
        ]
      },
      "tier_slug": "basic",
      "live_url_base": "https://sample-golang-zyhgn.ondigitalocean.app",
      "live_domain": "sample-golang-zyhgn.ondigitalocean.app",
      "project_id": "88b72d1a-b78a-4d9f-9090-b53c4399073f",
      "domains": [
        {
          "id": "e206c64e-a1a3-11ed-9e6e-9b7b6dc9a52b",
          "phase": "CONFIGURING",
          "spec": {
            "domain": "sample-golang.example.com",
            "type": "PRIMARY",
            "zone": "example.com",
            "minimum_tls_version": "1.3"
          },
          "rotate_validation_records": false,
          "certificate_expires_at": "2024-01-29T23:59:59Z",
          "progress": {
            "steps": [
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "default-ingress-ready",
                "started_at": "2023-01-30T22:15:45.021896292Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "ensure-zone",
                "started_at": "2023-01-30T22:15:45.022017004Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:42:28.50752065Z",
                "name": "ensure-ns-records",
                "started_at": "2023-01-30T22:15:45.025567874Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "verify-nameservers",
                "started_at": "2023-01-30T22:15:45.033591906Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "ensure-record",
                "started_at": "2023-01-30T22:15:45.156750604Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:43:30.258626422Z",
                "name": "ensure-alias-record",
                "started_at": "2023-01-30T22:15:45.165933869Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:43:30.258808279Z",
                "name": "ensure-wildcard-record",
                "started_at": "2023-01-30T22:15:45.166093422Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "verify-cname",
                "started_at": "2023-01-30T22:15:45.166205559Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:43:30.475903785Z",
                "name": "ensure-ssl-txt-record-saved",
                "started_at": "2023-01-30T22:15:45.295237186Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:43:30.476017236Z",
                "name": "ensure-ssl-txt-record",
                "started_at": "2023-01-30T22:15:45.295315291Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "2023-01-30T15:43:30.476094058Z",
                "name": "ensure-renewal-email",
                "started_at": "2023-01-30T22:15:45.295374087Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "ensure-CA-authorization",
                "started_at": "2023-01-30T22:15:45.295428101Z",
                "status": "SUCCESS"
              },
              {
                "ended_at": "0001-01-01T00:00:00Z",
                "name": "ensure-certificate",
                "started_at": "2023-01-30T22:15:45.978756406Z",
                "status": "RUNNING"
              },
              {
                "ended_at": "0001-01-01T00:00:00",
                "name": "create-deployment",
                "started_at": "0001-01-01T00:00:00Z",
                "status": "PENDING"
              },
              {
                "ended_at": "0001-01-01T00:00:00",
                "name": "configuration-alert",
                "started_at": "0001-01-01T00:00:00",
                "status": "PENDING"
              }
            ]
          }
        }
      ],
      "dedicated_ips": [
        {
          "ip": "192.168.1.1",
          "id": "c24d8f48-3bc4-49f5-8ca0-58e8164427ac",
          "status": "ASSIGNED"
        },
        {
          "ip": "192.168.1.2",
          "id": "4768fb15-2837-4dda-9be5-3951df4bc3d0",
          "status": "ASSIGNED"
        }
      ]
    }
  }
}

Unauthorized

Click to expand an example response.
{
  "id": "unauthorized",
  "message": "Unable to authenticate you."
}

API Rate limit exceeded

Click to expand an example response.
{
  "id": "too_many_requests",
  "message": "API Rate limit exceeded."
}

Server error.

Click to expand an example response.
{
  "id": "server_error",
  "message": "Unexpected server-side error"
}

Unexpected error

Click to expand an example response.
{
  "id": "example_error",
  "message": "some error message"
}