Create Asset
hudu_create_assetCreates a new asset (server, workstation, etc.) in a Hudu company. Provide company_id and asset_layout_id to define custom fields; returns the created asset with its assigned id.
Instructions
Create an asset inside a company. An asset is any documented thing that belongs to a company — a server, a workstation, a firewall, a licence, a contact. The asset layout it was created from decides which custom fields it carries.
Every asset belongs to exactly one company and there is no global create route, so company_id is required. Choose asset_layout_id before calling: the layout fixes which custom fields the asset can hold and Hudu will not infer one. hudu_list_asset_layouts lists the layouts and hudu_get_asset_layout shows the field labels a layout defines, which are the keys custom_fields expects.
Returns the created asset, including the id Hudu assigned. Hudu answers 422 with the offending field named when validation fails, including when a custom field label does not exist on the chosen layout.
Operation class: Create.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Display name of the asset, e.g. a hostname. | |
| company_id | Yes | Numeric id of the company that owns this asset. Not optional and not guessable — an asset id belonging to company A returns 404 under company B, indistinguishable from a deleted asset. | |
| primary_mail | No | Primary email address associated with the asset. | |
| custom_fields | No | Values for the custom fields the asset layout defines, as an array holding one object that maps field label to value: [{"brand": "Apple", "model": "MacBook Pro"}]. Each key is a layout field label in snake_case — lower-cased with spaces replaced by underscores, so a field labelled "Serial Number" is the key "serial_number" — and Hudu requires each key to match a field that already exists on the layout given by asset_layout_id. Call hudu_get_asset_layout first to read the exact labels. Values are documented as strings, so send numbers and dates as strings ("42", "2026-01-01"). Note the asymmetry with reads: a fetched asset returns this data under `fields` as {id, label, value, position} objects, which is not a shape this parameter accepts — rebuild the label/value pairs yourself rather than sending back what you read. | |
| primary_model | No | Hardware or product model. | |
| primary_serial | No | Serial number shown at the top of the asset. | |
| asset_layout_id | Yes | Numeric id of the asset layout to build this asset from. The layout decides which custom fields exist; list the choices with hudu_list_asset_layouts. | |
| primary_manufacturer | No | Manufacturer or vendor name. |