---
title: Get logs RayIDs
---

[Skip to content](#_top)

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

[Logs](https://developers.cloudflare.com/api/go/resources/logs)

[RayID](https://developers.cloudflare.com/api/go/resources/logs/subresources/rayid)

Copy Markdown

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

---

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

# Get logs RayIDs

client.Logs.RayID.Get(ctx, RayID, params) (\*unknown, error)

GET/zones/{zone\_id}/logs/rayids/{ray\_id}

The `/rayids` api route allows lookups by specific rayid. The rayids route will return zero, one, or more records (ray ids are not unique).

##### 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)

`Logs Write``Logs Read`

##### ParametersExpand Collapse

RayID string

Ray identifier.

maxLength16

[Link to this property](<#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20ray_id%20%3E%20(schema)>)

<details>

<summary>

params RayIDGetParams

</summary>

ZoneID param.Field\[string]

Path param: Identifier.

maxLength32

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20zone_id">Link to this property</a>

Fields param.Field\[string]Optional

Query param: The <code>/received</code> route by default returns a limited set of fields, and allows customers to override the default field set by specifying individual fields. The reasons for this are: 1. Most customers require only a small subset of fields, but that subset varies from customer to customer; 2. Flat schema is much easier to work with downstream (importing into BigTable etc); 3. Performance (time to process, file size). If <code>?fields=</code> is not specified, default field set is returned. This default field set may change at any time. When <code>?fields=</code> is provided, each record is returned with the specified fields. <code>fields</code> must be specified as a comma separated list without any whitespaces, and all fields must exist. The order in which fields are specified does not matter, and the order of fields in the response is not specified.

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20fields">Link to this property</a>

<details>

<summary>

Timestamps param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/logs/subresources/rayid/methods/get#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)">RayIDGetParamsTimestamps</a>]Optional

Query param: By default, timestamps in responses are returned as Unix nanosecond integers. The <code>?timestamps=</code> argument can be set to change the format in which response timestamps are returned. Possible values are: <code>unix</code>, <code>unixnano</code>, <code>rfc3339</code>. Note that <code>unix</code> and <code>unixnano</code> return timestamps as integers; <code>rfc3339</code> returns timestamps as strings.

</summary>

const RayIDGetParamsTimestampsUnix <a href="https://developers.cloudflare.com/api/go/resources/logs/subresources/rayid/methods/get#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)">RayIDGetParamsTimestamps</a> = "unix"

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const RayIDGetParamsTimestampsUnixnano <a href="https://developers.cloudflare.com/api/go/resources/logs/subresources/rayid/methods/get#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)">RayIDGetParamsTimestamps</a> = "unixnano"

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const RayIDGetParamsTimestampsRfc3339 <a href="https://developers.cloudflare.com/api/go/resources/logs/subresources/rayid/methods/get#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)">RayIDGetParamsTimestamps</a> = "rfc3339"

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20timestamps">Link to this property</a>

</details>

[Link to this property](<#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type RayIDGetResponse interface{…}

</summary>

One of the following:

unknown

<a href="#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(network%20schema)%20%3E%20(variant)%201">Link to this property</a>

</details>

[Link to this property](<#(resource)%20logs.rayid%20%3E%20(method)%20get%20%3E%20(network%20schema)>)

### Get logs RayIDs

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  RayID, err := client.Logs.RayID.Get(
    context.TODO(),
    "41ddf1740f67442d",
    logs.RayIDGetParams{
      ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", RayID)
}
```

200 example

```
"{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}\n{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}\n{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}"
```

##### Returns Examples

200 example

```
"{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}\n{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}\n{\"ClientIP\":\"192.0.2.1\",\"RayID\":\"41ddf1740f67442d\",\"EdgeStartTimestamp\":1526810289280000000}"
```