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

# Create or update a registry credential

> Each registry host can have one stored credential.



## OpenAPI

````yaml /api-reference/openapi.personal.json put /v1/orgs/{slug}/registries
openapi: 3.1.0
info:
  title: Personal token API
  description: User-scoped API for account and organization management.
  version: 0.1.0
servers:
  - url: https://api.microsandbox.dev
security:
  - bearer: []
paths:
  /v1/orgs/{slug}/registries:
    put:
      tags:
        - Registry credentials
      summary: Create or update a registry credential
      description: Each registry host can have one stored credential.
      operationId: upsert_registry_credential
      parameters:
        - name: slug
          in: path
          description: Organization slug
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertRegistryCredentialRequest'
        required: true
      responses:
        '200':
          description: Credential created or updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegistryCredentialResponse'
        '400':
          description: Invalid request
        '401':
          description: Unauthorized
        '403':
          description: Insufficient permissions
      security:
        - bearer: []
components:
  schemas:
    UpsertRegistryCredentialRequest:
      type: object
      description: PUT /v1/orgs/{slug}/registries
      required:
        - registry_host
        - username
        - password
      properties:
        password:
          type: string
          description: >-
            Password or access token. Stored in OpenBao - never persisted to the
            DB.
        registry_host:
          type: string
          description: |-
            Registry host, e.g. `ghcr.io` or `localhost:5000`. Canonicalized
            server-side; Docker Hub aliases fold to `docker.io`.
        username:
          type: string
          description: Registry username.
    RegistryCredentialResponse:
      type: object
      description: Registry credential metadata. Secret values are never returned.
      required:
        - id
        - registry_host
        - username
        - created_at
        - updated_at
      properties:
        created_at:
          type: string
          format: date-time
        id:
          type: string
          format: uuid
        registry_host:
          type: string
        updated_at:
          type: string
          format: date-time
        username:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Personal access token (msb_pat_…) or session JWT - the credential an
        agent acts with on a user's behalf.

````