--- title: Credentials subtitle: Store and manage authentication credentials securely slug: ts-sdk-reference/credentials --- Credentials let you store login information (username/password, TOTP secrets) securely in Skyvern's vault. Reference them by ID in tasks and workflows instead of passing secrets in your code. --- ## `createCredential` Store a new credential. ```typescript const credential = await skyvern.createCredential({ name: "my-app-login", credential_type: "password", credential: { username: "demo@example.com", password: "s3cur3-p4ss", }, }); console.log(credential.credential_id); ``` ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `name` | `string` | Yes | Display name for the credential. | | `credential_type` | `CredentialType` | Yes | Type of credential. | | `credential` | `object` | Yes | The credential data. Shape depends on `credential_type`. | ### Returns `CredentialResponse` --- ## `getCredentials` List all credentials. Credential values are never returned — only metadata. ```typescript const creds = await skyvern.getCredentials({}); for (const c of creds) { console.log(`${c.name} (${c.credential_id})`); } ``` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `page` | `number` | No | `undefined` | Page number. | | `page_size` | `number` | No | `undefined` | Results per page. | ### Returns `CredentialResponse[]` --- ## `getCredential` Get a single credential's metadata by ID. ```typescript const cred = await skyvern.getCredential("cred_abc123"); console.log(cred.name, cred.credential_type); ``` ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `credentialId` | `string` | Yes | The credential ID. | ### Returns `CredentialResponse` --- ## `deleteCredential` Delete a credential. ```typescript await skyvern.deleteCredential("cred_abc123"); ``` ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `credentialId` | `string` | Yes | The credential ID to delete. | --- ## `sendTotpCode` Send a TOTP (time-based one-time password) code to Skyvern during a run that requires 2FA. Call this when your webhook or polling detects that Skyvern is waiting for a TOTP code. ```typescript await skyvern.sendTotpCode({ totp_identifier: "demo@example.com", content: "123456", }); ``` ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `totp_identifier` | `string` | Yes | The identifier matching the `totp_identifier` used in the task/workflow. | | `content` | `string` | Yes | The TOTP code value. | | `task_id` | `string` | No | Associate with a specific task run. | | `workflow_id` | `string` | No | Associate with a specific workflow. | | `workflow_run_id` | `string` | No | Associate with a specific workflow run. | | `source` | `string` | No | Source of the TOTP code. | | `expired_at` | `string` | No | When this code expires (ISO 8601 format). | | `type` | `OtpType` | No | OTP type. | ### Returns `TotpCode`