# Creating a custom asset

An asset represents a trackable unit with a clear business purpose. While assets are stored in the system independently, using them involves assigning them activated GPS devices — or, in the API terms, **inventory items**. Multiple items can be assigned to a single asset.

Each asset belongs to a specific type that defines its structure and allows you to add user-defined properties called **custom fields**. Those asset types act as templates that determine what information can be stored for each category of asset.

In this guide, you will learn how to create and configure a custom asset.

### How to create a custom asset

{% hint style="warning" %}
Note that {BASE\_URL} in sample requests is a placeholder for the URL you'll be using, which depends on your geographical location and the current version of the API. To learn the specific server URLs, see [API environments](https://www.navixy.com/docs/navixy-repository-api/technical-reference#api-environments).
{% endhint %}

#### Step 1. Create an asset type

Each asset is based on an asset type — the schema that determines its properties. If your asset is a Ford F-150, your asset type might be called "Pickup Truck." This guide describes creating a commercial vessel.

## The AssetType object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Repository API","version":"0.1.0"},"components":{"schemas":{"AssetType":{"description":"The Asset type","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier for the asset type"},"label":{"type":"string","description":"The asset type label"},"category":{"type":"string","description":"The category of asset type","enum":["business","geo"]},"settings":{"$ref":"#/components/schemas/AssetSettings"},"fields":{"type":"array","description":"A list of custom fields of the asset type","items":{"$ref":"#/components/schemas/CustomField"}},"created_at":{"type":"string","format":"date-time","description":"Date and time at which the asset type was created"}},"required":["category","created_at","fields","id","label"]},"AssetSettings":{"description":"Describes the layout of sections and fields for the entity type","properties":{"layout":{"$ref":"#/components/schemas/Layout"}}},"Layout":{"description":"Defines how the asset form is split into logical sections, and the order of fields within each section","properties":{"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"},"maxItems":64,"minItems":0}},"required":["sections"]},"Section":{"description":"Describes a logical section in the asset form, including its label and the list of fields to display in order","properties":{"label":{"type":"string","description":"Section title as shown in the form UI"},"fields":{"type":"array","description":"List of field keys to be displayed in the specified order within this section","items":{"type":"string","description":"List of field keys to be displayed in the specified order within this section"},"maxItems":64,"minItems":0}},"required":["fields","label"]},"CustomField":{"description":"Used to add custom information to assets, allowing for enhanced customization and data management","discriminator":{"propertyName":"type"},"properties":{"id":{"type":"integer","format":"int64"},"label":{"type":"string"},"required":{"type":"boolean"},"description":{"type":"string"},"type":{"type":"string","enum":["text","bigtext","decimal","integer","master_item","geojson"]}},"required":["label","required","type"]}}}}
```

To create a new asset type, send the following request:

## Create a new asset type

> Adds new entity type

```json
{"openapi":"3.1.0","info":{"title":"Navixy Repository API","version":"0.1.0"},"tags":[{"name":"Asset Types","description":"Describes the structure for each asset"}],"servers":[{"url":"https://api.navixy.com/repo","description":"Europe server"},{"url":"https://api.us.navixy.com/repo","description":"Americas server"}],"security":[{"OAuth2_EU":[]},{"OAuth2_US":[]}],"components":{"securitySchemes":{"OAuth2_EU":{"type":"oauth2","description":"OAuth 2.0 authentication for Europe. Use this for users based in Europe and adjacent regions.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}},"OAuth2_US":{"type":"oauth2","description":"OAuth 2.0 authentication for Americas region. Use this for users based in North and South America.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}}},"schemas":{"AssetTypeCreateRequest":{"description":"Defines the request schema for `/asset_type/create`","properties":{"label":{"type":"string","description":"The asset type label"},"category":{"type":"string","description":"The category of asset type","enum":["business","geo"]},"settings":{"$ref":"#/components/schemas/AssetSettings"},"fields":{"type":"array","description":"A list of custom fields of the asset type. The 'label' of each field must be unique within the list","items":{"$ref":"#/components/schemas/CustomField"}}},"required":["category","fields","label","settings"]},"AssetSettings":{"description":"Describes the layout of sections and fields for the entity type","properties":{"layout":{"$ref":"#/components/schemas/Layout"}}},"Layout":{"description":"Defines how the asset form is split into logical sections, and the order of fields within each section","properties":{"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"},"maxItems":64,"minItems":0}},"required":["sections"]},"Section":{"description":"Describes a logical section in the asset form, including its label and the list of fields to display in order","properties":{"label":{"type":"string","description":"Section title as shown in the form UI"},"fields":{"type":"array","description":"List of field keys to be displayed in the specified order within this section","items":{"type":"string","description":"List of field keys to be displayed in the specified order within this section"},"maxItems":64,"minItems":0}},"required":["fields","label"]},"CustomField":{"description":"Used to add custom information to assets, allowing for enhanced customization and data management","discriminator":{"propertyName":"type"},"properties":{"id":{"type":"integer","format":"int64"},"label":{"type":"string"},"required":{"type":"boolean"},"description":{"type":"string"},"type":{"type":"string","enum":["text","bigtext","decimal","integer","master_item","geojson"]}},"required":["label","required","type"]},"IdResponse":{"description":"Response containing the unique identifier of the created resource","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier for the created resource"}},"required":["id"]},"ErrorResponse":{"properties":{"code":{"type":"string","description":"Error code identifier","enum":["invalid_request","invalid_parameters","inventory_item_already_active","disabled_in_demo","operation_not_permitted","device_limit_exceeded","invalid_jwt_token","asset_not_found","asset_type_not_found","asset_link_not_found","bundle_not_found","inventory_not_found","inventory_item_not_found","resource_already_exists","asset_type_has_assets","inventory_has_items","unexpected_error"]},"message":{"type":"string","description":"Human-readable error message"},"correlation_id":{"type":"string","description":"Unique identifier for correlating the error with server logs"},"errors":{"type":"array","description":"Detailed error information for specific parameters","items":{"$ref":"#/components/schemas/ValidationError"}}},"required":["code","message"]},"ValidationError":{"description":"Detailed error information for specific parameters","properties":{"parameter":{"type":"string","description":"The parameter that caused the error"},"message":{"type":"string","description":"Human-readable error message for this parameter"}},"required":["message","parameter"]}}},"paths":{"/v0/asset_type/create":{"post":{"tags":["Asset Types"],"summary":"Create a new asset type","description":"Adds new entity type","operationId":"createAssetType","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetTypeCreateRequest"}}},"required":true},"responses":{"200":{"description":"Asset type created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdResponse"}}}},"400":{"description":"Invalid request or validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

Use this request body:

```bash
curl -L \
  --request POST \
  --url '{BASE_URL}/asset_type/create' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "label": "Commercial Vessel",
    "category": "business",
    "fields": [
      {
        "type": "text",
        "label": "Vessel Name",
        "required": true
      },
      {
        "type": "text",
        "label": "Registration Number",
        "required": true
      },
      {
        "type": "decimal",
        "label": "Engine Power",
        "required": false
      },
      {
        "type": "decimal",
        "label": "Max Passengers",
        "required": false
      }
    ],
    "settings": {
      "layout": {
        "sections": [
          {
            "label": "Vessel Information",
            "fields": [
              "Vessel Name",
              "Registration Number"
            ]
          },
          {
            "label": "Technical Specifications",
            "fields": [
              "Engine Power",
              "Max Passengers"
            ]
          }
        ]
      }
    }
  }'
```

Aside from the `label` of the asset type, the request body contains the following parameters: `category`, `settings,` and `fields`.

The available categories are `business` for moving assets and `geo` for stationary.

The **`settings`** key defines the structure of sections and fields belonging to your asset type. This object contains a `layout` property that describes how the asset form is split into logical sections and the order of fields within each section. The layout consists of sections, where each section has:

* `label`: Section name
* `fields`: List of fields to be displayed in the specified order inside the section

The **`fields`** key is an array of custom field objects used to add user-created information to assets, allowing for enhanced customization and data management. Each field includes:

* `type`: Field type (text, decimal, geojson, bigtext, integer, master\_item)
* `label`: Field name
* `required`: Whether the field is mandatory
* `description`: An optional description

<details>

<summary>Field type descriptions</summary>

* **Text**: A short text value.\
  `{"value":"Example text"}`
* **Bigtext**: A large text value for storing long user input or multi-line content.\
  `{value":"Longer text or content spanning multiple lines..."}`
* **Integer**: A whole number (not a fraction or decimal).\
  `{"value":100}`
* **Decimal**: A decimal (fixed-point) value.\
  `{"value":123.45}`
* **GeoJSON**: A GeoJSON value (geometry, feature, or feature collection). Typically used for describing geofences.\
  `{value":{"type":"Point","coordinates":[30,10]}}`
* **Master item**: A reference to a master inventory item using its unique internal ID.\
  `{"value":123}`

</details>

{% hint style="danger" %}
If you remove a custom field from an asset type via [**asset\_type/update**](https://www.navixy.com/docs/navixy-repository-api/endpoint-reference/api-reference/asset-type#post-v0-asset_type-update), all assets based on this type will lose this field. If you add a new field marked as required, you will need to add values for that field to the assets.
{% endhint %}

After sending the request, you will receive a response with the ID of the newly created asset type:

```json
{
  "id": 456
}
```

#### Step 2. Fetch custom field IDs

Before creating an asset, you need to learn the auto-generated internal ID of each custom field you've added in Step 1. You can learn them by sending the following request using the asset type's own ID:

## Get asset type by ID

> Returns an entity type by ID

```json
{"openapi":"3.1.0","info":{"title":"Navixy Repository API","version":"0.1.0"},"tags":[{"name":"Asset Types","description":"Describes the structure for each asset"}],"servers":[{"url":"https://api.navixy.com/repo","description":"Europe server"},{"url":"https://api.us.navixy.com/repo","description":"Americas server"}],"security":[{"OAuth2_EU":[]},{"OAuth2_US":[]}],"components":{"securitySchemes":{"OAuth2_EU":{"type":"oauth2","description":"OAuth 2.0 authentication for Europe. Use this for users based in Europe and adjacent regions.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}},"OAuth2_US":{"type":"oauth2","description":"OAuth 2.0 authentication for Americas region. Use this for users based in North and South America.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}}},"schemas":{"AssetType":{"description":"The Asset type","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier for the asset type"},"label":{"type":"string","description":"The asset type label"},"category":{"type":"string","description":"The category of asset type","enum":["business","geo"]},"settings":{"$ref":"#/components/schemas/AssetSettings"},"fields":{"type":"array","description":"A list of custom fields of the asset type","items":{"$ref":"#/components/schemas/CustomField"}},"created_at":{"type":"string","format":"date-time","description":"Date and time at which the asset type was created"}},"required":["category","created_at","fields","id","label"]},"AssetSettings":{"description":"Describes the layout of sections and fields for the entity type","properties":{"layout":{"$ref":"#/components/schemas/Layout"}}},"Layout":{"description":"Defines how the asset form is split into logical sections, and the order of fields within each section","properties":{"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"},"maxItems":64,"minItems":0}},"required":["sections"]},"Section":{"description":"Describes a logical section in the asset form, including its label and the list of fields to display in order","properties":{"label":{"type":"string","description":"Section title as shown in the form UI"},"fields":{"type":"array","description":"List of field keys to be displayed in the specified order within this section","items":{"type":"string","description":"List of field keys to be displayed in the specified order within this section"},"maxItems":64,"minItems":0}},"required":["fields","label"]},"CustomField":{"description":"Used to add custom information to assets, allowing for enhanced customization and data management","discriminator":{"propertyName":"type"},"properties":{"id":{"type":"integer","format":"int64"},"label":{"type":"string"},"required":{"type":"boolean"},"description":{"type":"string"},"type":{"type":"string","enum":["text","bigtext","decimal","integer","master_item","geojson"]}},"required":["label","required","type"]},"ErrorResponse":{"properties":{"code":{"type":"string","description":"Error code identifier","enum":["invalid_request","invalid_parameters","inventory_item_already_active","disabled_in_demo","operation_not_permitted","device_limit_exceeded","invalid_jwt_token","asset_not_found","asset_type_not_found","asset_link_not_found","bundle_not_found","inventory_not_found","inventory_item_not_found","resource_already_exists","asset_type_has_assets","inventory_has_items","unexpected_error"]},"message":{"type":"string","description":"Human-readable error message"},"correlation_id":{"type":"string","description":"Unique identifier for correlating the error with server logs"},"errors":{"type":"array","description":"Detailed error information for specific parameters","items":{"$ref":"#/components/schemas/ValidationError"}}},"required":["code","message"]},"ValidationError":{"description":"Detailed error information for specific parameters","properties":{"parameter":{"type":"string","description":"The parameter that caused the error"},"message":{"type":"string","description":"Human-readable error message for this parameter"}},"required":["message","parameter"]}}},"paths":{"/v0/asset_type/read":{"get":{"tags":["Asset Types"],"summary":"Get asset type by ID","description":"Returns an entity type by ID","operationId":"readAssetType","parameters":[{"name":"id","in":"query","description":"Unique identifier for the asset type","required":true,"schema":{"type":"integer","format":"int64","exclusiveMinimum":0}}],"responses":{"200":{"description":"Asset type details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetType"}}}},"400":{"description":"Invalid request or validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Asset not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

In this case, it will be:

```bash
curl -L \
  --request GET \
  --url "{BASE_URL}/asset_type/read?id=456" \
  --header 'Authorization: Bearer <ACCESS_TOKEN>'
```

You will receive full information about the asset type, including the `id` of each custom field. Save them for later.

```json
{
    "id": 456,
    "label": "Commercial Vessels",
    "category": "business",
    "settings": {
        "layout": {
            "sections": [
                {
                    "label": "Vessel Information",
                    "fields": [
                        "Vessel Name",
                        "Registration Number"
                    ]
                },
                {
                    "label": "Technical Specifications",
                    "fields": [
                        "Engine Power",
                        "Max Passengers"
                    ]
                }
            ]
        }
    },
    "fields": [
        {
            "id": 55,
            "label": "Vessel Name",
            "required": true,
            "description": "",
            "type": "text"
        },
        {
            "id": 56,
            "label": "Registration Number",
            "required": true,
            "description": "",
            "type": "text"
        },
        {
            "id": 57,
            "label": "Engine Power",
            "required": false,
            "description": "",
            "type": "decimal"
        },
        {
            "id": 58,
            "label": "Max Passengers",
            "required": false,
            "description": "",
            "type": "decimal"
        }
    ],
    "created_at": "2025-07-09T11:57:36.003383Z"
}
```

#### Step 3. Create an asset

## The Asset object

```json
{"openapi":"3.1.0","info":{"title":"Navixy Repository API","version":"0.1.0"},"components":{"schemas":{"Asset":{"description":"The Asset object","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier for the asset"},"type_id":{"type":"integer","format":"int64","description":"Unique identifier for the asset's type"},"label":{"type":"string","description":"The asset’s title/name"},"fields":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"description":"A map, each key of which is a custom field ID as a string"},"created_at":{"type":"string","format":"date-time","description":"Date and time at which the asset was created"}},"required":["created_at","fields","id","label","type_id"]},"CustomFieldValue":{"default":{},"description":"Base type for custom field values. Implements different field types: text, numeric, master item, GeoJSON. Each object contains a 'type' field that defines the specific value format","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/TextFieldValue"},{"$ref":"#/components/schemas/BigTextFieldValue"},{"$ref":"#/components/schemas/DecimalFieldValue"},{"$ref":"#/components/schemas/IntegerFieldValue"},{"$ref":"#/components/schemas/MasterItemFieldValue"},{"$ref":"#/components/schemas/GeoJsonFieldValue"}],"properties":{"type":{"type":"string","enum":["text","bigtext","decimal","integer","master_item","geojson"]}},"required":["type"]},"TextFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"string"}}}],"description":"Represents a custom field containing a short text value","required":["type","value"]},"BigTextFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"string"}}}],"description":"Represents a custom field containing a large text value (for storing long user input or multi-line content)","required":["type","value"]},"DecimalFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"number"}}}],"description":"Represents a custom field containing a decimal (fixed-point) value","required":["type","value"]},"IntegerFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"integer","format":"int64"}}}],"description":"Represents a custom field containing an integer value","required":["type","value"]},"MasterItemFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"integer","format":"int64"}}}],"description":"Represents a custom field referencing master item (by its unique id)","required":["type","value"]},"GeoJsonFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"$ref":"#/components/schemas/JsonNode"}}}],"description":"Represents a custom field with a GeoJSON value (geometry, feature or feature collection)","required":["type","value"]},"JsonNode":{"description":"GeoJSON object"}}}}
```

## Create a new asset

> Adds an asset for the organization

```json
{"openapi":"3.1.0","info":{"title":"Navixy Repository API","version":"0.1.0"},"tags":[{"name":"Assets","description":"Assets represent individual real-world objects stored in the system, such as a specific vehicle or person, and geospatial objects, such as a POI or geofence"}],"servers":[{"url":"https://api.navixy.com/repo","description":"Europe server"},{"url":"https://api.us.navixy.com/repo","description":"Americas server"}],"security":[{"OAuth2_EU":[]},{"OAuth2_US":[]}],"components":{"securitySchemes":{"OAuth2_EU":{"type":"oauth2","description":"OAuth 2.0 authentication for Europe. Use this for users based in Europe and adjacent regions.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}},"OAuth2_US":{"type":"oauth2","description":"OAuth 2.0 authentication for Americas region. Use this for users based in North and South America.","flows":{"authorizationCode":{"authorizationUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/auth","tokenUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","refreshUrl":"https://keycloak.us.navixy.com/realms/users/protocol/openid-connect/token","scopes":{"openid":"OpenID Connect scope","profile":"Basic user profile","email":"User e-mail address"}}}}},"schemas":{"AssetCreateRequest":{"description":"Defines the request schema for `/asset/create`","properties":{"type_id":{"type":"integer","format":"int64","description":"Unique identifier for the asset's type"},"label":{"type":"string","description":"The asset’s title/name"},"fields":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/CustomFieldValue"},"default":{},"description":"A map, each key of which is a custom field ID as a string"}},"required":["fields","label","type_id"]},"CustomFieldValue":{"default":{},"description":"Base type for custom field values. Implements different field types: text, numeric, master item, GeoJSON. Each object contains a 'type' field that defines the specific value format","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/TextFieldValue"},{"$ref":"#/components/schemas/BigTextFieldValue"},{"$ref":"#/components/schemas/DecimalFieldValue"},{"$ref":"#/components/schemas/IntegerFieldValue"},{"$ref":"#/components/schemas/MasterItemFieldValue"},{"$ref":"#/components/schemas/GeoJsonFieldValue"}],"properties":{"type":{"type":"string","enum":["text","bigtext","decimal","integer","master_item","geojson"]}},"required":["type"]},"TextFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"string"}}}],"description":"Represents a custom field containing a short text value","required":["type","value"]},"BigTextFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"string"}}}],"description":"Represents a custom field containing a large text value (for storing long user input or multi-line content)","required":["type","value"]},"DecimalFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"number"}}}],"description":"Represents a custom field containing a decimal (fixed-point) value","required":["type","value"]},"IntegerFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"integer","format":"int64"}}}],"description":"Represents a custom field containing an integer value","required":["type","value"]},"MasterItemFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"type":"integer","format":"int64"}}}],"description":"Represents a custom field referencing master item (by its unique id)","required":["type","value"]},"GeoJsonFieldValue":{"allOf":[{"$ref":"#/components/schemas/CustomFieldValue"},{"type":"object","properties":{"value":{"$ref":"#/components/schemas/JsonNode"}}}],"description":"Represents a custom field with a GeoJSON value (geometry, feature or feature collection)","required":["type","value"]},"JsonNode":{"description":"GeoJSON object"},"IdResponse":{"description":"Response containing the unique identifier of the created resource","properties":{"id":{"type":"integer","format":"int64","description":"Unique identifier for the created resource"}},"required":["id"]},"ErrorResponse":{"properties":{"code":{"type":"string","description":"Error code identifier","enum":["invalid_request","invalid_parameters","inventory_item_already_active","disabled_in_demo","operation_not_permitted","device_limit_exceeded","invalid_jwt_token","asset_not_found","asset_type_not_found","asset_link_not_found","bundle_not_found","inventory_not_found","inventory_item_not_found","resource_already_exists","asset_type_has_assets","inventory_has_items","unexpected_error"]},"message":{"type":"string","description":"Human-readable error message"},"correlation_id":{"type":"string","description":"Unique identifier for correlating the error with server logs"},"errors":{"type":"array","description":"Detailed error information for specific parameters","items":{"$ref":"#/components/schemas/ValidationError"}}},"required":["code","message"]},"ValidationError":{"description":"Detailed error information for specific parameters","properties":{"parameter":{"type":"string","description":"The parameter that caused the error"},"message":{"type":"string","description":"Human-readable error message for this parameter"}},"required":["message","parameter"]}}},"paths":{"/v0/asset/create":{"post":{"tags":["Assets"],"summary":"Create a new asset","description":"Adds an asset for the organization","operationId":"createAsset","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetCreateRequest"}}},"required":true},"responses":{"200":{"description":"Asset created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdResponse"}}}},"400":{"description":"Invalid request or validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

To create an asset, send the following request using the `id` of each custom field from the previous step, or at least those marked as `required:`

```bash
curl -L \
  --request POST \
  --url '{BASE_URL}/asset/create' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "type_id": 456,
    "label": "Sea Explorer",
    "fields": {
      "55": {
        "type": "text",
        "value": "Sea Explorer"
      },
      "56": {
        "type": "text",
        "value": "BOT-2024-001"
      },
      "57": {
        "type": "decimal",
        "value": 350.5
      },
      "58": {
        "type": "decimal",
        "value": 12
      }
    }
  }'
```

You will receive the ID of the newly created asset:

```json
{
  "id": 789
}
```

#### Step 4. Assign a GPS device

Now that you have an asset, you need to assign a device to it. This is done by adding the `asset_id` parameter to the inventory item (master or slave) representing the device. You can assign several devices to one asset — or, in the API's terms, add the same `asset_id` to several inventory items.

Navixy Repository API allows for flexible device assignment:

* **Assign during device creation**: Include `asset_id` when creating the inventory item
* **Assign to existing device**: Update an existing inventory item with `asset_id`
* **Assign later**: Create devices without assets and assign them when needed

This flexibility allows you to pre-create devices in inventory before assets exist, reassign devices between assets as needed, and manage unassigned spare devices.

**Assign to an existing device**

If your device is already activated, send the following request (let's assume you have a master-type item called `GPS Tracker 446` with id of `123` ).

```json
curl -L \
  --request POST \
  --url '{BASE_URL}/inventory_item/master/update' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": 123,
    "inventory_id": 12,
    "label": "GPS Tracker 446",
    "asset_id": 789
  }'
```

**Assign during device creation**

If you haven't created an inventory item yet, you can add the `asset_id` parameter to the creation request. For a master item, send the following request:

```json
curl -L \
  --request POST \
  --url '{BASE_URL}/inventory_item/master/create' \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
    "inventory_id": 12,
    "device_id": "123456789012345",
    "label": "GPS Tracker 446",
    "model": "telfmu130_fmc130_234",
    "asset_id": 789
  }'
```

{% hint style="success" %}
**Congratulations!**\
You've successfully created a custom asset. Next, you can [add it to an asset link](https://www.navixy.com/docs/navixy-repository-api/guides/configuring-an-asset-link).
{% endhint %}
