GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Go to GitLab Docs homepage
  • What's new?
  • Get free trial
  • Use GitLab
  • GitLab Duo
  • GitLab Orbit
  • Extend
  • Install
  • Administer
  • Subscribe
  • Contribute
  • Solutions
  • Getting started
  • Tutorials

This view

  • Original page
  • New address

GeezerVison is showing docs.gitlab.com — Secrets Manager API | GitLab Docs

 / 

Secrets Manager API

  • Tier: Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed
  • Status: Beta
  • Introduced in GitLab 19.2 with a flag named secrets_manager_api_access. Disabled by default.

Use this API to access GitLab Secrets Manager secrets from external services and tools.

The API mints a short-lived JSON web token (JWT) for a project or group. A client presents this token to the OpenBao backend to read secrets directly, the same way GitLab Runner reads secrets during a CI/CD job. The response includes the OpenBao connection details the client needs.

You call this API with a personal access token, project or group access token, or service account token that has the api scope. The token the API returns is a separate, short-lived OpenBao JWT, not a GitLab access token. It expires after five minutes. Reading a secret value also requires the principal to have the read value permission for that secret.

To use the returned connection details to read a secret, see access secrets from external tools.

Create a Secrets Manager access token for a project

Mints an access token for reading a project’s secrets.

POST /projects/:id/secrets_manager/access_token

Supported attributes:

AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the project.

Example request:

shell
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/secrets_manager/access_token"

Example response:

json
{
  "expires_at": "2026-05-27T10:35:00Z",
  "provider": {
    "vault": {
      "server": "https://secrets.gitlab.com",
      "namespace": "org_5/group_42/project_99",
      "path": "secrets/kv",
      "version": "v2",
      "secrets_path": "explicit",
      "auth": {
        "jwt": {
          "path": "api_jwt/cel",
          "role": "all_api",
          "token": "<JWT>"
        }
      }
    }
  }
}

Response attributes:

AttributeTypeDescription
expires_atstringISO 8601 timestamp when the token expires. Tokens are valid for five minutes.
provider.vault.serverstringURL of the OpenBao server to connect to. On GitLab.com this is https://secrets.gitlab.com. On GitLab Self-Managed it is the OpenBao URL configured for the instance.
provider.vault.namespacestringOpenBao namespace that holds the project’s secrets. Pass it as the X-Vault-Namespace header.
provider.vault.pathstringMount path of the KV secrets engine.
provider.vault.versionstringVersion of the KV secrets engine.
provider.vault.secrets_pathstringBase path under the KV engine where secrets are stored. Prepend it to a secret name to build the read path (<path>/data/<secrets_path>/<secret_name>).
provider.vault.auth.jwt.pathstringMount path for the JWT authentication method. Authenticate at auth/<path>/login.
provider.vault.auth.jwt.rolestringJWT authentication role to log in with.
provider.vault.auth.jwt.tokenstringShort-lived JWT the client presents to OpenBao.

Create a Secrets Manager access token for a group

Mints an access token for reading a group’s secrets.

POST /groups/:id/secrets_manager/access_token

Supported attributes:

AttributeTypeRequiredDescription
idinteger or stringYesThe ID or URL-encoded path of the group.

Example request:

shell
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/1/secrets_manager/access_token"

Example response:

json
{
  "expires_at": "2026-05-27T10:35:00Z",
  "provider": {
    "vault": {
      "server": "https://secrets.gitlab.com",
      "namespace": "org_5/group_42/group_99",
      "path": "secrets/kv",
      "version": "v2",
      "secrets_path": "explicit",
      "auth": {
        "jwt": {
          "path": "api_jwt/cel",
          "role": "all_api",
          "token": "<JWT>"
        }
      }
    }
  }
}

The response attributes are the same as for Create a Secrets Manager access token for a project, with provider.vault.namespace scoped to the group.

Was this page helpful?
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.