# Credentials

> Credentials - You can store credentials for use with databases and data connections.

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-05-01T23:10:47.746601+00:00` (UTC).

## Primary page

- [Credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html): Full documentation for this topic (HTML).

## Sections on this page

- [List credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#list-credentials): In-page section heading.
- [Basic credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#basic-credentials): In-page section heading.
- [S3 credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#s3-credentials): In-page section heading.
- [OAuth credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#oauth-credentials): In-page section heading.
- [Snowflake key pair credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#snowflake-key-pair-credentials): In-page section heading.
- [Databricks access token credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#databricks-access-token-credentials): In-page section heading.
- [Databricks service principal credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#databricks-service-principal-credentials): In-page section heading.
- [Azure Service Principal credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#azure-service-principal-credentials): In-page section heading.
- [ADLS OAuth credentials](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#adls-oauth-credentials): In-page section heading.
- [Credential data](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/credentials.html#credential-data): In-page section heading.

## Related documentation

- [Developer documentation](https://docs.datarobot.com/en/docs/api/index.html): Linked from this page.
- [Developer learning](https://docs.datarobot.com/en/docs/api/dev-learning/index.html): Linked from this page.
- [Python API client user guide](https://docs.datarobot.com/en/docs/api/dev-learning/python/index.html): Linked from this page.
- [Administration](https://docs.datarobot.com/en/docs/api/dev-learning/python/admin/index.html): Linked from this page.
- [Credential](https://docs.datarobot.com/en/docs/api/reference/sdk/credentials.html#credential-api): Linked from this page.
- [Batch predictions](https://docs.datarobot.com/en/docs/api/reference/sdk/batch-predictions.html#batch-predictions-s3-creds-usage): Linked from this page.

## Documentation content

# Credentials

You can store credentials for use with databases and data connections.

To interact with credentials API, use the [Credential](https://docs.datarobot.com/en/docs/api/reference/sdk/credentials.html#credential-api) class.

## List credentials

To retrieve the list of all credentials accessible to you, use [Credential.list](https://docs.datarobot.com/en/docs/api/reference/sdk/credentials.html#datarobot.models.Credential.list).

```
import datarobot as dr

credentials = dr.Credential.list()
```

Each credential object contains the `credential_id` string field which can be used in, for example, [Batch predictions](https://docs.datarobot.com/en/docs/api/reference/sdk/batch-predictions.html#batch-predictions-s3-creds-usage).

## Basic credentials

Use the code below to store generic username and password credentials:

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_basic(
...     name='my_db_cred',
...     user='<user>',
...     password='<password>',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e0f', 'my_db_cred', 'basic'),

# Store cred.credential_id

>>> cred = dr.Credential.get(credential_id)
>>> cred.credential_id
'5e429d6ecf8a5f36c5693e0f'
```

Stored credentials can be used in [Batch predictions for JDBC intake or output](https://docs.datarobot.com/en/docs/api/reference/sdk/batch-predictions.html#datarobot.models.BatchPredictionJob).

## S3 credentials

You can store AWS credentials either using the following three parameters:

- aws_access_key_id
- aws_secret_access_key
- aws_session_token

or by using the ID of the saved shared secure configuration:

- config_id

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_s3(
...     name='my_s3_cred',
...     aws_access_key_id='<aws access key id>',
...     aws_secret_access_key='<aws secret access key>',
...     aws_session_token='<aws session token>',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e03', 'my_s3_cred', 's3'),

# Using config_id
>>> cred = dr.Credential.dr.Credential.create_s3(
...     name='my_s3_cred_with_config_id',
...     config_id='<id_of_shared_secure_configuration>',
... )
>>> cred
Credential('65ef55ef4cec97f0f733835c', 'my_s3_cred_with_config_id', 's3')

# Store cred.credential_id

>>> cred = dr.Credential.get(credential_id)
>>> cred.credential_id
'5e429d6ecf8a5f36c5693e03'
```

Stored credential can be used, for example, in [Batch predictions for S3 intake or output](https://docs.datarobot.com/en/docs/api/reference/sdk/batch-predictions.html#batch-predictions-s3-creds-usage).

## OAuth credentials

You can store OAuth credentials in the data store.

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_oauth(
...     name='my_oauth_cred',
...     token='<token>',
...     refresh_token='<refresh_token>',
... )
>>> cred
Credential('5e429d6ecf8a5f36c5693e0f', 'my_oauth_cred', 'oauth'),

# Store cred.credential_id

>>> cred = dr.Credential.get(credential_id)
>>> cred.credential_id
'5e429d6ecf8a5f36c5693e0f'
```

## Snowflake key pair credentials

You can store Snowflake key pair credentials in the store. It accepts either of the following parameters:

- private_key
- passphrase

Or you can use the ID of the saved shared secure configuration.

- config_id

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_snowflake_key_pair(
...     name='my_snowflake_key_pair_cred',
...     user='<user>',
...     private_key="""<private_key>""",
...     passphrase='<passphrase>',
... )
>>> cred
Credential('65e9b55e4b0d925c678bb847', 'my_snowflake_key_pair_cred', 'snowflake_key_pair_user_account')
>>> cred = dr.Credential.create_snowflake_key_pair(
...     name='my_snowflake_key_pair_cred_with_config_id',
...     config_id='<id_of_shared_secure_configuration>',
... )
>>> cred
Credential('65e9b9494b0d925c678bb84d', 'my_snowflake_key_pair_cred_with_config_id', 'snowflake_key_pair_user_account')
```

## Databricks access token credentials

You can store Databricks access token credentials in the data store.

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_databricks_access_token(
...     name='my_databricks_access_token_cred',
...     databricks_access_token='<databricks_access_token>',
... )
>>> cred
Credential('65e9bace4b0d925c678bb850', 'my_databricks_access_token_cred', 'databricks_access_token_account')
```

## Databricks service principal credentials

You can store Databricks service principal credentials in the store. It accepts either of the following parameters:

- client_id
- client_secret

You can also use the ID of the saved shared secure configuration.

- config_id

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_databricks_service_principal(
...     name='my_databricks_service_principal_cred',
...     client_id='<client_id>',
...     client_secret='<client_secret>',
... )
>>> cred
Credential('65e9bb864b0d925c678bb853', 'my_databricks_service_principal_cred', 'databricks_service_principal_account')
>>> cred = dr.Credential.create_databricks_service_principal(
...     name='my_databricks_service_principal_cred_with_config_id',
...     config_id='<id_of_shared_secure_configuration>',
... )
>>> cred
Credential('65e9bcc14b0d925c678bb85e', 'my_databricks_service_principal_cred_with_config_id', 'databricks_service_principal_account')
```

## Azure Service Principal credentials

You can store Azure Service Principal credentials using any of the three following parameters:

- client_id
- client_secret
- azure_tenant_id

You can also use the ID of the saved shared secure configuration.

- config_id

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_azure_service_principal(
...     name='my_azure_service_principal_cred',
...     client_id='<client id>',
...     client_secret='<client secret>',
...     azure_tenant_id='<azure tenant id>',
... )
>>> cred
Credential('66c920fc4ef80072a8225e56', 'my_azure_service_principal_cred2', 'azure_service_principal')

# Using config_id
>>> cred = dr.Credential.dr.Credential.create_azure_service_principal(
...     name='my_azure_service_principal_cred_with_config_id',
...     config_id='<id_of_shared_secure_configuration>',
... )
>>> cred
Credential('66c921aa0ff7aea1ce225e2d', 'my_azure_service_principal_cred_with_config_id', 'azure_service_principal')

# Store cred.credential_id

>>> cred = dr.Credential.get(credential_id)
>>> cred.credential_id
'66c921aa0ff7aea1ce225e2d'
```

## ADLS OAuth credentials

You can store ADLS OAuth credentials using any of the three following parameters:

- client_id
- client_secret
- oauth_scopes

You can also use the ID of the saved shared secure configuration.

- config_id

```
>>> import datarobot as dr
>>> cred = dr.Credential.create_adls_oauth(
...     name='my_adls_oauth_cred',
...     client_id='<client id>',
...     client_secret='<client secret>',
...     oauth_scopes=['<oauth scope>'],
... )
>>> cred
Credential('66c9227e3b268d3278225e41', 'my_adls_oauth_cred', 'adls_gen2_oauth')

# Using config_id
>>> cred = dr.Credential.dr.Credential.create_adls_oauth(
...     name='my_adls_oauth_cred_with_config_id',
...     config_id='<id_of_shared_secure_configuration>',
... )
>>> cred
Credential('66c922b3ae75806f1d126f06', 'my_adls_oauth_cred_with_config_id', 'adls_gen2_oauth')

# Store cred.credential_id

>>> cred = dr.Credential.get(credential_id)
>>> cred.credential_id
'66c922b3ae75806f1d126f06'
```

## Credential data

For methods that accept credential data instead of a username/password or credential ID:

```
{
    "credentialType": "basic",
    "user": "user123",
    "password": "pass123",
}
```

```
{
    "credentialType": "s3",
    "awsAccessKeyId": "key123",
    "awsSecretAccessKey": "secret123",
}
```

```
{
    "credentialType": "s3",
    "configId": "id123",
}
```

```
{
    "credentialType": "oauth",
    "oauthRefreshToken": "token123",
    "oauthClientId": "client123",
    "oauthClientSecret": "secret123",
}
```

```
{
    "credentialType": "snowflake_key_pair_user_account",
    "user": "user123",
    "privateKey": "privatekey123",
    "passphrase": "passphrase123",
}
```

```
{
    "credentialType": "snowflake_key_pair_user_account",
    "configId": "id123",
}
```

```
{
    "credentialType": "databricks_access_token_account",
    "databricksAccessToken": "token123",
}
```

```
{
    "credentialType": "databricks_service_principal_account",
    "clientId": "client123",
    "clientSecret": "secret123",
}
```

```
{
    "credentialType": "databricks_service_principal_account",
    "configId": "id123",
}
```

```
{
    "credentialType": "azure_service_principal",
    "clientId": "client123",
    "clientSecret": "secret123",
    "azureTenantId": "tenant123"
}
```

```
{
    "credentialType": "azure_service_principal",
    "configId": "id123",
}
```

```
{
    "credentialType": "adls_gen2_oauth",
    "clientId": "client123",
    "clientSecret": "secret123",
    "oauthScopes": ["scope123"]
}
```

```
{
    "credentialType": "adls_gen2_oauth",
    "configId": "id123",
}
```
