Skip to content

Update Credential

client.credentials.update(stringcredentialID, CredentialUpdateParams { credential_metadata, description, name, 2 more } body, RequestOptionsoptions?): Credential { id, created_at, created_by_identity_type, 7 more }
PATCH/v5/credentials/{credential_id}

Update an existing credential’s properties including name, description, type, payload, and metadata.

ParametersExpand Collapse
credentialID: string
body: CredentialUpdateParams { credential_metadata, description, name, 2 more }
credential_metadata?: Record<string, unknown>

Optional unencrypted credential_metadata

description?: string

Optional description

name?: string

User-friendly name for the credential

payload?: string

The credential payload to be encrypted

formatpassword
type?: string

Type of credential: key or json

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

Update Credential

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.update('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"
}