Skip to content
Start here

List of workflow instances

client.Workflows.Instances.List(ctx, workflowName, params) (*V4PagePaginationArray[InstanceListResponse], error)
GET/accounts/{account_id}/workflows/{workflow_name}/instances

Lists all instances of a workflow with their execution status.

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
params InstanceListParams
AccountID param.Field[string]

Path param

Cursor param.Field[string]optional

Query param: page and cursor are mutually exclusive, use one or the other.

DateEnd param.Field[Time]optional

Query param: Accepts ISO 8601 with no timezone offsets and in UTC.

formatdate-time
DateStart param.Field[Time]optional

Query param: Accepts ISO 8601 with no timezone offsets and in UTC.

formatdate-time
Direction param.Field[InstanceListParamsDirection]optional

Query param: should only be used when cursor is used, defines a new direction for the cursor

const InstanceListParamsDirectionAsc InstanceListParamsDirection = "asc"
const InstanceListParamsDirectionDesc InstanceListParamsDirection = "desc"
Page param.Field[float64]optional

Query param: page and cursor are mutually exclusive, use one or the other.

minimum1
PerPage param.Field[float64]optional

Query param

maximum100
minimum1
Status param.Field[InstanceListParamsStatus]optional

Query param

const InstanceListParamsStatusQueued InstanceListParamsStatus = "queued"
const InstanceListParamsStatusRunning InstanceListParamsStatus = "running"
const InstanceListParamsStatusPaused InstanceListParamsStatus = "paused"
const InstanceListParamsStatusErrored InstanceListParamsStatus = "errored"
const InstanceListParamsStatusTerminated InstanceListParamsStatus = "terminated"
const InstanceListParamsStatusComplete InstanceListParamsStatus = "complete"
const InstanceListParamsStatusWaitingForPause InstanceListParamsStatus = "waitingForPause"
const InstanceListParamsStatusWaiting InstanceListParamsStatus = "waiting"
ReturnsExpand Collapse
type InstanceListResponse struct{…}
ID string
maxLength100
minLength1
CreatedOn Time
formatdate-time
EndedOn Time
formatdate-time
ModifiedOn Time
formatdate-time
StartedOn Time
formatdate-time
Status InstanceListResponseStatus
One of the following:
const InstanceListResponseStatusQueued InstanceListResponseStatus = "queued"
const InstanceListResponseStatusRunning InstanceListResponseStatus = "running"
const InstanceListResponseStatusPaused InstanceListResponseStatus = "paused"
const InstanceListResponseStatusErrored InstanceListResponseStatus = "errored"
const InstanceListResponseStatusTerminated InstanceListResponseStatus = "terminated"
const InstanceListResponseStatusComplete InstanceListResponseStatus = "complete"
const InstanceListResponseStatusWaitingForPause InstanceListResponseStatus = "waitingForPause"
const InstanceListResponseStatusWaiting InstanceListResponseStatus = "waiting"
VersionID string
formatuuid
WorkflowID string
formatuuid

List of workflow instances

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/workflows"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.Workflows.Instances.List(
    context.TODO(),
    "x",
    workflows.InstanceListParams{
      AccountID: cloudflare.F("account_id"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "result": [
    {
      "id": "x",
      "created_on": "2019-12-27T18:11:19.117Z",
      "ended_on": "2019-12-27T18:11:19.117Z",
      "modified_on": "2019-12-27T18:11:19.117Z",
      "started_on": "2019-12-27T18:11:19.117Z",
      "status": "queued",
      "version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "workflow_id": "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": [
    {
      "id": "x",
      "created_on": "2019-12-27T18:11:19.117Z",
      "ended_on": "2019-12-27T18:11:19.117Z",
      "modified_on": "2019-12-27T18:11:19.117Z",
      "started_on": "2019-12-27T18:11:19.117Z",
      "status": "queued",
      "version_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "workflow_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
    }
  ],
  "success": true,
  "result_info": {
    "count": 0,
    "per_page": 0,
    "total_count": 0,
    "cursor": "cursor",
    "page": 0
  }
}