Contents
On this page

List Units - Plugixa Inventory

GET /plugixa-inventory/v1/units

List units, one page at a time, with search, filters and sorting.

The user needs the plugixa_inventory_view capability (administrators have every inventory capability). With Pro Roles and permissions enforcing, their role must also allow reading units. Needs Plugixa Inventory Pro with the Units of measurement app on in Plugixa Inventory -> App Manager; with it off, this route answers 404.

Request

GET https://your-site.example/wp-json/plugixa-inventory/v1/units?base_unit_id__in=1

Query parameters

Plus the list parameters every paged list accepts. search matches name, code. orderby accepts id, code, name, status, created_at, modified_at. view=trash lists the trash instead.

The filters this list accepts: status, base_unit_id, created_at, modified_at.

Responses

200 OK. data is one page of units.

{
  "success": true,
  "data": [
    {
      "id": 4,
      "code": "box12",
      "name": "Box of 12",
      "base_unit_id": 1,
      "operator": "*",
      "operation_value": 12.0,
      "status": "published",
      "created_by": 1,
      "modified_by": 1,
      "created_at": "2026-11-12 09:30:00",
      "modified_at": "2026-11-12 09:30:00",
      "deleted_at": null,
      "base_unit_code": "pcs"
    }
  ],
  "meta": {
    "total": 1,
    "pages": 1
  }
}
Field Type Meaning
data[] object One unit, with the same fields as Get Unit
meta.total integer Units matching the search and filters, before paging
meta.pages integer Number of pages at this per_page

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-inventory/v1/units?base_unit_id__in=1" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$query = http_build_query(['base_unit_id__in' => '1']);
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/units?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const query = new URLSearchParams({ base_unit_id__in: '1' });
const response = await fetch(`https://your-site.example/wp-json/plugixa-inventory/v1/units?${query}`, {
  headers: { 'Authorization': auth },
});
const { data, meta } = await response.json();

Quick Links

Share