## Update Credential

`client.credentials.update(stringcredentialID, CredentialUpdateParamsbody, RequestOptionsoptions?): Credential`

**patch** `/v5/credentials/{credential_id}`

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

### Parameters

- `credentialID: string`

- `body: CredentialUpdateParams`

  - `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

  - `type?: string`

    Type of credential: key or json

### Returns

- `Credential`

  - `id: string`

  - `created_at: string`

  - `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`

  - `object?: string`

### Example

```typescript
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);
```

#### Response

```json
{
  "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"
}
```
