Skip to content
Start here

Create account commands

POST/accounts/{account_id}/dex/commands

Initiate commands for up to 10 devices per account

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)
Cloudflare DEX Write
Path ParametersExpand Collapse
account_id: optional string
maxLength32
Body ParametersJSONExpand Collapse
commands: array of object { command_type, device_id, user_email, 2 more }

List of device-level commands to execute

command_type: "pcap" or "warp-diag"

Type of command to execute on the device

One of the following:
"pcap"
"warp-diag"
device_id: string

Unique identifier for the physical device

user_email: string

Email tied to the device

command_args: optional object { interfaces, "max-file-size-mb", "packet-size-bytes", 2 more }
interfaces: optional array of "default" or "tunnel"

List of interfaces to capture packets on

One of the following:
"default"
"tunnel"
"max-file-size-mb": optional number

Maximum file size (in MB) for the capture file. Specifies the maximum file size of the warp-diag zip artifact that can be uploaded. If the zip artifact exceeds the specified max file size, it will NOT be uploaded

minimum1
"packet-size-bytes": optional number

Maximum number of bytes to save for each packet

minimum1
"test-all-routes": optional boolean

Test an IP address from all included or excluded ranges. Tests an IP address from all included or excluded ranges. Essentially the same as running ‘route get ” and collecting the results. This option may increase the time taken to collect the warp-diag

"time-limit-min": optional number

Limit on capture duration (in minutes)

minimum1
registration_id: optional string

Unique identifier for the device registration. Required for multi-user devices to target the correct user session.

ReturnsExpand Collapse
errors: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of object { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
success: true

Whether the API call was successful.

result: optional object { commands }
commands: optional array of object { id, args, device_id, 3 more }

List of created commands

id: optional string

Unique identifier for the command

args: optional map[string]

Command arguments

device_id: optional string

Identifier for the device associated with the command

registration_id: optional string

Unique identifier for the device registration

status: optional "PENDING_EXEC" or "PENDING_UPLOAD" or "SUCCESS" or "FAILED"

Current status of the command

One of the following:
"PENDING_EXEC"
"PENDING_UPLOAD"
"SUCCESS"
"FAILED"
type: optional string

Type of the command (e.g., “pcap” or “warp-diag”)

result_info: optional object { count, page, per_page, 2 more }
count: optional number

Total number of results for the requested service.

page: optional number

Current page within paginated list of results.

per_page: optional number

Number of results per page of results.

total_count: optional number

Total results available without any search parameters.

total_pages: optional number

The number of total pages in the entire result set.

Create account commands

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/dex/commands \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "commands": [
            {
              "command_type": "pcap",
              "device_id": "device_id",
              "user_email": "user_email"
            }
          ]
        }'
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "commands": [
      {
        "id": "id",
        "args": {
          "foo": "string"
        },
        "device_id": "device_id",
        "registration_id": "registration_id",
        "status": "PENDING_EXEC",
        "type": "type"
      }
    ]
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}
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"
      }
    }
  ],
  "success": true,
  "result": {
    "commands": [
      {
        "id": "id",
        "args": {
          "foo": "string"
        },
        "device_id": "device_id",
        "registration_id": "registration_id",
        "status": "PENDING_EXEC",
        "type": "type"
      }
    ]
  },
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000,
    "total_pages": 100
  }
}