Skip to content

Get Credential by ID

client.credentials.retrieve(stringcredentialID, RequestOptionsoptions?): Credential { id, created_at, created_by_identity_type, 7 more }
GET/v5/credentials/{credential_id}

Retrieve a specific credential by its unique identifier.

ParametersExpand Collapse
credentialID: string
ReturnsExpand Collapse
Credential { id, created_at, created_by_identity_type, 7 more }
id: string
created_at: string
formatdate-time
created_by_identity_type: string | null
created_by_user_id: string | null
credential_metadata: Record<string, unknown> | null
description: string | null
name: string
type: string
updated_at: string
formatdate-time
object?: string

Get Credential by ID

import SGPClient from 'scale-gp';

const client = new SGPClient({
  accountID: 'My Account ID',
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

const credential = await client.credentials.retrieve('credential_id');

console.log(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"
}