Skip to content
Start here

Get logs and status from instance

client.workflows.instances.get(stringworkflowName, stringinstanceId, InstanceGetParams { account_id, order, simple } params, RequestOptionsoptions?): InstanceGetResponse { end, error, output, 9 more }
GET/accounts/{account_id}/workflows/{workflow_name}/instances/{instance_id}

Retrieves logs and execution status for a specific workflow instance.

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 Tail ReadWorkers Scripts WriteWorkers Scripts Read
ParametersExpand Collapse
workflowName: string
maxLength64
minLength1
instanceId: string
maxLength100
minLength1
params: InstanceGetParams { account_id, order, simple }
account_id: string

Path param

order?: "asc" | "desc"

Query param: Step ordering: "asc" (default, oldest first) or "desc" (newest first).

One of the following:
"asc"
"desc"
simple?: "true" | "false"

Query param: When true, omits step details and returns only metadata with step_count.

One of the following:
"true"
"false"
ReturnsExpand Collapse
InstanceGetResponse { end, error, output, 9 more }
end: string | null
formatdate-time
error: Error | null
message: string
name: string
output: string | number
One of the following:
string
number
params: unknown
queued: string
formatdate-time
start: string | null
formatdate-time
status: "queued" | "running" | "paused" | 5 more
One of the following:
"queued"
"running"
"paused"
"errored"
"terminated"
"complete"
"waitingForPause"
"waiting"
step_count: number
steps: Array<UnionMember0 { attempts, config, end, 5 more } | UnionMember1 { end, error, finished, 3 more } | UnionMember2 { trigger, type } | UnionMember3 { end, error, finished, 4 more } >
One of the following:
UnionMember0 { attempts, config, end, 5 more }
attempts: Array<Attempt>
end: string | null
formatdate-time
error: Error | null
message: string
name: string
start: string
formatdate-time
success: boolean | null
config: Config { retries, timeout }
retries: Retries { delay, limit, backoff }
delay: string | number

Specifies the delay duration.

One of the following:
string
number
limit: number
backoff?: "constant" | "linear" | "exponential"
One of the following:
"constant"
"linear"
"exponential"
timeout: string | number

Specifies the timeout duration.

One of the following:
string
number
end: string | null
formatdate-time
name: string
output: string | null
start: string
formatdate-time
success: boolean | null
type: "step"
UnionMember1 { end, error, finished, 3 more }
end: string
formatdate-time
error: Error | null
message: string
name: string
finished: boolean
name: string
start: string
formatdate-time
type: "sleep"
UnionMember2 { trigger, type }
trigger: Trigger { source }
source: string
type: "termination"
UnionMember3 { end, error, finished, 4 more }
end: string
formatdate-time
error: Error | null
message: string
name: string
finished: boolean
name: string
start: string
formatdate-time
type: "waitForEvent"
output?: string
success: boolean | null
trigger: Trigger { source }
source: "unknown" | "api" | "binding" | 2 more
One of the following:
"unknown"
"api"
"binding"
"event"
"cron"
versionId: string
formatuuid

Get logs and status from 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.workflows.instances.get('x', 'x', { account_id: 'account_id' });

console.log(instance.end);
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "end": "2019-12-27T18:11:19.117Z",
    "error": {
      "message": "message",
      "name": "name"
    },
    "output": "string",
    "params": {},
    "queued": "2019-12-27T18:11:19.117Z",
    "start": "2019-12-27T18:11:19.117Z",
    "status": "queued",
    "step_count": 0,
    "steps": [
      {
        "attempts": [
          {
            "end": "2019-12-27T18:11:19.117Z",
            "error": {
              "message": "message",
              "name": "name"
            },
            "start": "2019-12-27T18:11:19.117Z",
            "success": true
          }
        ],
        "config": {
          "retries": {
            "delay": "string",
            "limit": 0,
            "backoff": "constant"
          },
          "timeout": "string"
        },
        "end": "2019-12-27T18:11:19.117Z",
        "name": "name",
        "output": "output",
        "start": "2019-12-27T18:11:19.117Z",
        "success": true,
        "type": "step"
      }
    ],
    "success": true,
    "trigger": {
      "source": "unknown"
    },
    "versionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": {
    "end": "2019-12-27T18:11:19.117Z",
    "error": {
      "message": "message",
      "name": "name"
    },
    "output": "string",
    "params": {},
    "queued": "2019-12-27T18:11:19.117Z",
    "start": "2019-12-27T18:11:19.117Z",
    "status": "queued",
    "step_count": 0,
    "steps": [
      {
        "attempts": [
          {
            "end": "2019-12-27T18:11:19.117Z",
            "error": {
              "message": "message",
              "name": "name"
            },
            "start": "2019-12-27T18:11:19.117Z",
            "success": true
          }
        ],
        "config": {
          "retries": {
            "delay": "string",
            "limit": 0,
            "backoff": "constant"
          },
          "timeout": "string"
        },
        "end": "2019-12-27T18:11:19.117Z",
        "name": "name",
        "output": "output",
        "start": "2019-12-27T18:11:19.117Z",
        "success": true,
        "type": "step"
      }
    ],
    "success": true,
    "trigger": {
      "source": "unknown"
    },
    "versionId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
  },
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}