Skip to main content

Overview

Asset types define the structure and custom fields for inventory items. Each asset type belongs to a container and includes field definitions that specify what data can be captured for items of that type. Asset types support image uploads, serialization settings, and collection-specific field mappings.

Create Asset Type

POST /containers/{containerId}/asset-types
Content-Type: multipart/form-data
Create a new asset type within a container with custom field definitions.
containerId
integer
required
ID of the parent container
name
string
required
Asset type name (e.g., “Electronics”, “Books”, “Collectibles”)
isSerialized
boolean
default:"true"
Whether items of this type are serialized:
  • true - Each item is unique with quantity=1 (default)
  • false - Items can have variable quantities
fieldDefinitions
string
required
JSON-encoded array of custom field definition objectsExample:
[
  {
    "id": "brand",
    "label": "Brand",
    "type": "text",
    "required": true
  },
  {
    "id": "condition",
    "label": "Condition",
    "type": "select",
    "options": ["New", "Like New", "Good", "Fair", "Poor"]
  }
]
files
file
Optional image file for the asset type icon/thumbnail
curl -X POST "https://api.invenicum.com/containers/5/asset-types" \
  -H "Authorization: Bearer {token}" \
  -F "name=Electronics" \
  -F "isSerialized=true" \
  -F 'fieldDefinitions=[{"id":"brand","label":"Brand","type":"text","required":true},{"id":"model","label":"Model","type":"text"},{"id":"condition","label":"Condition","type":"select","options":["New","Like New","Good","Fair"]}]' \
  -F "[email protected]"
{
  "data": {
    "id": 12,
    "name": "Electronics",
    "isSerialized": true,
    "fieldDefinitions": [
      {
        "id": "brand",
        "label": "Brand",
        "type": "text",
        "required": true
      },
      {
        "id": "model",
        "label": "Model",
        "type": "text",
        "required": false
      },
      {
        "id": "condition",
        "label": "Condition",
        "type": "select",
        "required": false,
        "options": ["New", "Like New", "Good", "Fair"]
      }
    ],
    "images": [
      {
        "id": 78,
        "url": "https://storage.example.com/asset-type-12.jpg",
        "altText": null,
        "order": 0
      }
    ],
    "possessionFieldId": null,
    "desiredFieldId": null
  }
}
data
object

Get Asset Type

GET /asset-types/{assetTypeId}
Retrieve a single asset type by ID.
assetTypeId
integer
required
ID of the asset type to retrieve
{
  "data": {
    "id": 12,
    "name": "Electronics",
    "isSerialized": true,
    "fieldDefinitions": [
      {
        "id": "brand",
        "label": "Brand",
        "type": "text",
        "required": true
      }
    ],
    "images": [],
    "possessionFieldId": null,
    "desiredFieldId": null
  }
}

Update Asset Type

PATCH /asset-types/{assetTypeId}
Content-Type: multipart/form-data
Update an existing asset type’s name, field definitions, or image.
assetTypeId
integer
required
ID of the asset type to update
name
string
required
Updated asset type name
fieldDefinitions
string
required
JSON-encoded array of updated field definitions
files
file
New image file to upload (replaces existing)
removeExistingImage
boolean
default:"false"
Set to true to remove the current image without uploading a new one
curl -X PATCH "https://api.invenicum.com/asset-types/12" \
  -H "Authorization: Bearer {token}" \
  -F "name=Consumer Electronics" \
  -F 'fieldDefinitions=[{"id":"brand","label":"Brand Name","type":"text","required":true}]' \
  -F "removeExistingImage=false"
{
  "data": {
    "id": 12,
    "name": "Consumer Electronics",
    "isSerialized": true,
    "fieldDefinitions": [
      {
        "id": "brand",
        "label": "Brand Name",
        "type": "text",
        "required": true
      }
    ],
    "images": [
      {
        "id": 78,
        "url": "https://storage.example.com/asset-type-12.jpg",
        "altText": null,
        "order": 0
      }
    ]
  }
}

Update Collection Fields

PATCH /asset-types/{assetTypeId}/collection-fields
Content-Type: application/json
Update the field mappings used for collection tracking. Collections use specific fields to track how many items are possessed vs. desired.
assetTypeId
integer
required
ID of the asset type
possessionFieldId
string
Field ID that tracks “possessed” quantity (set to null to clear)
desiredFieldId
string
Field ID that tracks “desired” quantity (set to null to clear)
{
  "possessionFieldId": "qty_owned",
  "desiredFieldId": "qty_wanted"
}
{
  "data": {
    "id": 12,
    "name": "Trading Cards",
    "possessionFieldId": "qty_owned",
    "desiredFieldId": "qty_wanted",
    "fieldDefinitions": [
      {
        "id": "qty_owned",
        "label": "Quantity Owned",
        "type": "number"
      },
      {
        "id": "qty_wanted",
        "label": "Quantity Wanted",
        "type": "number"
      }
    ]
  }
}

Delete Asset Type

DELETE /asset-types/{assetTypeId}
Permanently delete an asset type. This operation:
  1. First deletes all inventory items of this type (DELETE /asset-types/{assetTypeId}/assets)
  2. Then deletes the asset type itself
This is a destructive operation that cannot be undone. All items associated with this asset type will be permanently deleted.
assetTypeId
integer
required
ID of the asset type to delete
204 No Content

Error Responses

{
  "message": "El tipo de activo no existe o ya fue eliminado."
}
Common errors:
  • 404 Not Found - Asset type doesn’t exist or was already deleted
  • 401 Unauthorized - Invalid or expired authentication token

Field Definition Types

When creating or updating asset types, the following field types are available:

Text Fields

{
  "id": "description",
  "label": "Description",
  "type": "text",
  "required": false
}
Single-line text input.

Textarea Fields

{
  "id": "notes",
  "label": "Notes",
  "type": "textarea",
  "required": false
}
Multi-line text input.

Number Fields

{
  "id": "price",
  "label": "Purchase Price",
  "type": "number",
  "required": false
}
Numeric input (integer or decimal).

Date Fields

{
  "id": "purchase_date",
  "label": "Purchase Date",
  "type": "date",
  "required": false
}
Date picker input.

Boolean Fields

{
  "id": "is_certified",
  "label": "Certified Authentic",
  "type": "boolean",
  "required": false
}
Checkbox (true/false).

Select Fields (Single Choice)

{
  "id": "condition",
  "label": "Condition",
  "type": "select",
  "required": true,
  "options": ["Mint", "Near Mint", "Excellent", "Good", "Fair", "Poor"]
}
Dropdown with predefined options.

Multi-Select Fields

{
  "id": "tags",
  "label": "Tags",
  "type": "multiselect",
  "required": false,
  "options": ["Vintage", "Rare", "Limited Edition", "Signed"]
}
Multiple choice selection.

Dynamic Select (DataList)

{
  "id": "category",
  "label": "Category",
  "type": "select",
  "required": false,
  "dataListId": 5
}
Dropdown populated from a DataList (see Containers).

Best Practices

Field ID Naming

Use consistent, descriptive IDs:
  • Use lowercase with underscores: serial_number, purchase_date
  • Avoid special characters except underscores
  • Keep IDs stable - changing them breaks existing item data

Serialization Strategy

Use isSerialized: true for:
  • Unique items (electronics, collectibles, art)
  • Items with serial numbers or unique identifiers
  • Items where each instance is distinct
Use isSerialized: false for:
  • Bulk consumables (screws, cables, office supplies)
  • Fungible items where individual instances don’t matter
  • Items tracked by total quantity rather than individual units

Collection Fields

For collection management:
  1. Create number fields for possession and desire tracking
  2. Use the Update Collection Fields endpoint to map them
  3. The frontend can then show “5/10” style progress indicators
{
  "fieldDefinitions": [
    {"id": "owned", "label": "Owned", "type": "number"},
    {"id": "wanted", "label": "Wanted", "type": "number"}
  ],
  "possessionFieldId": "owned",
  "desiredFieldId": "wanted"
}

Error Handling

All endpoints return standard HTTP status codes:
  • 200 OK - Request successful
  • 201 Created - Asset type created successfully
  • 204 No Content - Deletion successful
  • 400 Bad Request - Invalid field definitions or malformed JSON
  • 401 Unauthorized - Authentication required
  • 404 Not Found - Asset type not found
  • 500 Internal Server Error - Server error
Error responses include a message:
{
  "message": "Error description"
}

Build docs developers (and LLMs) love