Skip to content
Start here

Get a container instance

client.containers.applications.instances.get(stringinstanceID, InstanceGetParams { account_id, application_id } params, RequestOptionsoptions?): InstanceGetResponse { id, application_id, image, 5 more }
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
instanceID: string

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

maxLength64
minLength64
params: InstanceGetParams { account_id, application_id }
account_id: string

Account identifier.

application_id: string

An Application ID represents an identifier of an application.

ReturnsExpand Collapse
InstanceGetResponse { id, application_id, image, 5 more }

The last-reported state of a logical container instance.

id: string

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

maxLength64
minLength64
application_id: string

An Application ID represents an identifier of an application.

image: string

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

status: Status { state, updated_at, exit_code }

The latest known status of a container instance.

state: "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: string

UTC timestamp string in ISO 8601 format.

exit_code?: number

The process exit code, when the runtime reports one.

configuration?: Configuration { disk, memory, vcpu }

The resources allocated to the container instance.

disk: number

Disk allocated to the container instance, in decimal MB.

minimum1
memory: number

Memory allocated to the container instance, in MiB.

minimum1
vcpu: number

Number of virtual CPUs allocated to the container instance.

exclusiveMinimum
minimum0
location?: Location { name, region }

The location of the instance’s current container placement.

name: string

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

region: string

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

name?: string

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

started_at?: string

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

Get a container instance

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const instance = await client.containers.applications.instances.get(
  'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  { account_id: 'account-123', application_id: 'application_id' },
);

console.log(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
}