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

# Update custom attribute definition

> Update an existing custom attribute definition. Note: attribute_key_name and data_type are generally not updatable after creation.



## OpenAPI

````yaml /openAPI/openapi-20240301.json patch /custom_attributes/{definition_id}
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /custom_attributes/{definition_id}:
    patch:
      tags:
        - Custom Attributes
      summary: Update custom attribute definition
      description: >-
        Update an existing custom attribute definition. Note: attribute_key_name
        and data_type are generally not updatable after creation.
      operationId: Update-custom-attribute-definition
      parameters:
        - name: definition_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Definition Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomAttributeDefinitionUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomAttributeDefinitionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CustomAttributeDefinitionUpdate:
      properties:
        attribute_key_name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Attribute Key Name
          description: >-
            A unique system identifier for the attribute (e.g., customer_tier,
            internal_notes).
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: A user-friendly label for the attribute shown in the UI.
        module:
          anyOf:
            - $ref: '#/components/schemas/ModuleEnum'
            - type: 'null'
          description: >-
            The module this custom attribute belongs to (e.g., customer,
            products, contracts).
        data_type:
          anyOf:
            - $ref: '#/components/schemas/DataTypeEnum'
            - type: 'null'
          description: The type of data the attribute will store.
        business_entity_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Business Entity Id
          description: >-
            If populated, this definition is an entity-specific addition or
            override.
        is_tag:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Tag
          description: If TRUE, this attribute is a Tag. Tags must have data_type = ENUM.
        enum_choices:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Enum Choices
          description: If data_type is ENUM, this stores the list of valid string choices.
        default_value:
          anyOf:
            - {}
            - type: 'null'
          title: Default Value
          description: >-
            An optional default value for the attribute. Must conform to
            data_type and be one of enum_choices if applicable.
        is_required:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Required
          description: Indicates if a value is mandatory for this attribute.
        is_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Enabled
          description: Whether the attribute definition is currently active.
        sort_order:
          anyOf:
            - type: integer
            - type: 'null'
          title: Sort Order
          description: 'Optional: for controlling display order in UIs.'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: 'Optional: further description or help text for the attribute.'
      type: object
      title: CustomAttributeDefinitionUpdate
    CustomAttributeDefinitionResponse:
      properties:
        attribute_key_name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Attribute Key Name
          description: >-
            A unique system identifier for the attribute (e.g., customer_tier,
            internal_notes).
        display_name:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Display Name
          description: A user-friendly label for the attribute shown in the UI.
        module:
          anyOf:
            - $ref: '#/components/schemas/ModuleEnum'
            - type: 'null'
          description: >-
            The module this custom attribute belongs to (e.g., customer,
            products, contracts).
        data_type:
          anyOf:
            - $ref: '#/components/schemas/DataTypeEnum'
            - type: 'null'
          description: The type of data the attribute will store.
        business_entity_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Business Entity Id
          description: >-
            If populated, this definition is an entity-specific addition or
            override.
        is_tag:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Tag
          description: If TRUE, this attribute is a Tag. Tags must have data_type = ENUM.
        enum_choices:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Enum Choices
          description: If data_type is ENUM, this stores the list of valid string choices.
        default_value:
          anyOf:
            - {}
            - type: 'null'
          title: Default Value
          description: >-
            An optional default value for the attribute. Must conform to
            data_type and be one of enum_choices if applicable.
        is_required:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Required
          description: Indicates if a value is mandatory for this attribute.
        is_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Enabled
          description: Whether the attribute definition is currently active.
        sort_order:
          anyOf:
            - type: integer
            - type: 'null'
          title: Sort Order
          description: 'Optional: for controlling display order in UIs.'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: 'Optional: further description or help text for the attribute.'
        id:
          type: string
          format: uuid
          title: Id
        organisation_id:
          type: string
          format: uuid
          title: Organisation Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        business_entity:
          anyOf:
            - $ref: '#/components/schemas/BusinessEntityResponseSchema'
            - type: 'null'
      type: object
      required:
        - id
        - organisation_id
        - created_at
        - updated_at
      title: CustomAttributeDefinitionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ModuleEnum:
      type: string
      enum:
        - customers
        - products
        - contracts
        - plans
        - invoices
        - payments
      title: ModuleEnum
    DataTypeEnum:
      type: string
      enum:
        - STRING
        - INTEGER
        - FLOAT
        - BOOLEAN
        - LIST_STRING
        - ENUM
        - JSON
        - DATE
      title: DataTypeEnum
    BusinessEntityResponseSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Business Entity ID
        name:
          type: string
          title: Name
          description: Business Entity Name
        address:
          anyOf:
            - $ref: '#/components/schemas/EntityAddress'
            - type: 'null'
          description: Business Entity address
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: Business Entity email
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
          title: Phone Number
          description: Business Entity phone number
        is_default:
          type: boolean
          title: Is Default
          description: Business Entity default
        tax_config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tax Config
          description: Business Entity tax config
        logo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Logo Url
          description: Business Entity logo URL
      type: object
      required:
        - id
        - name
        - is_default
      title: BusinessEntityResponseSchema
      description: Business Entity Response Schema
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    EntityAddress:
      properties:
        line1:
          anyOf:
            - type: string
            - type: 'null'
          title: Line1
          description: Line 1
        line2:
          anyOf:
            - type: string
            - type: 'null'
          title: Line2
          description: Line 2
        line3:
          anyOf:
            - type: string
            - type: 'null'
          title: Line3
          description: Line 3
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: City
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: State
        zipCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Zipcode
          description: Zip Code
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
          description: Country
        validation_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Validation Status
          description: Address Validation Status
      type: object
      title: EntityAddress
      description: Address Schema
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````