Portainer icon

Portainer

Interact with Portainer via API

Actions190

Users → User Generate API Key

AI-generated

Overview

This node operation allows generating an API key for a specific user in the "Users" resource. It is useful when you need to programmatically create or refresh API keys for users, enabling them to authenticate and interact with the system via API calls securely.

Practical examples include:

  • Automating user onboarding by generating API keys immediately after user creation.
  • Rotating API keys periodically for security compliance.
  • Integrating with external systems that require API keys for user authentication.

Properties

Name Meaning
Id The unique identifier of the user for whom the API key will be generated. Must be provided as a number.
Body Additional details sent in the request body as a string. This can include any relevant information required by the API to generate the key.

Output

The node outputs JSON data containing the response from the API key generation request. This typically includes the newly created API key and possibly metadata about the user or the key itself.

If the API supports it, binary data output is not expected for this operation.

Dependencies

  • Requires an API key credential to authenticate requests to the Portainer API.
  • The base URL for the API must be configured in the node credentials.
  • The node depends on the Portainer API being accessible and properly configured to allow API key generation for users.

Troubleshooting

  • Missing or invalid user ID: Ensure the "Id" property is set correctly and corresponds to an existing user.
  • Invalid body format: The "Body" property should be a valid string matching the API's expected format.
  • Authentication errors: Verify that the API key credential is valid and has sufficient permissions.
  • API connectivity issues: Check network access to the Portainer API endpoint and confirm the base URL is correct.
  • Permission denied: The authenticated user may lack rights to generate API keys; verify user roles and permissions.

Links and References

Discussion