> ## 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 a site

> Create a site and the locations inside it from another system.

A site is a plant, depot or building your organisation runs, and every asset and work order belongs to
one. This guide adds a site and a location inside it. The examples assume a token in `$TOKEN`, which
[Authentication](/api-reference/authentication) explains how to get.

The account needs permission to create sites. Without it the request is refused with HTTP 403, and
the answer names the permission to add to the identity's role.

## See which sites exist

```bash theme={null}
curl "https://app.assetinfinity.ai/api/sites?select=id,code,name&order=name" \
  -H "Authorization: Bearer $TOKEN"
```

```json theme={null}
[
  { "id": "09b9173b-7f5c-4a56-bd2a-2c7baae757c8", "code": "COL-01", "name": "Columbus Site" },
  { "id": "efe62259-95df-4716-b29f-fe9e972fd22d", "code": "GRN-01", "name": "Greenville Site" }
]
```

Filter by code to check whether a site is already there before you add it: `&code=eq.COL-01`.

## Add the site

Call `create_site` with the site's fields in `p_values`. Only `name` is required.

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/create_site \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"p_values": {"name": "Riverside Depot", "city": "Leeds", "timezone": "Europe/London"}}'
```

The answer is the new site:

```json theme={null}
{
  "id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9",
  "code": "SITE-2026-00001",
  "name": "Riverside Depot",
  "city": "Leeds",
  "timezone": "Europe/London",
  "is_active": true
}
```

The `code` comes from your organisation's numbering, so you do not send one. Keep the `id`: assets,
locations and work orders refer to the site by it.

Fields worth setting at the start:

| Field | Why |
| - | - |
| `timezone` | Due dates, shifts and response-time clocks at the site run on it. An IANA name such as `Europe/London`. Without one the site uses UTC |
| `company_id`, `business_unit_id` | Where the site sits in your organisation, for reporting. Find the ids with `list_options` and `core.companies` or `core.business_units` |
| `address_line1`, `city`, `postal_code`, `country_id` | The address |
| `latitude`, `longitude` | Places the site on the map |
| `site_head_user_id` | Who is accountable for the site |

The **Add a site** page under **Integration API** lists every field. Your organisation's own fields go in
`p_custom_fields`, keyed by the field's key.

<Note>
  If your organisation requires approval for new sites, the answer is `"status": "PENDING_APPROVAL"`
  instead of the site, and the site is created once somebody approves it.
</Note>

## Add a location inside it

Locations are the rooms, areas and lines inside a site. Add one with `create_record`, naming the kind
of record as `core.locations`:

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/create_record \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"p_entity": "core.locations", "p_values": {"name": "Pump house", "site_id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9"}}'
```

```json theme={null}
{
  "id": "723f678f-4907-4c38-ba68-f523d9c38d68",
  "code": "LOC-2026-00001",
  "name": "Pump house",
  "path": "SITE-2026-00001/LOC-2026-00001",
  "site_id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9",
  "parent_id": null
}
```

`name` and `site_id` are required. Set `parent_id` to another location's id to put this one inside it.

## Change a site later

Call `update_record` with `core.sites`, the site's id and only the fields that change:

```bash theme={null}
curl -X POST https://app.assetinfinity.ai/api/rpc/update_record \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"p_entity": "core.sites", "p_id": "a649ba48-4cf1-4f63-9273-a205f12d9ee9", "p_values": {"postal_code": "LS1 4AP"}}'
```

Next: [add an asset](/api-reference/guides/add-an-asset) at the new site.


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