Skip to content
Start here

Get URL scan's HAR

client.URLScanner.Scans.HAR(ctx, scanID, query) (*ScanHARResponse, error)
GET/accounts/{account_id}/urlscanner/v2/har/{scan_id}

Get a URL scan's HAR file. See HAR spec at http://www.softwareishard.com/blog/har-12-spec/.

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)
URL Scanner WriteURL Scanner Read
ParametersExpand Collapse
scanID string

Scan UUID.

formatuuid
query ScanHARParams
AccountID param.Field[string]

Account ID.

ReturnsExpand Collapse
type ScanHARResponse struct{…}
Log ScanHARResponseLog
Creator ScanHARResponseLogCreator
Comment string
Name string
Version string
Entries []ScanHARResponseLogEntry
InitialPriority string
InitiatorType string
Priority string
RequestID string
RequestTime float64
ResourceType string
Cache unknown
Connection string
Pageref string
Request ScanHARResponseLogEntriesRequest
BodySize float64
Headers []ScanHARResponseLogEntriesRequestHeader
Name string
Value string
HeadersSize float64
HTTPVersion string
Method string
URL string
Response ScanHARResponseLogEntriesResponse
TransferSize float64
BodySize float64
Content ScanHARResponseLogEntriesResponseContent
MimeType string
Size float64
Compression int64optional
Headers []ScanHARResponseLogEntriesResponseHeader
Name string
Value string
HeadersSize float64
HTTPVersion string
RedirectURL string
Status float64
StatusText string
ServerIPAddress string
StartedDateTime string
Time float64
Pages []ScanHARResponseLogPage
ID string
PageTimings ScanHARResponseLogPagesPageTimings
OnContentLoad float64
OnLoad float64
StartedDateTime string
Title string
Version string

Get URL scan's HAR

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.URLScanner.Scans.HAR(
    context.TODO(),
    "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    url_scanner.ScanHARParams{
      AccountID: cloudflare.F("account_id"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Log)
}
{
  "log": {
    "creator": {
      "comment": "https://github.com/sitespeedio/chrome-har",
      "name": "chrome-har",
      "version": "0.13.1"
    },
    "entries": [
      {
        "_initialPriority": "VeryHigh",
        "_initiator_type": "other",
        "_priority": "VeryHigh",
        "_requestId": "DDC779F0CB3746BAF283EC1A51B0F2F8",
        "_requestTime": 114135.331081,
        "_resourceType": "document",
        "cache": {},
        "connection": "33",
        "pageref": "page_1",
        "request": {
          "bodySize": 0,
          "headers": [
            {
              "name": "Upgrade-Insecure-Requests",
              "value": "1"
            }
          ],
          "headersSize": 197,
          "httpVersion": "http/1.1",
          "method": "GET",
          "url": "http://example.com/"
        },
        "response": {
          "_transferSize": 1071,
          "bodySize": 648,
          "content": {
            "mimeType": "text/html",
            "size": 1256,
            "compression": 608
          },
          "headers": [
            {
              "name": "Content-Encoding",
              "value": "gzip"
            }
          ],
          "headersSize": 423,
          "httpVersion": "http/1.1",
          "redirectURL": "redirectURL",
          "status": 200,
          "statusText": "OK"
        },
        "serverIPAddress": "2606:2800:220:1:248:1893:25c8:1946",
        "startedDateTime": "2023-05-03T17:05:13.196Z",
        "time": 268.64
      }
    ],
    "pages": [
      {
        "id": "page_1",
        "pageTimings": {
          "onContentLoad": 305.408,
          "onLoad": 305.169
        },
        "startedDateTime": "2023-05-03T17:05:13.195Z",
        "title": "http://example.com/"
      }
    ],
    "version": "1.2"
  }
}
Returns Examples
{
  "log": {
    "creator": {
      "comment": "https://github.com/sitespeedio/chrome-har",
      "name": "chrome-har",
      "version": "0.13.1"
    },
    "entries": [
      {
        "_initialPriority": "VeryHigh",
        "_initiator_type": "other",
        "_priority": "VeryHigh",
        "_requestId": "DDC779F0CB3746BAF283EC1A51B0F2F8",
        "_requestTime": 114135.331081,
        "_resourceType": "document",
        "cache": {},
        "connection": "33",
        "pageref": "page_1",
        "request": {
          "bodySize": 0,
          "headers": [
            {
              "name": "Upgrade-Insecure-Requests",
              "value": "1"
            }
          ],
          "headersSize": 197,
          "httpVersion": "http/1.1",
          "method": "GET",
          "url": "http://example.com/"
        },
        "response": {
          "_transferSize": 1071,
          "bodySize": 648,
          "content": {
            "mimeType": "text/html",
            "size": 1256,
            "compression": 608
          },
          "headers": [
            {
              "name": "Content-Encoding",
              "value": "gzip"
            }
          ],
          "headersSize": 423,
          "httpVersion": "http/1.1",
          "redirectURL": "redirectURL",
          "status": 200,
          "statusText": "OK"
        },
        "serverIPAddress": "2606:2800:220:1:248:1893:25c8:1946",
        "startedDateTime": "2023-05-03T17:05:13.196Z",
        "time": 268.64
      }
    ],
    "pages": [
      {
        "id": "page_1",
        "pageTimings": {
          "onContentLoad": 305.408,
          "onLoad": 305.169
        },
        "startedDateTime": "2023-05-03T17:05:13.195Z",
        "title": "http://example.com/"
      }
    ],
    "version": "1.2"
  }
}