Skip to content

List Agent API Keys

client.Agents.APIKeys.List(ctx, agentUuid, query) (*AgentAPIKeyListResponse, error)
get/v2/gen-ai/agents/{agent_uuid}/api_keys

To list all agent API keys, send a GET request to /v2/gen-ai/agents/{agent_uuid}/api_keys.

ParametersExpand Collapse
agentUuid string
query AgentAPIKeyListParams
Page param.Field[int64]optional

Page number.

PerPage param.Field[int64]optional

Items per page.

ReturnsExpand Collapse
type AgentAPIKeyListResponse struct{…}
APIKeyInfos []APIAgentAPIKeyInfooptional

Api key infos

CreatedAt Timeoptional

Creation date

formatdate-time
CreatedBy stringoptional

Created by

formatuint64
DeletedAt Timeoptional

Deleted date

formatdate-time
Name stringoptional

Name

SecretKey stringoptional
Uuid stringoptional

Uuid

Meta APIMetaoptional

Meta information about the data set

Page int64optional

The current page

formatint64
Pages int64optional

Total number of pages

formatint64
Total int64optional

Total amount of items over all pages

formatint64
List Agent API Keys
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  apiKeys, err := client.Agents.APIKeys.List(
    context.TODO(),
    `"123e4567-e89b-12d3-a456-426614174000"`,
    gradient.AgentAPIKeyListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", apiKeys.APIKeyInfos)
}
{
  "api_key_infos": [
    {
      "created_at": "2023-01-01T00:00:00Z",
      "created_by": "12345",
      "deleted_at": "2023-01-01T00:00:00Z",
      "name": "example name",
      "secret_key": "example string",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "links": {
    "pages": {
      "first": "example string",
      "last": "example string",
      "next": "example string",
      "previous": "example string"
    }
  },
  "meta": {
    "page": 123,
    "pages": 123,
    "total": 123
  }
}
Returns Examples
{
  "api_key_infos": [
    {
      "created_at": "2023-01-01T00:00:00Z",
      "created_by": "12345",
      "deleted_at": "2023-01-01T00:00:00Z",
      "name": "example name",
      "secret_key": "example string",
      "uuid": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "links": {
    "pages": {
      "first": "example string",
      "last": "example string",
      "next": "example string",
      "previous": "example string"
    }
  },
  "meta": {
    "page": 123,
    "pages": 123,
    "total": 123
  }
}