> ## Documentation Index
> Fetch the complete documentation index at: https://gecko.security/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotate the GitLab service-account token

> Validates the token against the GitLab instance (including the required "api" scope) before storing it. Omit `instance_url` to keep the currently connected instance.



## OpenAPI

````yaml /api-reference/openapi.json patch /integrations/gitlab
openapi: 3.1.0
info:
  title: Gecko Security API
  version: 1.0.0
  description: >-
    Programmatic access to scans, vulnerabilities, repositories, schedules,
    webhooks, and scanner image releases. Authenticate with an API key via the
    `X-API-Key` header or `Authorization: Bearer <key>`.
servers:
  - url: https://app.gecko.security/api/v1
security:
  - ApiKeyHeader: []
  - BearerAuth: []
paths:
  /integrations/gitlab:
    patch:
      summary: Rotate the GitLab service-account token
      description: >-
        Validates the token against the GitLab instance (including the required
        "api" scope) before storing it. Omit `instance_url` to keep the
        currently connected instance.
      parameters:
        - name: Idempotency-Key
          in: header
          description: >-
            Safely retry a POST/PATCH; a replayed key returns the original
            response.
          schema:
            type: string
            maxLength: 255
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateGitLabIntegrationRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GitLabIntegration'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Authorization error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UpdateGitLabIntegrationRequest:
      type: object
      properties:
        access_token:
          type: string
          minLength: 1
        instance_url:
          type: string
          minLength: 1
      required:
        - access_token
      additionalProperties: false
    GitLabIntegration:
      type: object
      properties:
        object:
          type: string
          const: gitlab_integration
        enabled:
          type: boolean
        instance_url:
          anyOf:
            - type: string
            - type: 'null'
        auth_mode:
          anyOf:
            - type: string
              enum:
                - service_account_token
                - oauth
            - type: 'null'
        token_expires_at:
          anyOf:
            - type: string
            - type: 'null'
        last_validated_at:
          anyOf:
            - type: string
            - type: 'null'
        tracked_repositories_count:
          type: integer
          minimum: 0
          maximum: 9007199254740991
      required:
        - object
        - enabled
        - instance_url
        - auth_mode
        - token_expires_at
        - last_validated_at
        - tracked_repositories_count
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            param:
              type: string
            doc_url:
              type: string
            request_id:
              type: string
          required:
            - type
            - code
            - message
            - doc_url
            - request_id
      required:
        - error
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    BearerAuth:
      type: http
      scheme: bearer

````