Skip to content
Product Docs

List Api Keys

client.APIKeys.List(ctx, query) (*PaginatedCursor[APIKey], error)
GET/api/v1/beta/api-keys

List API keys.

Name a project_id to list every key on that project, which its members share; naming one you cannot read is a 404. Omit it to list your own. A project-scoped key sees only its own project either way.

ParametersExpand Collapse
query APIKeyListParams
Expand param.Field[[]string]Optional
KeyType param.Field[APIKeyListParamsKeyType]Optional
const APIKeyListParamsKeyTypeAgent APIKeyListParamsKeyType = "agent"
const APIKeyListParamsKeyTypeUser APIKeyListParamsKeyType = "user"
Name param.Field[string]Optional
PageSize param.Field[int64]Optional
PageToken param.Field[string]Optional
ProjectID param.Field[string]Optional
ReturnsExpand Collapse
type APIKey struct{…}

Schema for an API Key.

ID string

Unique identifier

formatuuid
RedactedAPIKey string

The key with its middle masked, except on the create response, which returns the full secret once and never again.

UserID string
CreatedAt TimeOptional

Creation datetime

formatdate-time
ExpiresAt TimeOptional

When the API key expires. Null if the key never expires.

formatdate-time
KeyType APIKeyKeyTypeOptional
One of the following:
const APIKeyKeyTypeAgent APIKeyKeyType = "agent"
const APIKeyKeyTypeUser APIKeyKeyType = "user"
Metadata map[string, any]Optional
Name stringOptional
ProjectID stringOptional
Role APIKeyRoleOptional

Role capping what this key may do. Null if the key authorizes as its owner.

One of the following:
const APIKeyRoleAdmin APIKeyRole = "admin"
const APIKeyRoleAgentViewer APIKeyRole = "agent_viewer"
const APIKeyRoleViewer APIKeyRole = "viewer"
const APIKeyRoleViewerV2 APIKeyRole = "viewer_v2"
UpdatedAt TimeOptional

Update datetime

formatdate-time

List Api Keys

package main

import (
  "context"
  "fmt"

  "github.com/run-llama/llamacloud-admin-go"
  "github.com/run-llama/llamacloud-admin-go/option"
)

func main() {
  client := llamacloudadmin.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.APIKeys.List(context.TODO(), llamacloudadmin.APIKeyListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "items": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "redacted_api_key": "redacted_api_key",
      "user_id": "user_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "expires_at": "2019-12-27T18:11:19.117Z",
      "key_type": "agent",
      "metadata": {
        "foo": "bar"
      },
      "name": "name",
      "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "role": "admin",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}
Returns Examples
{
  "items": [
    {
      "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "redacted_api_key": "redacted_api_key",
      "user_id": "user_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "expires_at": "2019-12-27T18:11:19.117Z",
      "key_type": "agent",
      "metadata": {
        "foo": "bar"
      },
      "name": "name",
      "project_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
      "role": "admin",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_page_token": "next_page_token",
  "total_size": 0
}