Skip to content

Locations API

Manage storage locations.

Get all locations with item counts.

GET /api/locations
{
"locations": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Office",
"description": "Main office area",
"_count": {
"items": 12
}
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"name": "Garage",
"description": "Storage area in garage",
"_count": {
"items": 25
}
}
]
}

Add a new location.

POST /api/locations
{
"name": "Garage Shelf A",
"description": "Top shelf in the garage"
}
FieldTypeRequiredDescription
namestringYesLocation name (unique)
descriptionstringNoAdditional details
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Garage Shelf A",
"description": "Top shelf in the garage"
}
CodeMessage
400Location already exists

Modify an existing location.

PUT /api/locations/[id]
{
"name": "Garage - Shelf A",
"description": "Updated description"
}

Returns the updated location.


Remove a location.

DELETE /api/locations/[id]
{
"success": true
}

Note: Items Not Deleted Deleting a location does not delete its items. Items will have no assigned location.


Consider using hierarchical naming for complex storage:

Building > Room > Area > Specific Location
NameDescription
Home > Garage > Shelf ASpecific shelf
Office > Desk > Drawer 1Office desk drawer
Storage Unit 42External storage
Bedroom ClosetSimple location