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

# Update a model

> Update the editable fields (name, default prompt) of one of your models.

Updates the editable fields of a model owned by your organization and returns the
updated model. Only `name` and `default_prompt` are editable; ownership and privacy
fields cannot be changed. Omit a field to leave it unchanged — do not send it as an
explicit `null`. Unknown or other-organization ids return
[`404 not_found`](/guides/errors#not_found). Requires the `models.write` scope.


## OpenAPI

````yaml api-reference/openapi.json PATCH /models/{model_id}
openapi: 3.1.0
info:
  title: Samsa API
  description: >-
    The Samsa public REST API. Authenticate with an organization API key as a
    bearer token (`Authorization: Bearer samsa_sk_...`). Errors follow a single
    envelope shape; every response carries an `X-Request-ID`.
  version: 1.0.0
servers:
  - url: https://api.samsa.ai/public/v1
security:
  - BearerAuth: []
paths:
  /models/{model_id}:
    patch:
      tags:
        - Models
      summary: Update one of the organization's models
      description: >-
        Updates the editable fields (`name`, `default_prompt`) of a model owned
        by the API key's organization and returns the updated model. Ownership
        and privacy fields cannot be changed via the API. Unknown,
        other-organization, deleted, or internal models return `404`. Requires
        the `models.write` scope.
      operationId: update_model_models__model_id__patch
      parameters:
        - name: model_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Model Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicModelPatchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicModelDetail'
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: The API key lacks the required scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: >-
            Model not found (unknown id, another organization, deleted, or not
            public).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    PublicModelPatchRequest:
      properties:
        name:
          anyOf:
            - type: string
              maxLength: 100
              minLength: 1
            - type: 'null'
          title: Name
          description: New model name.
          examples:
            - Renamed Model
        default_prompt:
          anyOf:
            - type: string
              maxLength: 2000
            - type: 'null'
          title: Default Prompt
          description: New default prompt / capability description.
          examples:
            - A refined flat-design illustration in the Acme brand palette.
      type: object
      title: PublicModelPatchRequest
      description: >-
        ``PATCH /models/{id}`` body — the publicly editable fields only (ADR
        §10, ticket §3).


        Ownership / privacy fields (``owner_id``, ``private``,
        ``organization_id``) are

        intentionally NOT accepted. A field may be omitted (left unchanged) but
        must not

        be sent as an explicit ``null`` — mirroring ``ApiKeyUpdate``.
    PublicModelDetail:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
          examples:
            - Acme Brand Style
        category:
          anyOf:
            - $ref: '#/components/schemas/PublicModelCategory'
            - type: 'null'
          description: Model category — one of `style`, `object`, `person`, `setting`.
          examples:
            - style
        status:
          $ref: '#/components/schemas/PublicModelStatus'
          description: 'Creation status: `pending`, `processing`, `completed`, or `failed`.'
          examples:
            - completed
        is_ready:
          type: boolean
          title: Is Ready
          description: >-
            True when the model is `completed` AND active — usable for
            generation.
          examples:
            - true
        thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Thumbnail Url
          description: >-
            Presigned, time-limited HTTPS thumbnail URL (null when the model has
            none).
          examples:
            - https://cdn.samsa.ai/models/…/thumbnail.webp?X-Amz-Signature=…
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        reference_image_urls:
          items:
            type: string
          type: array
          title: Reference Image Urls
          description: >-
            Presigned, time-limited HTTPS URLs of the reference images used to
            create the model.
          examples:
            - - https://cdn.samsa.ai/models/…/ref-0.webp?X-Amz-Signature=…
        user_instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: User Instruction
          description: Free-text guidance for how to use the model.
          examples:
            - Use for hero banners and social posts.
        default_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Default Prompt
          description: The model's default prompt / capability description.
          examples:
            - A bold flat-design illustration in the Acme brand palette.
        trigger_words:
          items:
            type: string
          type: array
          title: Trigger Words
          description: Trigger words associated with the model.
          examples:
            - - acme
      type: object
      required:
        - id
        - name
        - status
        - is_ready
        - created_at
        - updated_at
      title: PublicModelDetail
      description: >-
        A single model with full detail — the ``GET /models/{id}`` body (ADR
        §10).
    ErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorEnvelope
      description: The complete public error body — an ``error`` object wrapper (ADR §5).
    PublicModelCategory:
      type: string
      enum:
        - style
        - object
        - person
        - setting
      title: PublicModelCategory
      description: >-
        Public model category (ADR §8.2).


        Maps to the internal ``ModelType`` stored in ``models.type`` (NOT the
        separate

        ``models.category`` column). ``setting`` is the public name for internal

        ``SCENE``; the others are a straight upper/lower-case swap. Internal
        ``BASE`` is

        never exposed publicly.
    PublicModelStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
      title: PublicModelStatus
      description: >-
        Public model creation / readiness status — the lower-cased internal
        status.
    ErrorDetail:
      properties:
        type:
          type: string
          title: Type
          examples:
            - authentication_error
        code:
          type: string
          title: Code
          examples:
            - invalid_api_key
        message:
          type: string
          title: Message
          examples:
            - The provided API key is invalid, expired, or revoked.
        request_id:
          type: string
          title: Request Id
          examples:
            - 8f14e45fceea167a5a36dedd4bea2543
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: Present on validation errors — names the offending field.
          examples:
            - aspect_ratio
      type: object
      required:
        - type
        - code
        - message
        - request_id
      title: ErrorDetail
      description: The ``error`` object of the public envelope (ADR §5).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key as a bearer token: `Authorization: Bearer
        samsa_sk_...`.

````