GitLab API icon

GitLab API

Gitlab

Actions917

Overview

This node operation allows creating a new access token for a specific GitLab project by making a POST request to the GitLab API endpoint `/api/v4/projects/{id}/access_tokens`. It is useful for automating the management of project access tokens, enabling secure and programmatic access to GitLab projects. For example, it can be used in CI/CD pipelines or administrative workflows to generate tokens without manual intervention.

Use Case Examples

  1. Creating a new access token for a project to allow automated scripts to interact with the GitLab repository.
  2. Automating token creation for multiple projects in bulk to streamline access management.

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, defaulting to https://gitlab.com.
Method HTTP method to use for the request, default is POST for this operation.
Path Parameters Parameters to be included in the request path, specifically the project ID (`id`) which is required to identify the project for which the access token is created.

Output

JSON

  • id - The unique identifier of the created access token.
  • name - The name assigned to the access token.
  • token - The actual access token string used for authentication.
  • scopes - The scopes or permissions granted to the access token.
  • created_at - Timestamp when the access token was created.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the project ID (`id`) path parameter is correctly provided and corresponds to an existing project in GitLab.
  • Verify that the authentication credentials (GitLab API key) are valid and have sufficient permissions to create access tokens.
  • Check the base URL if using a self-hosted GitLab instance to ensure it is correct.
  • Common error messages include 401 Unauthorized (invalid or missing credentials), 404 Not Found (invalid project ID), and 400 Bad Request (invalid request body). Resolving these involves correcting credentials, project ID, or request parameters.

Links

Discussion