Accessories
Link and manage accessory relationships between catalogue-items.
Accessories API
CRUD endpoints for managing the accessories linked to a catalogue item. Accessories are a resource nested under catalogue items — every accessory belongs to a parent catalogue item and points at another catalogue item as the accessory item.
Endpoints
| Method | URL | Description |
|---|---|---|
| GET | /api/v1/catalogue_items/{catalogue_item}/accessories |
List a catalogue item's accessories |
| POST | /api/v1/catalogue_items/{catalogue_item}/accessories |
Link an accessory to the catalogue item |
| PUT | /api/v1/catalogue_items/{catalogue_item}/accessories/{accessory} |
Update a linked accessory |
| DELETE | /api/v1/catalogue_items/{catalogue_item}/accessories/{accessory} |
Unlink an accessory |
Note: There is no
showendpoint for a single accessory — list the parent catalogue item's accessories instead.
Authentication
Requires a Sanctum bearer token with catalogue-items:read (GET) or catalogue-items:write (POST/PUT/DELETE) ability.
List Accessories
GET /api/v1/catalogue_items/{catalogue_item}/accessories
Returns every accessory linked to the catalogue item, ordered by the database default. The accessory catalogue item's name is resolved into related_name.
Response
{
"accessories": [
{
"id": 1,
"catalogue_item_id": 10,
"accessory_catalogue_item_id": 42,
"related_name": "Half-Coupler Clamp",
"quantity": "2.0",
"included": true,
"zero_priced": true,
"sort_order": 0
}
]
}
| Field | Type | Description |
|---|---|---|
id |
int | Accessory link ID |
catalogue_item_id |
int | Parent catalogue item ID |
accessory_catalogue_item_id |
int | Linked accessory catalogue item ID |
related_name |
string | Name of the accessory catalogue item |
quantity |
string | Quantity per parent catalogue item (decimal string, e.g. "2.0") |
included |
bool | Whether included by default on an order |
zero_priced |
bool | Whether charged at zero when included |
sort_order |
int | Display order among the catalogue item's accessories |
Create Accessory
POST /api/v1/catalogue_items/{catalogue_item}/accessories
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accessory_catalogue_item_id |
int | Yes | CatalogueItem to link (must exist and not be soft-deleted) |
quantity |
numeric | No | Quantity per parent catalogue item (min 0, default 1) |
included |
bool | No | Included by default (default false) |
zero_priced |
bool | No | Charged at zero when included (default false) |
sort_order |
int | No | Display order (min 0, default 0) |
The catalogue_item_id is taken from the URL — it is not accepted in the body.
{
"accessory_catalogue_item_id": 42,
"quantity": 2,
"included": true,
"zero_priced": true
}
Returns 201 Created with the new accessory in an accessory key.
Note: A catalogue item/accessory pair is unique — attempting to link the same accessory catalogue item to the same parent twice is rejected.
Update Accessory
PUT /api/v1/catalogue_items/{catalogue_item}/accessories/{accessory}
All fields are optional; only the fields you send are changed. If the accessory does not belong to the catalogue item in the URL, the request returns 404 Not Found. Returns 200 OK with the updated accessory.
Delete Accessory
DELETE /api/v1/catalogue_items/{catalogue_item}/accessories/{accessory}
Unlinks the accessory from the catalogue item. If the accessory does not belong to the catalogue item in the URL, the request returns 404 Not Found. Returns 204 No Content.
Webhooks
Creating, updating, or deleting an accessory dispatches a catalogue_item.updated webhook event for the parent catalogue item, since a catalogue item's accessory list is part of its definition.