Skip to content

Get Credential by ID

client.Credentials.Get(ctx, credentialID) (*Credential, error)
GET/v5/credentials/{credential_id}

Retrieve a specific credential by its unique identifier.

ParametersExpand Collapse
credentialID string
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

Get Credential by ID

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"),
  )
  credential, err := client.Credentials.Get(context.TODO(), "credential_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", credential.ID)
}
{
  "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"
}
Returns Examples
{
  "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"
}