---
title: Custom Attributes API
path: reference/api/custom-attributes
status: published
---

# Custom Attributes API

Reference for the `Custom Attributes` endpoint group — 5 endpoints.

Generated from the live OpenAPI spec. Re-run `_generate_api_reference.py` after backend changes.

## Authentication

All endpoints require a Bearer JWT in the `Authorization` header unless noted otherwise. See [Concepts → Tokens and scopes](/docs/scaikey/concepts/tokens-and-scopes) and [Reference → OAuth endpoints](/docs/scaikey/reference/oauth-endpoints) for how to obtain one.

## Endpoints

### **GET** `/api/v1/tenants/{tenant_id}/attributes`

_List Attributes_

List custom attribute definitions for the tenant.

**Parameters:**

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `tenant_id` | path | yes | `string` |  |
| `page` | query | no | `integer` |  |
| `per_page` | query | no | `integer` |  |
| `entity_type` | query | no | `string` \| `null` |  |

**Responses:**

| Status | Body |
|---|---|
| `200` | `application/json` → [`PaginatedResponse_CustomAttributeResponse_`](#schema-paginatedresponse-customattributeresponse) |
| `422` | `application/json` → [`HTTPValidationError`](#schema-httpvalidationerror) |

---

### **POST** `/api/v1/tenants/{tenant_id}/attributes`

_Create Attribute_

Create a new custom attribute definition.

**Parameters:**

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `tenant_id` | path | yes | `string` |  |

**Request body:**

Required.

- `application/json` → [`CustomAttributeCreate`](#schema-customattributecreate)

**Responses:**

| Status | Body |
|---|---|
| `201` | `application/json` → [`ApiResponse_CustomAttributeResponse_`](#schema-apiresponse-customattributeresponse) |
| `422` | `application/json` → [`HTTPValidationError`](#schema-httpvalidationerror) |

---

### **DELETE** `/api/v1/tenants/{tenant_id}/attributes/{attribute_id}`

_Delete Attribute_

Delete a custom attribute definition.

Note: This will NOT delete actual attribute values from entities.
Those values will become orphaned and can be cleaned up separately.

**Parameters:**

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `tenant_id` | path | yes | `string` |  |
| `attribute_id` | path | yes | `string` |  |

**Responses:**

| Status | Body |
|---|---|
| `204` | Successful Response |
| `422` | `application/json` → [`HTTPValidationError`](#schema-httpvalidationerror) |

---

### **GET** `/api/v1/tenants/{tenant_id}/attributes/{attribute_id}`

_Get Attribute_

Get a custom attribute definition by ID.

**Parameters:**

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `tenant_id` | path | yes | `string` |  |
| `attribute_id` | path | yes | `string` |  |

**Responses:**

| Status | Body |
|---|---|
| `200` | `application/json` → [`ApiResponse_CustomAttributeResponse_`](#schema-apiresponse-customattributeresponse) |
| `422` | `application/json` → [`HTTPValidationError`](#schema-httpvalidationerror) |

---

### **PATCH** `/api/v1/tenants/{tenant_id}/attributes/{attribute_id}`

_Update Attribute_

Update a custom attribute definition.

**Parameters:**

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `tenant_id` | path | yes | `string` |  |
| `attribute_id` | path | yes | `string` |  |

**Request body:**

Required.

- `application/json` → [`CustomAttributeUpdate`](#schema-customattributeupdate)

**Responses:**

| Status | Body |
|---|---|
| `200` | `application/json` → [`ApiResponse_CustomAttributeResponse_`](#schema-apiresponse-customattributeresponse) |
| `422` | `application/json` → [`HTTPValidationError`](#schema-httpvalidationerror) |

---

## Schemas

Definitions for every type referenced by the endpoints above. Schema-to-schema references on this page link within the page; cross-page references would require visiting the linked page.

### `ApiResponse_CustomAttributeResponse_`

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | [`CustomAttributeResponse`](#schema-customattributeresponse) | yes |  |
| `meta` | [`MetaResponse`](#schema-metaresponse) | no |  |

### `CustomAttributeCreate`

Schema for creating a custom attribute definition.

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | yes |  |
| `display_name` | `string` | yes |  |
| `entity_type` | `string` | yes |  |
| `data_type` | `string` | yes |  |
| `required` | `boolean` | no | Default: `False` |
| `searchable` | `boolean` | no | Default: `False` |
| `visible_in_ui` | `boolean` | no | Default: `True` |
| `include_in_token` | `boolean` | no | Default: `False` |
| `default_value` | _any_ \| `null` | no |  |
| `validation_rules` | object \| `null` | no |  |

### `CustomAttributeResponse`

Custom attribute definition response.

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes |  |
| `name` | `string` | yes |  |
| `display_name` | `string` | yes |  |
| `description` | `string` \| `null` | no |  |
| `entity_type` | `string` | yes |  |
| `data_type` | `string` | yes |  |
| `required` | `boolean` | no | Default: `False` |
| `searchable` | `boolean` | no | Default: `False` |
| `visible_in_ui` | `boolean` | no | Default: `True` |
| `include_in_token` | `boolean` | no | Default: `False` |
| `default_value` | _any_ \| `null` | no |  |
| `validation_rules` | object \| `null` | no |  |
| `created_at` | `string` (`date-time`) | yes |  |
| `updated_at` | `string` (`date-time`) \| `null` | no |  |

### `CustomAttributeUpdate`

Schema for updating a custom attribute definition.

| Field | Type | Required | Description |
|---|---|---|---|
| `display_name` | `string` \| `null` | no |  |
| `required` | `boolean` \| `null` | no |  |
| `searchable` | `boolean` \| `null` | no |  |
| `visible_in_ui` | `boolean` \| `null` | no |  |
| `include_in_token` | `boolean` \| `null` | no |  |
| `default_value` | _any_ \| `null` | no |  |
| `validation_rules` | object \| `null` | no |  |

### `HTTPValidationError`

| Field | Type | Required | Description |
|---|---|---|---|
| `detail` | array of [`ValidationError`](#schema-validationerror) | no |  |

### `MetaResponse`

Metadata included in API responses.

| Field | Type | Required | Description |
|---|---|---|---|
| `request_id` | `string` \| `null` | no |  |
| `timestamp` | `string` (`date-time`) | no |  |

### `PaginatedResponse_CustomAttributeResponse_`

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [`CustomAttributeResponse`](#schema-customattributeresponse) | yes |  |
| `pagination` | [`PaginationMeta`](#schema-paginationmeta) | yes |  |
| `meta` | [`MetaResponse`](#schema-metaresponse) | no |  |

### `PaginationMeta`

Pagination metadata.

| Field | Type | Required | Description |
|---|---|---|---|
| `page` | `integer` | yes |  |
| `per_page` | `integer` | yes |  |
| `total_items` | `integer` | yes |  |
| `total_pages` | `integer` | yes |  |

### `ValidationError`

| Field | Type | Required | Description |
|---|---|---|---|
| `loc` | array of `string` \| `integer` | yes |  |
| `msg` | `string` | yes |  |
| `type` | `string` | yes |  |
