GitLab API icon

GitLab API

Gitlab

Actions880

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.

Use Case Examples

  1. Automatically add SSH keys to a user's GitLab account during onboarding.
  2. Manage user SSH keys in bulk by integrating with GitLab API through n8n workflows.

Properties

Name Meaning
Skip Authentication Option to skip authentication for the request, useful for public or unauthenticated 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 GET but POST is used for this operation.
Path Parameters Parameters to be included in the request path, specifically the user_id to identify the user for whom the SSH key is being created.

Output

JSON

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

Dependencies

  • GitLab API key credential for authentication

Troubleshooting

  • Ensure the user_id path parameter is correctly provided and corresponds to an existing user in GitLab.
  • Verify that the API key used for authentication has sufficient permissions to create SSH keys for users.
  • Check the baseUrl is correctly set to the GitLab instance URL if using a self-hosted GitLab.
  • Common error messages include 401 Unauthorized (authentication failure), 404 Not Found (user not found), and 400 Bad Request (invalid key data). Resolving these involves verifying credentials, user existence, and request payload respectively.

Links

Discussion