Skip to content
Start here

Get a container instance

containers.applications.instances.get(strinstance_id, InstanceGetParams**kwargs) -> InstanceGetResponse
GET/accounts/{account_id}/containers/applications/{application_id}/instances/{instance_id}

Returns a container instance belonging to an application.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers Containers WriteWorkers Containers Read
ParametersExpand Collapse
account_id: str
application_id: str

An Application ID represents an identifier of an application.

instance_id: str

A container instance ID (64-character hex Durable Object actor ID).

maxLength64
minLength64
ReturnsExpand Collapse
class InstanceGetResponse: …

The last-reported state of a logical container instance.

id: str

A container instance ID (64-character hex Durable Object actor ID).

maxLength64
minLength64
application_id: str

An Application ID represents an identifier of an application.

image: str

The image for the current container placement, when one is available.

status: Status

The latest known status of a container instance.

state: Literal["provisioning", "running", "failed", 5 more]

The current lifecycle state of a container instance.

One of the following:
"provisioning"
"running"
"failed"
"stopping"
"stopped"
"unhealthy"
"inactive"
"unknown"
updated_at: str

UTC timestamp string in ISO 8601 format.

exit_code: Optional[int]

The process exit code, when the runtime reports one.

configuration: Optional[Configuration]

The resources allocated to the container instance.

disk: int

Disk allocated to the container instance, in decimal MB.

minimum1
memory: int

Memory allocated to the container instance, in MiB.

minimum1
vcpu: float

Number of virtual CPUs allocated to the container instance.

exclusiveMinimum
minimum0
location: Optional[Location]

The location of the instance’s current container placement.

name: str

Unique location code used to identify locations on a logical level.

region: str

Represents a group of datacenters. Choose one of “AFR”, “APAC”, “EEUR”, “ENAM”, “WNAM”, “ME”, “OC”, “SAM”, or “WEUR”.

name: Optional[str]

The customer-provided instance name, when available. Its UTF-8 encoding uses at most 1,024 bytes.

started_at: Optional[str]

The time at which the current container placement started, when one exists.

Get a container instance

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
instance = client.containers.applications.instances.get(
    instance_id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    account_id="account-123",
    application_id="application_id",
)
print(instance.id)
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "application_id": "application_id",
    "image": "image",
    "status": {
      "state": "provisioning",
      "updated_at": "2021-04-01T12:32:41.488Z",
      "exit_code": 0
    },
    "configuration": {
      "disk": 1,
      "memory": 1,
      "vcpu": 1
    },
    "location": {
      "name": "name",
      "region": "WNAM"
    },
    "name": "name",
    "started_at": "2021-04-01T12:32:41.488Z"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "application_id": "application_id",
    "image": "image",
    "status": {
      "state": "provisioning",
      "updated_at": "2021-04-01T12:32:41.488Z",
      "exit_code": 0
    },
    "configuration": {
      "disk": 1,
      "memory": 1,
      "vcpu": 1
    },
    "location": {
      "name": "name",
      "region": "WNAM"
    },
    "name": "name",
    "started_at": "2021-04-01T12:32:41.488Z"
  },
  "success": true
}