GitLab API icon

GitLab API

Gitlab

Actions1062

Users → postApiV4UsersUserIdKeys

AI-generated

Summary

Adds an SSH public key to a specified GitLab user via the API endpoint POST /api/v4/users/{user_id}/keys.

Inputs

  • user_id (required) — The numeric ID or username of the GitLab user to which the key will be added. Provided as a path parameter.
  • requestBody (required) — The SSH key details to create. Must conform to GitLab’s user key definition (typically includes title and key fields; refer to the node’s request body schema for the exact structure).
  • skipAuthentication — If set to true, bypasses the configured GitLab API credential and performs a raw request; otherwise uses the gitlabApi credential.
  • baseUrl — Alternative base URL for the GitLab instance (e.g., a self‑hosted GitLab server). Defaults to https://gitlab.com.
  • method — HTTP method selector; for this operation the underlying OpenAPI definition uses POST, so the value should remain POST (the default).

Output shape

object

Returns the created SSH key object as defined by the GitLab API, containing fields such as id, title, key, created_at, and other metadata.

Examples

Example 1: Add a new SSH key for user 42

Set Path Parameters → user_id to 42, provide request body with title: "Work laptop" and key: "ssh‑rsa AAAAB3…", leave Skip Authentication off, and execute.

Links

Discussion