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

# Add an asset

> Add an asset to the register, correct it, move it and change its status from another system.

This guide adds an asset to the register, then corrects it, moves it and changes its status. The
examples assume a token in `$TOKEN` ([Authentication](/api-reference/authentication)) and a site to
put the asset at ([Add a site](/api-reference/guides/add-a-site)).

## Find the ids you need

An asset needs three things: a name, a category and a site. The category and site are sent as ids.

Find the category by searching for it:

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/list_options \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"p_entity": "core.asset_categories", "p_search": "pump"}'
```

```json theme={null}
[{ "id": "7cd4438d-33c9-4d3f-9892-64b10ab6ac87", "label": "Centrifugal Pump", "path": "Rotating Equipment › Centrifugal Pump", "depth": 1 }]
```

If you already know the category's code, filter the list by it instead:
`/asset_categories?select=id,code,name&code=eq.PUMP-CENT`. Find the site the same way, with
`/sites?select=id&code=eq.<code>`.

## Add the asset

Call `create_asset` with the asset's fields in `p_values`:

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/create_asset \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
        "p_values": {
          "name": "Cooling water pump 2",
          "asset_category_id": "7cd4438d-33c9-4d3f-9892-64b10ab6ac87",
          "site_id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9",
          "serial_number": "CWP-22817"
        }
      }'
```

The answer is the new asset. Its number comes from your organisation's numbering and its status is the
first one in its lifecycle, so you send neither:

```json theme={null}
{
  "id": "d54f41c3-a627-4429-826a-c82cbbecae2b",
  "asset_number": "AST-2026-00001",
  "name": "Cooling water pump 2",
  "site_id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9",
  "status_id": "9c64fccf-d5ad-4d8a-87d7-bca05eeb84a9"
}
```

The **Add an asset** page under **Integration API** lists every field `p_values` accepts, with what each
one means. Some you will often want:

| Field | What it is |
| - | - |
| `location_id` | Where in the site the asset is. A location belongs to a site, so send the matching `site_id` too |
| `parent_asset_id` | The asset this one is part of, such as the line a motor sits on |
| `serial_number`, `asset_model_id` | What it is, exactly |
| `criticality_id` | How much its failure matters. Some organisations require more information to close work on a critical asset |
| `commissioning_date` | When it entered service |

Your organisation's own fields go in `p_custom_fields`, keyed by the field's key. The keys are your
organisation's, so `production_line` here stands for one of yours:

```json theme={null}
{ "p_values": { … }, "p_custom_fields": { "production_line": "Line 3" } }
```

### If it is refused

A field the register does not have, or a required one left out, is refused before anything is
written:

```json theme={null}
{ "message": "Category, Site is required",
  "details": "{\"fields\": [\"Category\", \"Site\"], \"error_code\": \"MISSING_FIELD\"}" }
```

```json theme={null}
{ "message": "colour cannot be set here",
  "details": "{\"fields\": [\"colour\"], \"error_code\": \"UNKNOWN_FIELD\"}" }
```

[Errors](/api-reference/errors) explains the rest.

## Read it back

```bash theme={null}
curl "https://app.assetinfinity.ai/api/assets?select=id,asset_number,name,status,site_name,asset_category&asset_number=eq.AST-2026-00001" \
  -H "Authorization: Bearer $TOKEN"
```

```json theme={null}
[{ "id": "d54f41c3-a627-4429-826a-c82cbbecae2b", "asset_number": "AST-2026-00001", "name": "Cooling water pump 2",
   "status": "PLANNED", "site_name": "Riverside Depot", "asset_category": "Centrifugal Pump" }]
```

## Correct it, move it, change its status

| To | Call | Send |
| - | - | - |
| Correct its details | `update_asset` | `p_asset_id`, and `p_values` with only the fields that change |
| Move it to another site or location | `move_asset` | `p_asset_id`, `p_to_site_id` or `p_to_location_id`, and a `p_reason` |
| Change its status | `transition_asset` | `p_asset_id` and `p_to_state_code`, such as `ACTIVE` |

`update_asset` refuses a change of site or location with `MOVE_INSTEAD`. Moving an asset is
`move_asset`, which keeps a record of where the asset came from. Putting an asset into a closed status,
such as disposed, cancels the open work against it, and the answer lists what was cancelled.

Your organisation can ask for more before some statuses. In the demo organisation an asset needs a
custodian before it becomes active, so `transition_asset` to `ACTIVE` is refused with
`CUSTODIAN_REQUIRED` and `"fields": ["custodian_user_id"]` until one is set with `update_asset`.

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/move_asset \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"p_asset_id": "d54f41c3-a627-4429-826a-c82cbbecae2b", "p_to_location_id": "723f678f-4907-4c38-ba68-f523d9c38d68", "p_reason": "Installed in the pump house"}'
```

Next: [raise and complete work](/api-reference/guides/raise-and-complete-work) against the asset.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.