---
title: "Create Attribute"
method: POST
path: "/metadata/attributes"
tags: ["Metadata"]
---

# Create Attribute

`POST /metadata/attributes`

## Request

- Base URL: `https://api.aspect.inc`
- URL: `https://api.aspect.inc/metadata/attributes`
- Auth: API key in header `Authorization`

Create a new project-specific user attribute (manually populated).

## Request body

- MetadataAttributeCreateRequest: API request schema for creating a metadata attribute.
  - `project_id` string, uuid, required: Project the attribute belongs to
  - `name` string, required: Human-readable name, unique per project
  - `data_type` 'string' | 'integer' | 'float' | 'boolean' | 'datetime' | 'single_select' | 'multi_select' | 'user_id' | 'person_id' | 'object_id' | 'directory_id', required: Type of value an attribute holds. - `string`: Text. - `integer`: A whole number. - `float`: A decimal number. - `boolean`: True or false. - `datetime`: A date and time. - `single_select`: One of the attribute's `options`. - `multi_select`: Any number of the attribute's `options`. - `user_id`: Users. - `person_id`: People recognized in the asset. Used by the built-in People attribute. - `object_id`: Objects recognized in the asset. Used by the built-in Objects attribute. - `directory_id`: The directories containing the asset. Used by the built-in Path attribute.
  - `options` SelectOption[], nullable: The choices of a `single_select` or `multi_select` attribute. Not allowed on other data types.
    - `id` string, uuid
    - `label` string, required
    - `archived` boolean
  - `generation_config` MetadataGenerationConfig: Settings for generating an attribute's values with AI.
    - `prompt` string, required: Prompt template; variables like {{transcript}} must match input_sources
    - `input_sources` GenerationInputSource[], required: Inputs the AI reads when generating a value
    - `watch` Watch: Directories an attribute watches, with an optional asset-type limit. New assets in them are generated automatically as they finish processing, and a `watch` run covers them. The trash directory isn't allowed, and a deleted directory stops matching.
      - `resource_ids` string[], required: Directories whose assets are watched. Use the project's root_directory_id for the whole project
      - `asset_types` AssetType[], nullable: Limit to these asset types; null means every compatible type

## Response `201`

Successful Response

- MetadataAttributeResponse: API response schema for metadata attribute.
  - `id` string, uuid, required: Unique identifier for this attribute
  - `project_id` string, uuid, nullable: Project ID for project-specific attributes, null for system global
  - `name` string, required: Human-readable display name
  - `data_type` 'string' | 'integer' | 'float' | 'boolean' | 'datetime' | 'single_select' | 'multi_select' | 'user_id' | 'person_id' | 'object_id' | 'directory_id', required: Type of value an attribute holds. - `string`: Text. - `integer`: A whole number. - `float`: A decimal number. - `boolean`: True or false. - `datetime`: A date and time. - `single_select`: One of the attribute's `options`. - `multi_select`: Any number of the attribute's `options`. - `user_id`: Users. - `person_id`: People recognized in the asset. Used by the built-in People attribute. - `object_id`: Objects recognized in the asset. Used by the built-in Objects attribute. - `directory_id`: The directories containing the asset. Used by the built-in Path attribute.
  - `options` SelectOption[], nullable: Available options for select types
    - `id` string, uuid
    - `label` string, required
    - `archived` boolean
  - `source` 'system' | 'user' | 'asset', required: Source of metadata attribute or value.
  - `category` string, nullable: Grouping category for UI display
  - `is_filterable` boolean, required: Whether this attribute can be used in filters
  - `is_editable` boolean, required: Whether values for this attribute can be edited through metadata APIs
  - `is_sortable` boolean, required: Whether assets can be sorted by this attribute
  - `generation_config` MetadataGenerationConfig: Settings for generating an attribute's values with AI.
    - `prompt` string, required: Prompt template; variables like {{transcript}} must match input_sources
    - `input_sources` GenerationInputSource[], required: Inputs the AI reads when generating a value
    - `watch` Watch: Directories an attribute watches, with an optional asset-type limit. New assets in them are generated automatically as they finish processing, and a `watch` run covers them. The trash directory isn't allowed, and a deleted directory stops matching.
      - `resource_ids` string[], required: Directories whose assets are watched. Use the project's root_directory_id for the whole project
      - `asset_types` AssetType[], nullable: Limit to these asset types; null means every compatible type
  - `created_by_user_id` string, uuid, nullable: User who created the attribute; null for system attributes and ones created before creators were recorded
  - `created` string, date-time, required: When the attribute was created
  - `updated` string, date-time, required: When the attribute was last updated

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/aspect/apis/aspect-api.md) - [All operations](https://skmtc.dev/aspect/apis/aspect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aspect/apis/aspect-api/revisions/28ea5f1adb54?raw)
