GitLab API

GitlabTool

Actions1000

Overview

This node operation retrieves personal access tokens (PATs) from the GitLab API (v4). It is useful for scenarios where you need to manage or audit personal access tokens associated with GitLab users, such as filtering tokens by user ID, state, creation date, usage date, or other criteria. For example, an administrator can use this operation to list all active tokens created before a certain date or to find tokens that have not been used recently.

Use Case Examples

  1. List all active personal access tokens for a specific user ID.
  2. Retrieve tokens created after a certain date to audit recent token creation.
  3. Filter tokens by revoked state to identify invalid or disabled tokens.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for testing or public endpoints.
Authentication Specifies the authentication method to use, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance to which the API requests are sent, default is https://gitlab.com.
Method HTTP method to use for the API request, default is GET.
Query Parameters Collection of optional filters and pagination parameters to refine the list of personal access tokens returned by the API.

Output

JSON

  • id - Unique identifier of the personal access token.
  • name - Name of the personal access token.
  • user_id - ID of the user who owns the token.
  • scopes - Scopes or permissions granted by the token.
  • created_at - Timestamp when the token was created.
  • expires_at - Expiration date of the token, if set.
  • revoked - Boolean indicating if the token has been revoked.
  • last_used_at - Timestamp of the last time the token was used.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the GitLab API key credential is correctly configured and has sufficient permissions to access personal access tokens.
  • Verify the base URL is correct and accessible from the n8n environment.
  • Check that query parameters are correctly formatted, especially date-time strings, to avoid API errors.
  • If skipping authentication, ensure the endpoint supports unauthenticated requests, otherwise the request will fail with authorization errors.

Links

Discussion