Skip to content

List Credentials

client.Credentials.List(ctx, query) (*CursorPage[Credential], error)
GET/v5/credentials

Retrieve a paginated list of all credentials for the current account with optional name filtering.

ParametersExpand Collapse
query CredentialListParams
EndingBefore param.Field[string]Optional
Limit param.Field[int64]Optional
maximum10000
minimum1
Name param.Field[string]Optional

Filter credentials by name

SortBy param.Field[string]Optional
SortOrder param.Field[SortOrder]Optional
StartingAfter param.Field[string]Optional
ReturnsExpand Collapse
type Credential struct{…}
ID string
CreatedAt Time
formatdate-time
CreatedByIdentityType string
CreatedByUserID string
CredentialMetadata map[string, any]
Description string
Name string
Type string
UpdatedAt Time
formatdate-time
Object stringOptional

List Credentials

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  page, err := client.Credentials.List(context.TODO(), sgpdev.CredentialListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by_identity_type": "created_by_identity_type",
      "created_by_user_id": "created_by_user_id",
      "credential_metadata": {
        "foo": "bar"
      },
      "description": "description",
      "name": "name",
      "type": "type",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "object": "object"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
Returns Examples
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by_identity_type": "created_by_identity_type",
      "created_by_user_id": "created_by_user_id",
      "credential_metadata": {
        "foo": "bar"
      },
      "description": "description",
      "name": "name",
      "type": "type",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "object": "object"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}