TwentyDEV icon

TwentyDEV

Consume the Twenty API

Actions252

Overview

This node operation allows you to create a new API key within the target system. It is useful for automating the management of API keys, such as generating keys programmatically with specific expiration and revocation dates, and assigning meaningful names. Typical use cases include integrating with systems that require API keys for authentication, managing access control dynamically, or provisioning keys for different environments or users.

Properties

Name Meaning
Depth Determines how much related nested information to include in the response:
- 0: Only the primary API key object.
- 1: Primary object plus directly related objects.
- 2: Primary object plus two levels of related objects.
Revoked At The date when the API key was revoked (if applicable). This can be used to mark the key as no longer valid.
Expires At Required. The expiration date of the API key, after which it will no longer be valid.
Name A descriptive name for the API key to help identify its purpose or owner.

Output

The node outputs JSON data representing the newly created API key object. The structure includes the primary API key details such as its identifier, name, expiration date, revocation date (if any), and potentially related nested objects depending on the Depth property setting.

No binary data output is produced by this node.

Dependencies

  • Requires an API authentication credential configured in n8n to authorize requests to the target system.
  • The node uses a base URL and headers preset for JSON communication.
  • No additional external dependencies are indicated beyond the API access credentials.

Troubleshooting

  • Missing Required Property: If the "Expires At" field is not provided, the node will likely throw an error because this property is mandatory.
  • Invalid Date Formats: Providing incorrectly formatted dates for "Expires At" or "Revoked At" may cause the API to reject the request.
  • Authentication Errors: Ensure the API key credential used by the node is valid and has sufficient permissions to create API keys.
  • API Limits or Restrictions: Some systems may limit the number of active API keys or impose other constraints; check the API documentation if creation fails unexpectedly.

Links and References

  • Refer to the target system’s API documentation for detailed information about API key creation, including accepted date formats and permission requirements.
  • Consult n8n documentation on how to configure API credentials and handle HTTP request nodes for further customization.

Discussion