The credentials file defines the authorization methods for the node. The settings in this file affect what n8n displays in the Credentials modal, and must reflect the authentication requirements of the service you're connecting to.
In the credentials file, you can use all the n8n UI elements. n8n encrypts the data that's stored using credentials using an encryption key.
Structure of the credentials file#
The credentials file follows this basic structure:
- Import statements
- Create a class for the credentials
- Within the class, define the properties that control authentication for the node.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
String. The internal name of the object. Used to reference it from other places in the node.
String. The name n8n uses in the GUI.
String. URL to your credentials documentation.
Each object contains:
displayName: the name n8n uses in the GUI.
name: the internal name of the object. Used to reference it from other places in the node.
type: the data type expected, such as
default: the URL that n8n should use to test credentials.
Object. Contains objects that tell n8n how to inject the authentication data as part of the API request.
String. If you're using an authentication method that sends data in the header, body, or query string, set this to
Object. Defines the authentication methods. Options are:
body: object. Sends authentication data in the request body. Can contain nested objects.
header: object. Send authentication data in the request header.
qs: object. Stands for "query string." Send authentication data in the request query string.
request object containing a URL and authentication type that n8n can use to test the credential.