Skip to content
Start here

Get logs and status from instance

client.Workflows.Instances.Get(ctx, workflowName, instanceID, params) (*InstanceGetResponse, error)
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
AccountID param.Field[string]

Path param

Order param.Field[InstanceGetParamsOrder]optional

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

const InstanceGetParamsOrderAsc InstanceGetParamsOrder = "asc"
const InstanceGetParamsOrderDesc InstanceGetParamsOrder = "desc"
Simple param.Field[InstanceGetParamsSimple]optional

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

const InstanceGetParamsSimpleTrue InstanceGetParamsSimple = "true"
const InstanceGetParamsSimpleFalse InstanceGetParamsSimple = "false"
ReturnsExpand Collapse
type InstanceGetResponse struct{…}
End Time
formatdate-time
Error InstanceGetResponseError
Message string
Name string
Output InstanceGetResponseOutputUnion
One of the following:
UnionString
UnionFloat
Params unknown
Queued Time
formatdate-time
Start Time
formatdate-time
Status InstanceGetResponseStatus
One of the following:
const InstanceGetResponseStatusQueued InstanceGetResponseStatus = "queued"
const InstanceGetResponseStatusRunning InstanceGetResponseStatus = "running"
const InstanceGetResponseStatusPaused InstanceGetResponseStatus = "paused"
const InstanceGetResponseStatusErrored InstanceGetResponseStatus = "errored"
const InstanceGetResponseStatusTerminated InstanceGetResponseStatus = "terminated"
const InstanceGetResponseStatusComplete InstanceGetResponseStatus = "complete"
const InstanceGetResponseStatusWaitingForPause InstanceGetResponseStatus = "waitingForPause"
const InstanceGetResponseStatusWaiting InstanceGetResponseStatus = "waiting"
StepCount int64
Steps []InstanceGetResponseStep
One of the following:
type InstanceGetResponseStepsObject struct{…}
Attempts []InstanceGetResponseStepsObjectAttempt
End Time
formatdate-time
Error InstanceGetResponseStepsObjectAttemptsError
Message string
Name string
Start Time
formatdate-time
Success bool
Config InstanceGetResponseStepsObjectConfig
Retries InstanceGetResponseStepsObjectConfigRetries
Delay InstanceGetResponseStepsObjectConfigRetriesDelayUnion

Specifies the delay duration.

One of the following:
UnionString
UnionFloat
Limit float64
Backoff InstanceGetResponseStepsObjectConfigRetriesBackoffoptional
One of the following:
const InstanceGetResponseStepsObjectConfigRetriesBackoffConstant InstanceGetResponseStepsObjectConfigRetriesBackoff = "constant"
const InstanceGetResponseStepsObjectConfigRetriesBackoffLinear InstanceGetResponseStepsObjectConfigRetriesBackoff = "linear"
const InstanceGetResponseStepsObjectConfigRetriesBackoffExponential InstanceGetResponseStepsObjectConfigRetriesBackoff = "exponential"
Timeout InstanceGetResponseStepsObjectConfigTimeoutUnion

Specifies the timeout duration.

One of the following:
UnionString
UnionFloat
End Time
formatdate-time
Name string
Output string
Start Time
formatdate-time
Success bool
Type InstanceGetResponseStepsObjectType
type InstanceGetResponseStepsObject struct{…}
End Time
formatdate-time
Error InstanceGetResponseStepsObjectError
Message string
Name string
Finished bool
Name string
Start Time
formatdate-time
Type InstanceGetResponseStepsObjectType
type InstanceGetResponseStepsObject struct{…}
Trigger InstanceGetResponseStepsObjectTrigger
Source string
Type InstanceGetResponseStepsObjectType
type InstanceGetResponseStepsObject struct{…}
End Time
formatdate-time
Error InstanceGetResponseStepsObjectError
Message string
Name string
Finished bool
Name string
Start Time
formatdate-time
Type InstanceGetResponseStepsObjectType
Output stringoptional
Success bool
Trigger InstanceGetResponseTrigger
Source InstanceGetResponseTriggerSource
One of the following:
const InstanceGetResponseTriggerSourceUnknown InstanceGetResponseTriggerSource = "unknown"
const InstanceGetResponseTriggerSourceAPI InstanceGetResponseTriggerSource = "api"
const InstanceGetResponseTriggerSourceBinding InstanceGetResponseTriggerSource = "binding"
const InstanceGetResponseTriggerSourceEvent InstanceGetResponseTriggerSource = "event"
const InstanceGetResponseTriggerSourceCron InstanceGetResponseTriggerSource = "cron"
VersionID string
formatuuid

Get logs and status from instance

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"),
  )
  instance, err := client.Workflows.Instances.Get(
    context.TODO(),
    "x",
    "x",
    workflows.InstanceGetParams{
      AccountID: cloudflare.F("account_id"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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
  }
}