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

# Přejmenovat atribut

> Atomicky přejmenuje klíč atributu a podporovaná závislá data.

## Atomické chování

Handler nejprve vyhodnotí dotčené zdroje a potom provede změnu klíče a podporované závislé migrace v jedné databázové operaci.

* `200` znamená, že atomické přejmenování proběhlo. Úspěšné části `results` mají `code: "ok"`, `error_count: 0` a prázdné pole `errors`.
* `409` znamená, že se neprovedla žádná částečná migrace. Detailní kódy zahrnují konflikt klíče, `rename_busy`, blokující závislosti a `stale_preview`.
* Při opakování požadavku s nejistým výsledkem předejte `attribute_id`. Handler tak najde stejný Attribute i po změně klíče.
* Většina klientů má `expected_impact_revision` vynechat. Zastaralá hodnota vrátí `409 stale_preview`.


## OpenAPI

````yaml openapi.yaml POST /attributes/{key}/rename
openapi: 3.1.0
info:
  title: Lasso API
  description: AI-powered product data extraction and enhancement API
  version: 1.0.0
  contact:
    name: Lasso Support
    url: https://lasso.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://app.productlasso.com/api/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /attributes/{key}/rename:
    parameters:
      - name: key
        in: path
        required: true
        schema:
          type: string
        description: Existing canonical Attribute key.
    post:
      tags:
        - Attributes
      summary: Rename an Attribute key and dependent data
      description: >
        Atomically renames the canonical key and all supported dependent data. A
        successful

        request returns `200`; a blocked, conflicting, busy, or stale rename
        returns `409`

        without applying a partial migration. You can pass `attribute_id` when
        retrying an

        uncertain request so the handler can resolve the same Attribute after
        its key changes.
      operationId: renameAttribute
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - new_key
              properties:
                new_key:
                  type: string
                  pattern: ^[a-zA-Z0-9][a-zA-Z0-9_/]*$
                attribute_id:
                  type: string
                  format: uuid
                  description: >-
                    Stable Attribute ID for retrying an uncertain rename outcome
                    after the key may have changed.
                expected_impact_revision:
                  type: string
                  description: >-
                    Optional optimistic-concurrency token. Most API clients
                    should omit it; an outdated value returns `409
                    stale_preview`.
            example:
              new_key: material_name
      responses:
        '200':
          description: Atomic rename and all dependent migrations completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeRenameResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    AttributeRenameResponse:
      type: object
      required:
        - success
        - partial
        - old_key
        - new_key
        - updated_count
        - error_count
        - attribute
        - results
      properties:
        success:
          type: boolean
          const: true
        partial:
          type: boolean
          const: false
        old_key:
          type: string
        new_key:
          type: string
        updated_count:
          type: integer
          minimum: 0
        error_count:
          type: integer
          const: 0
        attribute:
          $ref: '#/components/schemas/Attribute'
        results:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/AttributeRenameResult'
    Attribute:
      type: object
      additionalProperties: false
      required:
        - id
        - key
        - label
        - type
        - format_output_type
        - enum_values
        - tags_values
        - allow_custom_values
        - boolean_config
        - number_config
        - relation_config
        - description
        - validation
        - language
        - image_config
        - status
        - archived_at
        - is_reviewed
        - source_id
        - external_id
        - source_synced_at
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        label:
          type: string
        type:
          $ref: '#/components/schemas/AttributeType'
        format_output_type:
          oneOf:
            - $ref: '#/components/schemas/FormatOutputType'
            - type: 'null'
          type:
            - string
            - 'null'
          description: >-
            Declared output type for format Attributes; null for all other
            Attribute types.
        enum_values:
          type:
            - array
            - 'null'
          items:
            type: string
        tags_values:
          type:
            - array
            - 'null'
          items:
            type: string
        allow_custom_values:
          type: boolean
          description: Whether table editors may append missing enum or tag choices.
        boolean_config:
          type:
            - object
            - 'null'
          additionalProperties: true
        number_config:
          oneOf:
            - $ref: '#/components/schemas/NumberConfig'
            - type: 'null'
          type:
            - object
            - 'null'
          description: >-
            Present only as metadata; Attribute values returned by APIs remain
            raw numbers.
        relation_config:
          type:
            - object
            - 'null'
          additionalProperties: true
        description:
          type:
            - string
            - 'null'
        validation:
          type:
            - object
            - 'null'
          additionalProperties: true
        language:
          type:
            - string
            - 'null'
        image_config:
          oneOf:
            - $ref: '#/components/schemas/ImageConfig'
            - type: 'null'
          type:
            - object
            - 'null'
        status:
          type: string
          enum:
            - active
            - archived
          description: >-
            Derived from archive state. Archive and restore remain
            Dashboard-only.
        archived_at:
          type:
            - string
            - 'null'
          format: date-time
        is_reviewed:
          type: boolean
        source_id:
          type:
            - string
            - 'null'
          format: uuid
        external_id:
          type:
            - string
            - 'null'
        source_synced_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      examples:
        - id: 11111111-1111-4111-8111-111111111111
          key: product_name
          label: Product name
          type: text
          format_output_type: null
          enum_values: null
          tags_values: null
          allow_custom_values: true
          boolean_config: null
          number_config: null
          relation_config: null
          description: Public product title
          validation: null
          language: en
          image_config: null
          status: active
          archived_at: null
          is_reviewed: true
          source_id: null
          external_id: null
          source_synced_at: null
          created_at: '2026-07-01T00:00:00.000Z'
          updated_at: '2026-07-14T10:00:00.000Z'
    AttributeRenameResult:
      type: object
      required:
        - updated
        - errors
        - error_count
        - code
      properties:
        updated:
          type: integer
          minimum: 0
        errors:
          type: array
          maxItems: 0
          description: Empty for an atomic successful rename.
          items:
            type: string
        error_count:
          type: integer
          const: 0
        code:
          type: string
          const: ok
    Error:
      type: object
      required:
        - status_code
        - error_type
        - message
        - request_id
      properties:
        status_code:
          type: integer
        error_type:
          type: string
          enum:
            - invalid_request
            - unauthenticated
            - forbidden
            - not_found
            - conflict
            - validation_error
            - rate_limited
            - service_unavailable
            - internal_error
        message:
          type: string
        request_id:
          type: string
        code:
          type: string
          description: >-
            Stable machine-readable detail code for validation, conflict, and
            retryable availability errors.
        retryable:
          type: boolean
          description: Whether the request can be retried without changing its payload.
        attribute_id:
          type: string
          format: uuid
          description: Stable Attribute identity when the error is scoped to one Attribute.
        attribute_key:
          type: string
          description: Attribute key when the error is scoped to one Attribute.
        details:
          type: object
          additionalProperties: true
        current_updated_at:
          type: string
          format: date-time
          description: >-
            Current resource revision supplied for client-directed refetch after
            a stale write.
    AttributeType:
      type: string
      enum:
        - text
        - number
        - url
        - email
        - date
        - boolean
        - richtext
        - format
        - enum
        - tags
        - image
        - images
        - file
        - files
        - json
        - relation
    FormatOutputType:
      type: string
      enum:
        - text
        - number
        - boolean
        - json
        - richtext
        - file
        - image
      description: >-
        The stored result type produced by a format Attribute. Format formulas
        execute only in Extraction; Catalog stores the resulting value.
    NumberConfig:
      type: object
      additionalProperties: false
      description: >-
        Presentation metadata for number and Formula-number Attributes. Stored
        and API values remain numeric.
      properties:
        unit:
          type: string
          minLength: 1
          maxLength: 64
          description: Literal, untranslated unit.
        unit_position:
          type: string
          enum:
            - before
            - after
          default: after
        format_style:
          type: string
          enum:
            - dot_plain
            - comma_plain
            - dot_with_comma_grouping
            - comma_with_dot_grouping
            - dot_with_space_grouping
            - comma_with_space_grouping
        file_export:
          type: string
          enum:
            - raw
            - formatted_text
          default: raw
          description: >-
            Applies to CSV/XLSX file exports, including files requested through
            export endpoints. JSON and non-file API or integration values remain
            raw.
    ImageConfig:
      type: object
      additionalProperties: false
      description: Canonical requirements shared by every usage of an image Attribute.
      properties:
        format:
          type: string
          enum:
            - original
            - webp
            - jpeg
            - png
        required_aspect_ratio:
          type: string
          enum:
            - original
            - '1:1'
            - '1:4'
            - '1:8'
            - '2:3'
            - '3:2'
            - '3:4'
            - '4:1'
            - '4:3'
            - '4:5'
            - '5:4'
            - '8:1'
            - '9:16'
            - '16:9'
            - '21:9'
        required_background_color:
          type: string
          enum:
            - white
            - black
          description: Omit to accept any background and preserve existing image behavior.
        max_size_mb:
          type: number
          minimum: 0
        min_width:
          type: number
          minimum: 0
        min_height:
          type: number
          minimum: 0
        max_width:
          type: number
          minimum: 0
        max_height:
          type: number
          minimum: 0
  responses:
    Unauthorized:
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Resource conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: Request validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.