Skip to content
Start here

Get a dataset (deprecated)

client.AIGateway.Datasets.Get(ctx, gatewayID, id, query) (*DatasetGetResponse, error)
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}

Retrieves a dataset and its log filters. Evaluations and datasets are deprecated and unavailable to new accounts.

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)
AI Gateway WriteAI Gateway Read
ParametersExpand Collapse
gatewayID string

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
id string
query DatasetGetParams
AccountID param.Field[string]
ReturnsExpand Collapse
type DatasetGetResponse struct{…}
ID string
CreatedAt Time
formatdate-time
Enable bool
Filters []DatasetGetResponseFilter
Key DatasetGetResponseFiltersKey
One of the following:
const DatasetGetResponseFiltersKeyCreatedAt DatasetGetResponseFiltersKey = "created_at"
const DatasetGetResponseFiltersKeyRequestContentType DatasetGetResponseFiltersKey = "request_content_type"
const DatasetGetResponseFiltersKeyResponseContentType DatasetGetResponseFiltersKey = "response_content_type"
const DatasetGetResponseFiltersKeySuccess DatasetGetResponseFiltersKey = "success"
const DatasetGetResponseFiltersKeyCached DatasetGetResponseFiltersKey = "cached"
const DatasetGetResponseFiltersKeyProvider DatasetGetResponseFiltersKey = "provider"
const DatasetGetResponseFiltersKeyModel DatasetGetResponseFiltersKey = "model"
const DatasetGetResponseFiltersKeyCost DatasetGetResponseFiltersKey = "cost"
const DatasetGetResponseFiltersKeyTokens DatasetGetResponseFiltersKey = "tokens"
const DatasetGetResponseFiltersKeyTokensIn DatasetGetResponseFiltersKey = "tokens_in"
const DatasetGetResponseFiltersKeyTokensOut DatasetGetResponseFiltersKey = "tokens_out"
const DatasetGetResponseFiltersKeyDuration DatasetGetResponseFiltersKey = "duration"
const DatasetGetResponseFiltersKeyFeedback DatasetGetResponseFiltersKey = "feedback"
Operator DatasetGetResponseFiltersOperator
One of the following:
const DatasetGetResponseFiltersOperatorEq DatasetGetResponseFiltersOperator = "eq"
const DatasetGetResponseFiltersOperatorContains DatasetGetResponseFiltersOperator = "contains"
const DatasetGetResponseFiltersOperatorLt DatasetGetResponseFiltersOperator = "lt"
const DatasetGetResponseFiltersOperatorGt DatasetGetResponseFiltersOperator = "gt"
Value []DatasetGetResponseFiltersValueUnion
One of the following:
UnionString
UnionFloat
UnionBool
GatewayID string

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
ModifiedAt Time
formatdate-time
Name string

Get a dataset (deprecated)

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  dataset, err := client.AIGateway.Datasets.Get(
    context.TODO(),
    "my-gateway",
    "id",
    ai_gateway.DatasetGetParams{
      AccountID: cloudflare.F("3ebbcb006d4d46d7bb6a8c7f14676cb0"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", dataset.ID)
}
{
  "result": {
    "id": "id",
    "created_at": "2019-12-27T18:11:19.117Z",
    "enable": true,
    "filters": [
      {
        "key": "created_at",
        "operator": "eq",
        "value": [
          "string"
        ]
      }
    ],
    "gateway_id": "my-gateway",
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name"
  },
  "success": true
}
Returns Examples
{
  "result": {
    "id": "id",
    "created_at": "2019-12-27T18:11:19.117Z",
    "enable": true,
    "filters": [
      {
        "key": "created_at",
        "operator": "eq",
        "value": [
          "string"
        ]
      }
    ],
    "gateway_id": "my-gateway",
    "modified_at": "2019-12-27T18:11:19.117Z",
    "name": "name"
  },
  "success": true
}