Skip to content
Start here

List packet capture requests

client.MagicTransit.PCAPs.List(ctx, query) (*SinglePage[PCAPListResponse], error)
GET/accounts/{account_id}/pcaps

Lists all packet capture requests for an 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)
Magic Firewall Packet Captures - Write PCAPs APIMagic Firewall Packet Captures - Read PCAPs API
ParametersExpand Collapse
query PCAPListParams
AccountID param.Field[string]

Identifier.

maxLength32
ReturnsExpand Collapse
type PCAPListResponse interface{…}
One of the following:
type PCAP struct{…}
ID stringoptional

The ID for the packet capture.

maxLength32
minLength32
FilterV1 PCAPFilteroptional

The packet capture filter. When this field is empty, all packets are captured.

DestinationAddress stringoptional

The destination IP address of the packet.

DestinationPort float64optional

The destination port of the packet.

Protocol float64optional

The protocol number of the packet.

SourceAddress stringoptional

The source IP address of the packet.

SourcePort float64optional

The source port of the packet.

OffsetTime Timeoptional

The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request.

formatdate-time
Status PCAPStatusoptional

The status of the packet capture request.

One of the following:
const PCAPStatusUnknown PCAPStatus = "unknown"
const PCAPStatusSuccess PCAPStatus = "success"
const PCAPStatusPending PCAPStatus = "pending"
const PCAPStatusRunning PCAPStatus = "running"
const PCAPStatusConversionPending PCAPStatus = "conversion_pending"
const PCAPStatusConversionRunning PCAPStatus = "conversion_running"
const PCAPStatusComplete PCAPStatus = "complete"
const PCAPStatusFailed PCAPStatus = "failed"
Submitted stringoptional

The RFC 3339 timestamp when the packet capture was created.

System PCAPSystemoptional

The system used to collect packet captures.

TimeLimit float64optional

The packet capture duration in seconds.

maximum300
minimum1
Type PCAPTypeoptional

The type of packet capture. Simple captures sampled packets, and full captures entire payloads and non-sampled packets.

One of the following:
const PCAPTypeSimple PCAPType = "simple"
const PCAPTypeFull PCAPType = "full"
type PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFull struct{…}
ID stringoptional

The ID for the packet capture.

maxLength32
minLength32
ByteLimit float64optional

The maximum number of bytes to capture. This field only applies to full packet captures.

maximum1000000000
minimum1
ColoName stringoptional

The name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to full packet captures.

DestinationConf stringoptional

The full URI for the bucket. This field only applies to full packet captures.

ErrorMessage stringoptional

An error message that describes why the packet capture failed. This field only applies to full packet captures.

FilterV1 PCAPFilteroptional

The packet capture filter. When this field is empty, all packets are captured.

DestinationAddress stringoptional

The destination IP address of the packet.

DestinationPort float64optional

The destination port of the packet.

Protocol float64optional

The protocol number of the packet.

SourceAddress stringoptional

The source IP address of the packet.

SourcePort float64optional

The source port of the packet.

PacketsCaptured int64optional

The number of packets captured.

Status PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusoptional

The status of the packet capture request.

One of the following:
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusUnknown PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "unknown"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusSuccess PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "success"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusPending PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "pending"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusRunning PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "running"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionPending PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_pending"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusConversionRunning PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "conversion_running"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusComplete PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "complete"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatusFailed PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullStatus = "failed"
StopRequested Timeoptional

The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to full packet captures.

formatdate-time
Submitted stringoptional

The RFC 3339 timestamp when the packet capture was created.

System PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullSystemoptional

The system used to collect packet captures.

TimeLimit float64optional

The packet capture duration in seconds.

maximum86400
minimum1
Type PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullTypeoptional

The type of packet capture. Simple captures sampled packets, and full captures entire payloads and non-sampled packets.

One of the following:
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullTypeSimple PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullType = "simple"
const PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullTypeFull PCAPListResponseMagicVisibilityPCAPsPCAPsResponseFullType = "full"

List packet capture requests

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.MagicTransit.PCAPs.List(context.TODO(), magic_transit.PCAPListParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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": "66802ca5668e47a2b82c2e6746e45037",
      "filter_v1": {
        "destination_address": "1.2.3.4",
        "destination_port": 80,
        "protocol": 6,
        "source_address": "1.2.3.4",
        "source_port": 123
      },
      "offset_time": "2020-01-01T08:00:00Z",
      "status": "success",
      "submitted": "2020-01-01T08:00:00Z",
      "system": "magic-transit",
      "time_limit": 300,
      "type": "simple"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}
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": "66802ca5668e47a2b82c2e6746e45037",
      "filter_v1": {
        "destination_address": "1.2.3.4",
        "destination_port": 80,
        "protocol": 6,
        "source_address": "1.2.3.4",
        "source_port": 123
      },
      "offset_time": "2020-01-01T08:00:00Z",
      "status": "success",
      "submitted": "2020-01-01T08:00:00Z",
      "system": "magic-transit",
      "time_limit": 300,
      "type": "simple"
    }
  ],
  "success": true,
  "result_info": {
    "count": 1,
    "page": 1,
    "per_page": 20,
    "total_count": 2000
  }
}