---
title: Request Trace
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Rules Trace](https://developers.cloudflare.com/api/go/resources/request_tracers)

[Traces](https://developers.cloudflare.com/api/go/resources/request_tracers/subresources/traces)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Request Trace

client.RequestTracers.Traces.New(ctx, params) (\*[TraceNewResponse](<https://developers.cloudflare.com/api/go/resources/request_tracers#(resource)%20request_tracers.traces%20%3E%20(model)%20TraceNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/request-tracer/trace

Traces a simulated HTTP request through Cloudflare’s edge to analyze how rules, settings, and configurations would process the request. Useful for debugging firewall rules, page rules, and other request transformations without sending actual traffic. Supports custom headers, cookies, body content, and geolocation context.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Allow Request Tracer Read`

##### ParametersExpand Collapse

<details>

<summary>

params TraceNewParams

</summary>

AccountID param.Field\[string]

Path param: Identifier.

maxLength32

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

Method param.Field\[string]

Body param: HTTP Method of tracing request

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20method">Link to this property</a>

URL param.Field\[string]

Body param: URL to which perform tracing request

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20url">Link to this property</a>

<details>

<summary>

Body param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/request_tracers/subresources/traces/methods/create#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20body%20%3E%20(schema)">TraceNewParamsBody</a>]Optional

Body param

</summary>

Base64 stringOptional

Base64 encoded request body

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20body%20%3E%20(schema)%20%3E%20(property)%20base64">Link to this property</a>

Json unknownOptional

Arbitrary json as request body

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20body%20%3E%20(schema)%20%3E%20(property)%20json">Link to this property</a>

PlainText stringOptional

Request body as plain text

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20body%20%3E%20(schema)%20%3E%20(property)%20plain_text">Link to this property</a>

</details>

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20body">Link to this property</a>

<details>

<summary>

Context param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/request_tracers/subresources/traces/methods/create#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)">TraceNewParamsContext</a>]Optional

Body param: Additional request parameters

</summary>

BotScore int64Optional

Bot score used for evaluating tracing request processing

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20bot_score">Link to this property</a>

<details>

<summary>

Geoloc TraceNewParamsContextGeolocOptional

Geodata for tracing request

</summary>

City stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20city">Link to this property</a>

Continent stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20continent">Link to this property</a>

IsEuCountry boolOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20is_eu_country">Link to this property</a>

ISOCode stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20iso_code">Link to this property</a>

Latitude float64Optional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20latitude">Link to this property</a>

Longitude float64Optional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20longitude">Link to this property</a>

PostalCode stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20postal_code">Link to this property</a>

RegionCode stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20region_code">Link to this property</a>

Subdivision2ISOCode stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20subdivision_2_iso_code">Link to this property</a>

Timezone stringOptional

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc%20%3E%20(property)%20timezone">Link to this property</a>

</details>

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20geoloc">Link to this property</a>

SkipChallenge boolOptional

Whether to skip any challenges for tracing request (e.g.: captcha)

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20skip_challenge">Link to this property</a>

ThreatScore int64Optional

Threat score used for evaluating tracing request processing

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context%20%3E%20(schema)%20%3E%20(property)%20threat_score">Link to this property</a>

</details>

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20context">Link to this property</a>

Cookies param.Field\[map\[string, string]]Optional

Body param: Cookies added to tracing request

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20cookies">Link to this property</a>

Headers param.Field\[map\[string, string]]Optional

Body param: Headers added to tracing request

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20headers">Link to this property</a>

Protocol param.Field\[string]Optional

Body param: HTTP Protocol of tracing request

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20protocol">Link to this property</a>

SkipResponse param.Field\[bool]Optional

Body param: Skip sending the request to the Origin server after all rules evaluation

<a href="#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20skip_response">Link to this property</a>

</details>

[Link to this property](<#(resource)%20request_tracers.traces%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type TraceNewResponse struct{…}

Trace result with an origin status code

</summary>

StatusCode int64Optional

HTTP Status code of zone response

<a href="#(resource)%20request_tracers.traces%20%3E%20(model)%20TraceNewResponse%20%3E%20(schema)%20%3E%20(property)%20status_code">Link to this property</a>

Trace <a href="https://developers.cloudflare.com/api/go/resources/request_tracers#(resource)%20request_tracers.traces%20%3E%20(model)%20trace%20%3E%20(schema)">Trace</a>Optional

<a href="#(resource)%20request_tracers.traces%20%3E%20(model)%20TraceNewResponse%20%3E%20(schema)%20%3E%20(property)%20trace">Link to this property</a>

</details>

[Link to this property](<#(resource)%20request_tracers.traces%20%3E%20(model)%20TraceNewResponse%20%3E%20(schema)>)

### Request Trace

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  trace, err := client.RequestTracers.Traces.New(context.TODO(), request_tracers.TraceNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Method: cloudflare.F("PUT"),
    URL: cloudflare.F("https://some.zone/some_path"),
    Body: cloudflare.F(request_tracers.TraceNewParamsBody{
      Base64: cloudflare.F("c29tZV9yZXF1ZXN0X2JvZHk="),
    }),
    Context: cloudflare.F(request_tracers.TraceNewParamsContext{
      Geoloc: cloudflare.F(request_tracers.TraceNewParamsContextGeoloc{
        City: cloudflare.F("London"),
      }),
      SkipChallenge: cloudflare.F(true),
    }),
    Cookies: cloudflare.F(map[string]string{
    "cookie_name_1": "cookie_value_1",
    "cookie_name_2": "cookie_value_2",
    }),
    Headers: cloudflare.F(map[string]string{
    "header_name_1": "header_value_1",
    "header_name_2": "header_value_2",
    }),
    Protocol: cloudflare.F("HTTP/1.1"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", trace.StatusCode)
}
```

200 example

```
{
  "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": {
    "status_code": 0,
    "trace": [
      {
        "action": "execute",
        "action_parameters": {
          "id": "4814384a9e5d4991b9815dcfc25d2f1f"
        },
        "description": "some rule",
        "expression": "ip.src ne 1.1.1.1",
        "kind": "zone",
        "matched": true,
        "name": "some ruleset name",
        "step_name": "rule_id01",
        "type": "rule"
      }
    ]
  }
}
```

##### Returns Examples

200 example

```
{
  "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": {
    "status_code": 0,
    "trace": [
      {
        "action": "execute",
        "action_parameters": {
          "id": "4814384a9e5d4991b9815dcfc25d2f1f"
        },
        "description": "some rule",
        "expression": "ip.src ne 1.1.1.1",
        "kind": "zone",
        "matched": true,
        "name": "some ruleset name",
        "step_name": "rule_id01",
        "type": "rule"
      }
    ]
  }
}
```