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

# Store a Personal Access Token (PAT) for ghcr.io

> Stores a GitHub Personal Access Token with read:packages scope. This is REQUIRED for scanning private or internal container images, as GitHub App tokens cannot pull these packages from ghcr.io. The token is encrypted before storage.



## OpenAPI

````yaml post /integrations/github-container-registry/organization/{organizationId}/pat
openapi: 3.0.0
info:
  title: Cybedefend API
  description: >-
    CybeDefend is an advanced API for application security analysis. Key
    features include OAuth 2.0 authentication, user/organization/project
    management, and REBAC-based permissions. It excels in static, dynamic, and
    IaC security analyses (SAST, DAST, IaC, etc.).
  version: '1.0'
  contact: {}
servers:
  - url: https://api-eu.cybedefend.com
    description: EU
  - url: https://api-us.cybedefend.com
    description: US
security: []
tags: []
paths:
  /integrations/github-container-registry/organization/{organizationId}/pat:
    post:
      tags:
        - GitHub Container Registry
      summary: Store a Personal Access Token (PAT) for ghcr.io
      description: >-
        Stores a GitHub Personal Access Token with read:packages scope. This is
        REQUIRED for scanning private or internal container images, as GitHub
        App tokens cannot pull these packages from ghcr.io. The token is
        encrypted before storage.
      operationId: GithubContainerRegistryOrganizationController_storePat
      parameters:
        - name: organizationId
          required: true
          in: path
          description: CybeDefend organization ID
          schema:
            format: uuid
            example: 550e8400-e29b-41d4-a716-446655440000
            type: string
      requestBody:
        required: true
        description: PAT to store
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreGithubPatDto'
      responses:
        '200':
          description: PAT stored and validated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoreGithubPatResponseDto'
        '400':
          description: Bad request - Invalid PAT or missing required scopes
          content:
            application/json:
              schema:
                example:
                  message: Bad Request
                  statusCode: 400
                  timestamp: '2025-02-18T12:31:18.491Z'
                  path: /example/path
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                example:
                  message: Unauthorized
                  statusCode: 401
                  timestamp: '2025-02-18T12:31:18.491Z'
                  path: /example/path
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                example:
                  message: Forbidden
                  statusCode: 403
                  timestamp: '2025-02-18T12:31:18.491Z'
                  path: /example/path
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                example:
                  message: Internal server error
                  statusCode: 500
                  timestamp: '2025-02-18T12:31:18.491Z'
                  path: /example/path
components:
  schemas:
    StoreGithubPatDto:
      type: object
      properties:
        pat:
          type: string
          description: >-
            Personal Access Token with read:packages scope. Required for
            scanning private/internal packages.
          example: ghp
      required:
        - pat
    StoreGithubPatResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the PAT was stored successfully
          example: true
        message:
          type: string
          description: Message describing the result
          example: PAT stored and validated successfully
        status:
          description: Validation result (if validation was performed)
          allOf:
            - $ref: '#/components/schemas/GithubPatStatusDto'
      required:
        - success
        - message
    GithubPatStatusDto:
      type: object
      properties:
        valid:
          type: boolean
          description: Whether the PAT is valid
          example: true
        githubUsername:
          type: string
          description: GitHub username associated with the PAT
          example: my-github-user
        scopes:
          description: PAT scopes
          example:
            - read:packages
            - repo
          type: array
          items:
            type: string
        expiresAt:
          type: string
          description: PAT expiration date (if applicable, empty if never expires)
          example: '2025-12-31T23:59:59Z'
        validatedAt:
          type: string
          description: Last validation timestamp
          example: '2025-01-16T12:00:00Z'
        errorMessage:
          type: string
          description: Error message if validation failed
          example: Token expired
        hasPackagesReadScope:
          type: boolean
          description: Whether the PAT has read:packages scope (required for ghcr.io)
          example: true
      required:
        - valid
        - scopes
        - hasPackagesReadScope

````