> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/connect/n8n-api/credential.md).

# Credential

Operations about credentials

## Test credential by ID

> Tests a credential by ID using the stored credential data.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"schemas":{"credentialTestResponse":{"type":"object","required":["status","message"],"properties":{"status":{"type":"string","enum":["OK","Error"]},"message":{"type":"string"}}}},"responses":{"unauthorized":{"description":"Unauthorized"},"notFound":{"description":"The specified resource was not found."}}},"paths":{"/credentials/{id}/test":{"post":{"tags":["Credential"],"summary":"Test credential by ID","description":"Tests a credential by ID using the stored credential data.","operationId":"testCredential","parameters":[{"name":"id","in":"path","description":"The credential ID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/credentialTestResponse"}}}},"401":{"$ref":"#/components/responses/unauthorized"},"404":{"$ref":"#/components/responses/notFound"}}}}}}
```

## GET /credentials/schema/{credentialTypeName}

> Show credential data schema

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"unauthorized":{"description":"Unauthorized"},"notFound":{"description":"The specified resource was not found."}}},"paths":{"/credentials/schema/{credentialTypeName}":{"get":{"tags":["Credential"],"summary":"Show credential data schema","parameters":[{"name":"credentialTypeName","in":"path","description":"The credential type name that you want to get the schema for","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/unauthorized"},"404":{"$ref":"#/components/responses/notFound"}}}}}}
```

## List credentials

> Retrieve all credentials from your instance. Only available for the instance owner and admin. Credential data (secrets) is not included.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"parameters":{"limit":{"name":"limit","in":"query","description":"The maximum number of items to return.","required":false,"schema":{"type":"number","default":100,"maximum":250}},"cursor":{"name":"cursor","in":"query","description":"Paginate by setting the cursor parameter to the nextCursor attribute returned by the previous request's response. Default value fetches the first \"page\" of the collection. See pagination for more detail.","required":false,"style":"form","schema":{"type":"string"}}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"}}},"paths":{"/credentials":{"get":{"operationId":"getCredentials","tags":["Credential"],"summary":"List credentials","description":"Retrieve all credentials from your instance. Only available for the instance owner and admin. Credential data (secrets) is not included.","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"shared":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","role","createdAt","updatedAt"]}}},"required":["id","name","type","createdAt","updatedAt","shared"]}},"nextCursor":{"type":"string","nullable":true}},"required":["data","nextCursor"]}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"}}}}}}
```

## Create a credential

> Creates a credential that can be used by nodes of the specified type.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"schemas":{"credentialPublicDto.generated":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"isManaged":{"type":"boolean"},"isGlobal":{"type":"boolean"},"isResolvable":{"type":"boolean"},"resolvableAllowFallback":{"type":"boolean"},"resolverId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","isManaged","isGlobal","isResolvable","resolvableAllowFallback","resolverId","createdAt","updatedAt"]}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"notFound":{"description":"The specified resource was not found."},"unsupportedMediaType":{"description":"Unsupported media type."}}},"paths":{"/credentials":{"post":{"operationId":"createCredential","tags":["Credential"],"summary":"Create a credential","description":"Creates a credential that can be used by nodes of the specified type.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"name":{"type":"string"},"type":{"type":"string"},"data":{"type":"object","additionalProperties":{"nullable":true},"writeOnly":true},"isResolvable":{"type":"boolean","description":"Whether this credential has resolvable fields"},"createdAt":{"type":"string","format":"date-time","readOnly":true},"updatedAt":{"type":"string","format":"date-time","readOnly":true},"projectId":{"type":"string","description":"Project to create the credential in. Defaults to the user's personal project."}},"required":["name","type","data"]}}}},"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/credentialPublicDto.generated"}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/notFound"},"415":{"$ref":"#/components/responses/unsupportedMediaType"}}}}}}
```

## Get credential by ID

> Retrieves a credential by ID. Credential data (secrets) is not included.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"schemas":{"credentialPublicDto.generated":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"isManaged":{"type":"boolean"},"isGlobal":{"type":"boolean"},"isResolvable":{"type":"boolean"},"resolvableAllowFallback":{"type":"boolean"},"resolverId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","isManaged","isGlobal","isResolvable","resolvableAllowFallback","resolverId","createdAt","updatedAt"]}},"responses":{"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"notFound":{"description":"The specified resource was not found."}}},"paths":{"/credentials/{credentialId}":{"get":{"operationId":"getCredential","tags":["Credential"],"summary":"Get credential by ID","description":"Retrieves a credential by ID. Credential data (secrets) is not included.","parameters":[{"schema":{"type":"string"},"required":true,"description":"The ID of the credential.","name":"credentialId","in":"path"}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/credentialPublicDto.generated"}}}},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/notFound"}}}}}}
```

## Delete credential by ID

> Deletes a credential from your instance. You must be the owner of the credential.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"notFound":{"description":"The specified resource was not found."}}},"paths":{"/credentials/{credentialId}":{"delete":{"operationId":"deleteCredential","tags":["Credential"],"summary":"Delete credential by ID","description":"Deletes a credential from your instance. You must be the owner of the credential.","parameters":[{"schema":{"type":"string"},"required":true,"description":"The ID of the credential.","name":"credentialId","in":"path"}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"isManaged":{"type":"boolean"},"isGlobal":{"type":"boolean"},"isResolvable":{"type":"boolean"},"resolvableAllowFallback":{"type":"boolean"},"resolverId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"usageScope":{"type":"string","enum":["project","instance"]}},"required":["id","name","type","isManaged","isGlobal","isResolvable","resolvableAllowFallback","resolverId","createdAt","updatedAt","usageScope"]}}}},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/notFound"}}}}}}
```

## Update credential by ID

> Updates an existing credential. You must be the owner of the credential.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"schemas":{"credentialPublicDto.generated":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"isManaged":{"type":"boolean"},"isGlobal":{"type":"boolean"},"isResolvable":{"type":"boolean"},"resolvableAllowFallback":{"type":"boolean"},"resolverId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","type","isManaged","isGlobal","isResolvable","resolvableAllowFallback","resolverId","createdAt","updatedAt"]}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"notFound":{"description":"The specified resource was not found."},"unsupportedMediaType":{"description":"Unsupported media type."}}},"paths":{"/credentials/{credentialId}":{"patch":{"operationId":"updateCredential","tags":["Credential"],"summary":"Update credential by ID","description":"Updates an existing credential. You must be the owner of the credential.","parameters":[{"schema":{"type":"string"},"required":true,"description":"The ID of the credential.","name":"credentialId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the credential"},"type":{"type":"string","description":"The credential type. If changing type, data must also be provided."},"data":{"type":"object","additionalProperties":{"nullable":true},"description":"The credential data. Required when changing credential type.","writeOnly":true},"isGlobal":{"type":"boolean","description":"Whether this credential is available globally"},"isResolvable":{"type":"boolean","description":"Whether this credential has resolvable fields"},"isPartialData":{"type":"boolean","default":false,"description":"If true, unredacts and merges existing credential data with the provided data. If false, replaces the entire data object."}}}}}},"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/credentialPublicDto.generated"}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/notFound"},"415":{"$ref":"#/components/responses/unsupportedMediaType"}}}}}}
```

## Transfer a credential to another project.

> Transfer a credential to another project.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"Credential","description":"Operations about credentials"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"notFound":{"description":"The specified resource was not found."},"unsupportedMediaType":{"description":"Unsupported media type."}}},"paths":{"/credentials/{credentialId}/transfer":{"put":{"operationId":"transferCredential","tags":["Credential"],"summary":"Transfer a credential to another project.","description":"Transfer a credential to another project.","parameters":[{"schema":{"type":"string"},"required":true,"description":"The ID of the credential.","name":"credentialId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"destinationProjectId":{"type":"string","description":"The ID of the project to transfer the credential to."}},"required":["destinationProjectId"]}}}},"responses":{"204":{"description":"Operation successful."},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"404":{"$ref":"#/components/responses/notFound"},"415":{"$ref":"#/components/responses/unsupportedMediaType"}}}}}}
```
