Skip to content
Start here

List Jobs

client.AISearch.Namespaces.Instances.Jobs.List(ctx, name, id, params) (*V4PagePaginationArray[NamespaceInstanceJobListResponse], error)
GET/accounts/{account_id}/ai-search/namespaces/{name}/instances/{id}/jobs

Lists indexing jobs for an AI Search instance.

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
ParametersExpand Collapse
name string
id string

AI Search instance ID. Lowercase alphanumeric, hyphens, and underscores.

maxLength64
minLength1
params NamespaceInstanceJobListParams
AccountID param.Field[string]

Path param

Page param.Field[int64]Optional

Query param

minimum1
PerPage param.Field[int64]Optional

Query param

maximum50
minimum0
ReturnsExpand Collapse
type NamespaceInstanceJobListResponse struct{…}
ID string
Source NamespaceInstanceJobListResponseSource
One of the following:
const NamespaceInstanceJobListResponseSourceUser NamespaceInstanceJobListResponseSource = "user"
const NamespaceInstanceJobListResponseSourceSchedule NamespaceInstanceJobListResponseSource = "schedule"
Description stringOptional
EndReason stringOptional
EndedAt stringOptional
LastSeenAt stringOptional
StartedAt stringOptional

List Jobs

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.AISearch.Namespaces.Instances.Jobs.List(
    context.TODO(),
    "my-namespace",
    "my-ai-search",
    ai_search.NamespaceInstanceJobListParams{
      AccountID: cloudflare.F("c3dc5f0b34a14ff8e1b3ec04895e1b22"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "result": [
    {
      "id": "id",
      "source": "user",
      "description": "description",
      "end_reason": "end_reason",
      "ended_at": "ended_at",
      "last_seen_at": "last_seen_at",
      "started_at": "started_at"
    }
  ],
  "result_info": {
    "count": 0,
    "page": 0,
    "per_page": 0,
    "total_count": 0
  },
  "success": true
}
Returns Examples
{
  "result": [
    {
      "id": "id",
      "source": "user",
      "description": "description",
      "end_reason": "end_reason",
      "ended_at": "ended_at",
      "last_seen_at": "last_seen_at",
      "started_at": "started_at"
    }
  ],
  "result_info": {
    "count": 0,
    "page": 0,
    "per_page": 0,
    "total_count": 0
  },
  "success": true
}