Skip to main content

Overview

The Credentials API allows you to programmatically manage credentials used by workflow nodes for authentication. Credentials store sensitive information like API keys, OAuth tokens, and database passwords securely.
Credentials contain sensitive data. Always use secure connections (HTTPS) and handle credentials with appropriate security measures.

List Credentials

Retrieve a list of credentials accessible to your account.

Query Parameters

boolean
default:"false"
Include permission scopes in the response
boolean
default:"false"
Include credential data (encrypted fields will be redacted)
boolean
default:"false"
Only return credentials shared with you (excludes owned credentials)
boolean
default:"true"
Include globally shared credentials
object
Filter credentials by various criteria

Example Request

Response

array
Array of credential objects
string
Unique credential identifier
string
Credential name
string
Credential type (e.g., “googleSheetsOAuth2Api”, “httpBasicAuth”)
boolean
Whether the credential is globally shared across all projects
boolean
Whether the credential is managed by an external system
string
ISO 8601 timestamp of creation
string
ISO 8601 timestamp of last update
string[]
Permission scopes (only if includeScopes=true)
Example Response

Get Credential

Retrieve details of a specific credential.

Path Parameters

string
required
The credential ID

Query Parameters

boolean
default:"false"
Include credential data (sensitive fields will be redacted)

Example Request

Response

Sensitive credential fields are automatically redacted with ***REDACTED*** even when includeData=true. This protects secrets while allowing you to verify credential configuration.

Create Credential

Create a new credential.

Request Body

string
required
Credential name (1-128 characters)
string
required
Credential type identifier (e.g., “httpBasicAuth”, “googleSheetsOAuth2Api”)
object
required
Credential data with authentication fields specific to the credential type
string
Project ID to create credential in (defaults to personal project)
boolean
default:"false"
Whether to share the credential globally across all projects (requires permission)
boolean
default:"false"
Whether the credential uses dynamic resolution (Enterprise feature)

Example Request

Response

Returns the created credential object:
The credential data is not returned in the response for security. The data is encrypted and stored securely.

Update Credential

Update an existing credential.

Path Parameters

string
required
The credential ID to update

Request Body

All fields are optional. Only include fields you want to update.
string
Updated credential name
object
Updated credential data. You must provide all fields, not just changed ones.
boolean
Update global sharing status (requires permission)

Example Request

Response

When updating credential data, you must provide the complete data object. Partial updates are not supported for the data field.

Delete Credential

Permanently delete a credential.

Path Parameters

string
required
The credential ID to delete

Example Request

Response

Deleting a credential will cause workflows using it to fail. Ensure no active workflows depend on the credential before deletion.

Test Credential

Test if a credential configuration is valid.

Request Body

object
required
Credential object to test
string
required
Credential ID
string
required
Credential type
object
Credential data (can be partial for testing changes)

Example Request

Response

Share Credential

Share a credential with other projects.

Path Parameters

string
required
The credential ID to share

Request Body

string[]
required
Array of project IDs to share the credential with

Example Request

Response

Returns 204 No Content on success.
Sharing credentials requires the credential:share permission and an Enterprise license.

Transfer Credential

Transfer a credential to a different project.

Path Parameters

string
required
The credential ID to transfer

Request Body

string
required
The target project ID

Example Request

Generate Unique Name

Generate a unique credential name (useful when creating credentials).

Query Parameters

string
Base name for the credential. If not provided, uses the default “My credentials”.

Example Request

Response

If credentials with the requested name exist, a number is appended (e.g., “API Key 2”, “API Key 3”).

Credential Types

Common credential types in n8n:
  • httpBasicAuth - Basic authentication
  • httpDigestAuth - Digest authentication
  • httpHeaderAuth - Header-based authentication
  • httpQueryAuth - Query parameter authentication
  • oAuth1Api - OAuth 1.0
  • oAuth2Api - OAuth 2.0
  • postgres - PostgreSQL
  • mysql - MySQL/MariaDB
  • mongoDb - MongoDB
  • redis - Redis
  • microsoftSql - Microsoft SQL Server
  • aws - Amazon Web Services
  • googleApi - Google Cloud Platform
  • azureApi - Microsoft Azure
  • slackApi - Slack
  • githubApi - GitHub
  • googleSheetsOAuth2Api - Google Sheets
  • salesforceOAuth2Api - Salesforce
  • notionApi - Notion

Security Best Practices

Grant credentials only the minimum permissions required for workflows to function.
Update API keys and passwords periodically to reduce security risks.
Regularly review which workflows use each credential and remove unused credentials.
Only mark credentials as global if they truly need to be accessible across all projects.
Always test credentials in a development environment before using them in production workflows.
Ensure credentials are never logged or exposed in workflow outputs.

Common Patterns

Programmatic Credential Rotation

Error Responses

400 Bad Request

403 Forbidden

404 Not Found

Next Steps

Workflows API

Use credentials in workflows

Authentication

Learn about API authentication

Security

Credential security best practices

Node Credentials

Learn about node credential types