Warehouses

Physical/logical stock locations. Managed under the settings.* permission scope.

GET/api/v1/warehouses

List warehouses

Scope: settings.read

Parameters

NameInTypeRequiredDescription
pagequerynumberOptional1-based page number.
limitquerynumberOptionalPage size, max 200.

Example request

curl "https://invoice.avscorp.in/api/v1/warehouses" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx9wh0000000000000000001",
  "organizationId": "clx0org000000000000000001",
  "name": "Main Warehouse - Delhi",
  "code": "DEL01",
  "systemKind": "USER",
  "addressLine1": "Plot 45, Okhla Industrial Area Phase II",
  "addressLine2": null,
  "city": "New Delhi",
  "pincode": "110020",
  "phone": "9988776655",
  "isDefault": true,
  "isActive": true,
  "createdBy": "clxusr0000000000000000001",
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-07-15T09:00:00.000Z"
}

Possible errors: unauthorized, insufficient_scope, forbidden

POST/api/v1/warehouses

Create a warehouse

Scope: settings.update

Request body

FieldTypeRequiredConstraints
namestringRequiredmin length 1; max length 191
codeanyOptional—
addressLine1anyOptional—
addressLine2anyOptional—
cityanyOptional—
pincodeanyOptional—
phoneanyOptional—
isDefaultbooleanOptionaldefault false
isActivebooleanOptionaldefault true

Example request

curl -X POST "https://invoice.avscorp.in/api/v1/warehouses" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Main Warehouse - Delhi",
  "code": "DEL01"
}'

Example response

JSON
{
  "id": "clx9wh0000000000000000001",
  "organizationId": "clx0org000000000000000001",
  "name": "Main Warehouse - Delhi",
  "code": "DEL01",
  "systemKind": "USER",
  "addressLine1": "Plot 45, Okhla Industrial Area Phase II",
  "addressLine2": null,
  "city": "New Delhi",
  "pincode": "110020",
  "phone": "9988776655",
  "isDefault": true,
  "isActive": true,
  "createdBy": "clxusr0000000000000000001",
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-07-15T09:00:00.000Z"
}

Possible errors: unauthorized, insufficient_scope, forbidden, validation_error

GET/api/v1/warehouses/{id}

Get a warehouse

Scope: settings.read

Parameters

NameInTypeRequiredDescription
idpathstringRequiredWarehouse ID.

Example request

curl "https://invoice.avscorp.in/api/v1/warehouses/clx9wh0000000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "id": "clx9wh0000000000000000001",
  "organizationId": "clx0org000000000000000001",
  "name": "Main Warehouse - Delhi",
  "code": "DEL01",
  "systemKind": "USER",
  "addressLine1": "Plot 45, Okhla Industrial Area Phase II",
  "addressLine2": null,
  "city": "New Delhi",
  "pincode": "110020",
  "phone": "9988776655",
  "isDefault": true,
  "isActive": true,
  "createdBy": "clxusr0000000000000000001",
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-07-15T09:00:00.000Z"
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found

PATCH/api/v1/warehouses/{id}

Update a warehouse

Scope: settings.update

PATCH validates against the full warehouse schema (same as create) — name is required in every update, not just changed fields.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredWarehouse ID.

Request body

FieldTypeRequiredConstraints
namestringRequiredmin length 1; max length 191
codeanyOptional—
addressLine1anyOptional—
addressLine2anyOptional—
cityanyOptional—
pincodeanyOptional—
phoneanyOptional—
isDefaultbooleanOptionaldefault false
isActivebooleanOptionaldefault true

Example request

curl -X PATCH "https://invoice.avscorp.in/api/v1/warehouses/clx9wh0000000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Main Warehouse - Delhi",
  "code": "DEL01",
  "isDefault": true
}'

Example response

JSON
{
  "id": "clx9wh0000000000000000001",
  "organizationId": "clx0org000000000000000001",
  "name": "Main Warehouse - Delhi",
  "code": "DEL01",
  "systemKind": "USER",
  "addressLine1": "Plot 45, Okhla Industrial Area Phase II",
  "addressLine2": null,
  "city": "New Delhi",
  "pincode": "110020",
  "phone": "9988776655",
  "isDefault": true,
  "isActive": true,
  "createdBy": "clxusr0000000000000000001",
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-07-15T09:00:00.000Z"
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found, validation_error

DELETE/api/v1/warehouses/{id}

Delete a warehouse

Scope: settings.update

Uses the settings.update scope, not a distinct delete scope.

Parameters

NameInTypeRequiredDescription
idpathstringRequiredWarehouse ID.

Example request

curl -X DELETE "https://invoice.avscorp.in/api/v1/warehouses/clx9wh0000000000000000001" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response

JSON
{
  "deleted": true
}

Possible errors: unauthorized, insufficient_scope, forbidden, not_found