mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-28 19:50:42 +00:00
91 lines
2.8 KiB
Text
91 lines
2.8 KiB
Text
---
|
|
title: "create_credential"
|
|
slug: sdk-reference/credentials/create-credential
|
|
---
|
|
|
|
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.
|
|
|
|
<Note>
|
|
Python uses `snake_case` (e.g., `create_credential`); TypeScript uses `camelCase` (e.g., `createCredential`). Parameter tables show Python names. TypeScript names are the camelCase equivalents.
|
|
</Note>
|
|
|
|
Store a new credential.
|
|
|
|
<CodeGroup>
|
|
```python Python
|
|
credential = await client.create_credential(
|
|
name="my-app-login",
|
|
credential_type="password",
|
|
credential={
|
|
"username": "demo@example.com",
|
|
"password": "s3cur3-p4ss",
|
|
},
|
|
)
|
|
print(credential.credential_id)
|
|
```
|
|
|
|
```typescript 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);
|
|
```
|
|
</CodeGroup>
|
|
|
|
### Parameters
|
|
|
|
| Parameter | Type | Required | Description |
|
|
|-----------|------|----------|-------------|
|
|
| `name` | `str` | Yes | Display name for the credential. |
|
|
| `credential_type` | `CredentialType` | Yes | Type of credential. |
|
|
| `credential` | `CreateCredentialRequestCredential` | Yes | The credential data. Shape depends on `credential_type`. |
|
|
| `vault_type` | `CredentialVaultType` | No | Which vault to store this credential in. If omitted, uses the default. |
|
|
| `request_options` | `RequestOptions` | No | Per-request configuration (see below). |
|
|
|
|
### Returns `CredentialResponse`
|
|
|
|
---
|
|
|
|
### Request options
|
|
|
|
|
|
Override timeout, retries, or headers for this call by passing `request_options` (Python) or a second options argument (TypeScript).
|
|
|
|
<CodeGroup>
|
|
```python Python
|
|
from skyvern.client.core import RequestOptions
|
|
|
|
request_options=RequestOptions(
|
|
timeout_in_seconds=120,
|
|
max_retries=3,
|
|
additional_headers={"x-custom-header": "value"},
|
|
)
|
|
```
|
|
|
|
```typescript TypeScript
|
|
// Pass as second argument to any method
|
|
{
|
|
timeoutInSeconds: 120,
|
|
maxRetries: 3,
|
|
headers: { "x-custom-header": "value" },
|
|
}
|
|
```
|
|
</CodeGroup>
|
|
|
|
| Option (Python) | Option (TypeScript) | Type | Description |
|
|
|-----------------|---------------------|------|-------------|
|
|
| `timeout_in_seconds` | `timeoutInSeconds` | `int` / `number` | HTTP timeout in seconds. |
|
|
| `max_retries` | `maxRetries` | `int` / `number` | Retry count. |
|
|
| `additional_headers` | `headers` | `dict` / `Record<string, string>` | Extra headers. |
|
|
| `additional_query_parameters` | - | `dict` | Extra query parameters. |
|
|
| `additional_body_parameters` | - | `dict` | Extra body parameters. |
|
|
| - | `abortSignal` | `AbortSignal` | Signal to cancel the request. |
|
|
| - | `apiKey` | `string` | Override API key. |
|
|
|
|
|
|
---
|