GitLab API

GitlabTool

Actions1000

Overview

This node operation rotates a personal access token in GitLab by making a POST request to the endpoint `/api/v4/personal_access_tokens/{id}/rotate`. It is useful for automating the process of renewing personal access tokens to maintain security without manual intervention.

Use Case Examples

  1. Automatically rotate a personal access token for a GitLab user to ensure continuous access with updated credentials.
  2. Integrate token rotation into a CI/CD pipeline to avoid token expiration issues.

Properties

Name Meaning
Skip Authentication Whether to skip authentication for the request (boolean). Defaults to false.
Authentication The authentication method used for the request, defaulting to GitLab API key authentication.
baseUrl The base URL of the GitLab instance, defaulting to https://gitlab.com.
Method The HTTP method to use for the request, defaulting to GET but here it should be POST for the rotate operation.
Path Parameters The path parameter 'id' specifying the personal access token ID to rotate.

Output

JSON

  • id - The ID of the rotated personal access token.
  • name - The name of the personal access token.
  • revoked - Indicates if the token has been revoked.
  • scopes - The scopes associated with the personal access token.
  • created_at - The creation timestamp of the token.
  • last_used_at - The last usage timestamp of the token.
  • expires_at - The expiration date of the token.
  • token - The new token string after rotation.

Dependencies

  • GitLab API key credential

Troubleshooting

  • Ensure the 'id' path parameter is correctly set to a valid personal access token ID; otherwise, the API call will fail.
  • If authentication is skipped, the request may be unauthorized unless the GitLab instance allows anonymous access to this endpoint.
  • Verify that the baseUrl is correct and reachable to avoid connection errors.
  • Common error messages include 401 Unauthorized (check API key and permissions), 404 Not Found (invalid token ID), and 400 Bad Request (invalid parameters).

Links

Discussion