# Dynamic Lookup Table API (Attribute Library)

This guide explains how to **create and update Attribute Library (lookup table) values** using the Nected Dev API. Use it for **bulk updates**, **automation**, and **syncing lookup values** from external systems.

You can try the APIs from the [**Postman collection**](https://www.postman.com/tech-team-1209/nected-public-workspace/folder/39497877-8315ee59-1397-4239-865c-82340e44ed94)**.**

If you want to work with Dynamic Lookup table from the UI, please follow this doc: [Dynamic Lookup table](/nected-docs/references/attribute-library/dynamic-lookup-table.md).

***

### Why Use the API?

Use the API when you need:

* **Bulk updates** (large value lists in one or a few calls)
* **Automated sync** from your systems of record
* **CI/CD / environment promotion** of lookup values
* **Programmatic governance** with controlled access and auditability

***

### Prerequisites

**Headers**

```http
Nected-API-Key: <YOUR_API_KEY>
Content-Type: application/json
```

Optional (when using branches):

```http
Nected-Branch: <branchName>
```

**Base URL**

Use your Nected API base URL (e.g., `https://api.nected.ai`). All endpoints below use the `/dev/v1/` prefix.

**Entity type for Attribute Library**

Use the entity type that represents Attribute Library in the API (e.g., `attribute-library`). Replace `{entity-type}` below with this value.

***

### API Endpoints Overview

| Method | Endpoint                                     | Description                                                       |
| ------ | -------------------------------------------- | ----------------------------------------------------------------- |
| GET    | `/dev/v1/{entity-type}`                      | List all attribute library groups (paginated).                    |
| POST   | `/dev/v1/{entity-type}`                      | Create a new attribute library group (and optionally attributes). |
| GET    | `/dev/v1/{entity-type}/{entity-id}`          | Get one attribute library group and its attributes.               |
| PATCH  | `/dev/v1/{entity-type}/{entity-id}`          | Update a group (name, attributes, predefined values).             |
| POST   | `/dev/v1/{entity-type}/{entity-id}/publish`  | Publish the entity (make the current draft active).               |
| POST   | `/dev/v1/{entity-type}/{entity-id}/schedule` | Create or update a schedule (if supported).                       |
| POST   | `/dev/v1/{entity-type}/{entity-id}/test`     | Validate configuration without publishing.                        |
| GET    | `/dev/v1/{entity-type}/{entity-id}/version`  | List all published versions.                                      |

For exact schemas and supported fields, refer to your environment’s API reference.

***

### 1. List Attribute Library Groups

**Request**

```http
GET /dev/v1/{entity-type}
```

**Query parameters** (typical)

| Param      | Type    | Default | Description                          |
| ---------- | ------- | ------- | ------------------------------------ |
| `pageNo`   | integer | 1       | Page number (1-based).               |
| `pageSize` | integer | 10      | Items per page.                      |
| `name`     | string  | -       | Filter by group name (if supported). |

**Example: cURL**

```bash
curl --location "https://api.nected.ai/dev/v1/attribute-library?pageNo=1&pageSize=20" \
  --header "Nected-API-Key: <YOUR_API_KEY>"
```

***

### 2. Create an Attribute Library Group

**Request**

```http
POST /dev/v1/{entity-type}
```

**Example: cURL**

```bash
curl --location "https://api.nected.ai/dev/v1/attribute-library" \
  --header "Nected-API-Key: <YOUR_API_KEY>" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "OrderAttributes",
    "attributes": [
      {
        "name": "OrderStatus",
        "dataType": "String",
        "predefinedValues": ["Pending", "Approved", "Rejected", "Need Manual Check"],
        "usage": "Mandatory"
      }
    ]
  }'
```

Save the returned `id` as `entity-id` for get, update, publish, and other operations.

***

### 3. Get a Single Attribute Library Group

**Request**

```http
GET /dev/v1/{entity-type}/{entity-id}
```

Use this response as the basis for updates.

***

### 4. Update a Group (Including Predefined Values)

**Request**

```http
PATCH /dev/v1/{entity-type}/{entity-id}
```

**Example: cURL (update predefined values for one attribute)**

```bash
curl --location --request PATCH "https://api.nected.ai/dev/v1/attribute-library/<entity-id>" \
  --header "Nected-API-Key: <YOUR_API_KEY>" \
  --header "Content-Type: application/json" \
  --data '{
    "attributes": [
      {
        "name": "OrderStatus",
        "predefinedValues": ["Pending", "Approved", "Rejected", "Need Manual Check", "Cancelled"],
        "usage": "Mandatory"
      }
    ]
  }'
```

**Important**: After creation, APIs typically allow only **value** and **usage** changes (not name or data type), consistent with UI behavior.

***

### 5. Publish an Attribute Library Group

**Request**

```http
POST /dev/v1/{entity-type}/{entity-id}/publish
```

Publish after PATCH so rules/workflows use the new values.

***

### 6. Create or Update Schedule

**Request**

```http
POST /dev/v1/{entity-type}/{entity-id}/schedule
```

See the Schedule API for the exact schema.

***

### 7. Test an Attribute Library Entity

**Request**

```http
POST /dev/v1/{entity-type}/{entity-id}/test
```

Use this to validate changes before publishing.

***

### 8. List Published Versions

**Request**

```http
GET /dev/v1/{entity-type}/{entity-id}/version
```

***

### Response Structure and Errors

Typical response fields:

| Field                                            | Type   | Description                 |
| ------------------------------------------------ | ------ | --------------------------- |
| `code`                                           | string | e.g. `success` or `error`.  |
| `data`                                           | object | Response payload.           |
| `message`                                        | string | Human-readable message.     |
| `pageNo`, `pageSize`, `totalCount`, `totalPages` | number | Present for list endpoints. |

Common errors:

| HTTP | Meaning         | Action                                |
| ---- | --------------- | ------------------------------------- |
| 400  | Invalid request | Validate body and params.             |
| 401  | Unauthorized    | Check `Nected-API-Key`.               |
| 404  | Not found       | Verify `entity-type` and `entity-id`. |
| 500  | Server error    | Retry or contact support.             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nected.ai/nected-docs/management-api/dynamic-lookup-table-api-attribute-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
