# PCAPs ## List packet capture requests `client.magicTransit.pcaps.list(PCAPListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/pcaps` Lists all packet capture requests for an account. ### Parameters - `params: PCAPListParams` - `account_id: string` Identifier. ### Returns - `PCAPListResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const pcapListResponse of client.magicTransit.pcaps.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(pcapListResponse); } ``` #### Response ```json { "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 } } ``` ## Get PCAP request `client.magicTransit.pcaps.get(stringpcapId, PCAPGetParamsparams, RequestOptionsoptions?): PCAPGetResponse` **get** `/accounts/{account_id}/pcaps/{pcap_id}` Get information for a PCAP request by id. ### Parameters - `pcapId: string` Identifier. - `params: PCAPGetParams` - `account_id: string` Identifier. ### Returns - `PCAPGetResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const pcap = await client.magicTransit.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(pcap); ``` #### Response ```json { "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 } ``` ## Create PCAP request `client.magicTransit.pcaps.create(PCAPCreateParamsparams, RequestOptionsoptions?): PCAPCreateResponse` **post** `/accounts/{account_id}/pcaps` Create new PCAP request for account. ### Parameters - `PCAPCreateParams = MagicVisibilityPCAPsPCAPsRequestSimple | MagicVisibilityPCAPsPCAPsRequestFull` - `PCAPCreateParamsBase` - `MagicVisibilityPCAPsPCAPsRequestSimple extends PCAPCreateParamsBase` - `MagicVisibilityPCAPsPCAPsRequestFull extends PCAPCreateParamsBase` ### Returns - `PCAPCreateResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const pcap = await client.magicTransit.pcaps.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', packet_limit: 10000, system: 'magic-transit', time_limit: 300, type: 'simple', }); console.log(pcap); ``` #### Response ```json { "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 } ``` ## Stop full PCAP `client.magicTransit.pcaps.stop(stringpcapId, PCAPStopParamsparams, RequestOptionsoptions?): void` **put** `/accounts/{account_id}/pcaps/{pcap_id}/stop` Stop full PCAP. ### Parameters - `pcapId: string` Identifier. - `params: PCAPStopParams` - `account_id: string` Identifier. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); await client.magicTransit.pcaps.stop('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); ``` ## Domain Types ### PCAP - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Filter - `PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. ### PCAP List Response - `PCAPListResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Get Response - `PCAPGetResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` ### PCAP Create Response - `PCAPCreateResponse = PCAP | MagicVisibilityPCAPsPCAPsResponseFull` - `PCAP` - `id?: string` The ID for the packet capture. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `destination_address?: string` The destination IP address of the packet. - `destination_port?: number` The destination port of the packet. - `protocol?: number` The protocol number of the packet. - `source_address?: string` The source IP address of the packet. - `source_port?: number` The source port of the packet. - `offset_time?: string` 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. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` - `MagicVisibilityPCAPsPCAPsResponseFull` - `id?: string` The ID for the packet capture. - `byte_limit?: number` The maximum number of bytes to capture. This field only applies to `full` packet captures. - `colo_name?: string` 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. - `destination_conf?: string` The full URI for the bucket. This field only applies to `full` packet captures. - `error_message?: string` An error message that describes why the packet capture failed. This field only applies to `full` packet captures. - `filter_v1?: PCAPFilter` The packet capture filter. When this field is empty, all packets are captured. - `packets_captured?: number` The number of packets captured. - `status?: "unknown" | "success" | "pending" | 5 more` The status of the packet capture request. - `"unknown"` - `"success"` - `"pending"` - `"running"` - `"conversion_pending"` - `"conversion_running"` - `"complete"` - `"failed"` - `stop_requested?: string` The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to `full` packet captures. - `submitted?: string` The RFC 3339 timestamp when the packet capture was created. - `system?: "magic-transit"` The system used to collect packet captures. - `"magic-transit"` - `time_limit?: number` The packet capture duration in seconds. - `type?: "simple" | "full"` The type of packet capture. `Simple` captures sampled packets, and `full` captures entire payloads and non-sampled packets. - `"simple"` - `"full"` # Ownership ## List PCAPs Bucket Ownership `client.magicTransit.pcaps.ownership.get(OwnershipGetParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/pcaps/ownership` List all buckets configured for use with PCAPs API. ### Parameters - `params: OwnershipGetParams` - `account_id: string` Identifier. ### Returns - `Ownership` - `id: string` The bucket ID associated with the packet captures API. - `destination_conf: string` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: string` The ownership challenge filename stored in the bucket. - `status: "pending" | "success" | "failed"` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated?: string` The RFC 3339 timestamp when the bucket was validated. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const ownership of client.magicTransit.pcaps.ownership.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(ownership.id); } ``` #### Response ```json { "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": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Add buckets for full packet captures `client.magicTransit.pcaps.ownership.create(OwnershipCreateParamsparams, RequestOptionsoptions?): Ownership` **post** `/accounts/{account_id}/pcaps/ownership` Adds an AWS or GCP bucket to use with full packet captures. ### Parameters - `params: OwnershipCreateParams` - `account_id: string` Path param: Identifier. - `destination_conf: string` Body param: The full URI for the bucket. This field only applies to `full` packet captures. ### Returns - `Ownership` - `id: string` The bucket ID associated with the packet captures API. - `destination_conf: string` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: string` The ownership challenge filename stored in the bucket. - `status: "pending" | "success" | "failed"` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated?: string` The RFC 3339 timestamp when the bucket was validated. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const ownership = await client.magicTransit.pcaps.ownership.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', }); console.log(ownership.id); ``` #### Response ```json { "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": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Delete buckets for full packet captures `client.magicTransit.pcaps.ownership.delete(stringownershipId, OwnershipDeleteParamsparams, RequestOptionsoptions?): void` **delete** `/accounts/{account_id}/pcaps/ownership/{ownership_id}` Deletes buckets added to the packet captures API. ### Parameters - `ownershipId: string` Identifier. - `params: OwnershipDeleteParams` - `account_id: string` Identifier. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); await client.magicTransit.pcaps.ownership.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); ``` ## Validate buckets for full packet captures `client.magicTransit.pcaps.ownership.validate(OwnershipValidateParamsparams, RequestOptionsoptions?): Ownership` **post** `/accounts/{account_id}/pcaps/ownership/validate` Validates buckets added to the packet captures API. ### Parameters - `params: OwnershipValidateParams` - `account_id: string` Path param: Identifier. - `destination_conf: string` Body param: The full URI for the bucket. This field only applies to `full` packet captures. - `ownership_challenge: string` Body param: The ownership challenge filename stored in the bucket. ### Returns - `Ownership` - `id: string` The bucket ID associated with the packet captures API. - `destination_conf: string` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: string` The ownership challenge filename stored in the bucket. - `status: "pending" | "success" | "failed"` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated?: string` The RFC 3339 timestamp when the bucket was validated. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const ownership = await client.magicTransit.pcaps.ownership.validate({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', ownership_challenge: 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt', }); console.log(ownership.id); ``` #### Response ```json { "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": "9883874ecac311ec8475433579a6bf5f", "destination_conf": "s3://pcaps-bucket?region=us-east-1", "filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt", "status": "success", "submitted": "2020-01-01T08:00:00Z", "validated": "2020-01-01T08:00:00Z" }, "success": true } ``` ## Domain Types ### Ownership - `Ownership` - `id: string` The bucket ID associated with the packet captures API. - `destination_conf: string` The full URI for the bucket. This field only applies to `full` packet captures. - `filename: string` The ownership challenge filename stored in the bucket. - `status: "pending" | "success" | "failed"` The status of the ownership challenge. Can be pending, success or failed. - `"pending"` - `"success"` - `"failed"` - `submitted: string` The RFC 3339 timestamp when the bucket was added to packet captures API. - `validated?: string` The RFC 3339 timestamp when the bucket was validated. # Download ## Download Simple PCAP `client.magicTransit.pcaps.download.get(stringpcapId, DownloadGetParamsparams, RequestOptionsoptions?): Response` **get** `/accounts/{account_id}/pcaps/{pcap_id}/download` Download PCAP information into a file. Response is a binary PCAP file. ### Parameters - `pcapId: string` Identifier. - `params: DownloadGetParams` - `account_id: string` Identifier. ### Returns - `unnamed_schema_4 = Response` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const download = await client.magicTransit.pcaps.download.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(download); const content = await download.blob(); console.log(content); ```