GitLab API

GitlabTool

Actions905

Overview

This node operation allows creating a new SSH key for a specific user in GitLab by making a POST request to the GitLab API endpoint `/api/v4/users/{user_id}/keys`. It is useful for automating user key management in GitLab, such as adding SSH keys for users programmatically. For example, it can be used in DevOps workflows to provision access keys for new team members automatically.

Use Case Examples

  1. Automate adding SSH keys for new GitLab users during onboarding.
  2. Manage user SSH keys in bulk by integrating with user management systems.

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 to which the request is sent. Defaults to https://gitlab.com.
Method The HTTP method used for the request. For this operation, it is POST.
Path Parameters The path parameters for the request, specifically the user_id of the GitLab user to whom the SSH key will be added.

Output

JSON

  • id - The unique identifier of the created SSH key.
  • title - The title of the SSH key.
  • key - The SSH public key content.
  • created_at - Timestamp when the SSH key was created.
  • user_id - The ID of the user to whom the key belongs.

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the user_id path parameter is correctly set and corresponds to an existing GitLab user.
  • Verify that the API key used has sufficient permissions to add SSH keys to users.
  • Check the format and validity of the SSH key provided in the request body to avoid rejection by the API.
  • Common error messages include 401 Unauthorized (invalid or missing API key), 404 Not Found (user_id does not exist), and 400 Bad Request (invalid SSH key format).

Links

Discussion