---
title: "Update/create an attribute of a given asset family"
method: PATCH
path: "/api/rest/v1/asset-families/{asset_family_code}/attributes/{code}"
tags: ["Asset attribute"]
---

# Update/create an attribute of a given asset family

`PATCH /api/rest/v1/asset-families/{asset_family_code}/attributes/{code}`

This endpoint allows you to update a given attribute for a given asset family. Note that if the attribute does not already exist for the given asset family, it creates it.

## Path parameters

- `asset_family_code` string, required
- `code` string, required

## Request body

- object
  - `code` string, required — Attribute code
  - `labels` object — Attribute labels for each locale
    - `localeCode` string — Attribute label for the locale `localeCode`
  - `type` 'text' | 'media_link' | 'number' | 'media_file' | 'single_option' | 'multiple_options' | 'boolean' | 'date' | 'record', required — Attribute type. See <a href='/concepts/asset-manager.html#asset-attribute'>type</a> section for more details.
  - `value_per_locale` boolean — Whether the attribute is localizable, i.e. can have one value by locale
  - `value_per_channel` boolean — Whether the attribute is scopable, i.e. can have one value by channel
  - `is_required_for_completeness` boolean — Whether the attribute should be part of the record's completeness calculation
  - `is_read_only` boolean — Whether the attribute should be in read only mode only in the UI, but you can still update it with the API
  - `max_characters` integer — Maximum number of characters allowed for the value of the attribute when the attribute type is `text`
  - `is_textarea` boolean — Whether the UI should display a text area instead of a simple field when the attribute type is `text`
  - `is_rich_text_editor` boolean — Whether the UI should display a rich text editor instead of a simple text area when the attribute type is `text`
  - `validation_rule` 'email' | 'url' | 'regexp' | 'none' — Validation rule type used to validate the attribute value when the attribute type is `text`
  - `validation_regexp` string — Regexp expression used to validate the attribute value when the attribute type is `text`
  - `allowed_extensions` string[] — Extensions allowed when the attribute type is `media_file`
  - `max_file_size` string — Max file size in MB when the attribute type is `media_file`
  - `decimals_allowed` boolean — Whether decimals are allowed when the attribute type is `number`
  - `min_value` string — Minimum value allowed when the attribute type is `number`
  - `max_value` string — Maximum value allowed when the attribute type is `number`
  - `media_type` 'image' | 'pdf' | 'youtube' | 'vimeo' | 'other', required — For the `media_link` attribute type, it is the type of the media behind the url, to allow its preview in the PIM. For the `media_file` attribute type, it is the type of the file.
  - `prefix` string — Prefix of the `media_link` attribute type. The common url root that prefixes the link to the media
  - `suffix` string — Suffix of the `media_link` attribute type. The common url suffix for the media
  - `reference_entity` string — Reference entity code for the `record` attribute type (see <a href='/api-reference-paas-70.html#Referenceentity'>Reference entity</a>).

## Response `201`

Created

## Other responses

- `204` — No content to return
- `401` — Authentication required
- `415` — Unsupported Media type
- `422` — Unprocessable entity

---

[API](https://skmtc.net/akeneo/apis/akeneo-pim-rest-api.md) · [All operations](https://skmtc.net/akeneo/apis/akeneo-pim-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/akeneo/akeneo-pim-rest-api/versions/d8bda9b93b59/schema)
