← Docs

Public API

Acrium exposes a small external API so a project owner can pull their own store data programmatically. It's separate from the browser-facing dashboard routes and is authenticated by API key rather than session cookie.

Getting an API key

  1. In the dashboard, go to Settings → API. This requires the manage_api_keys capability on the project.
  2. Click Generate (POST /settings/api/generate-api-key, rate-limited to 5/minute). The plaintext key is shown once — copy it now. Only its bcrypt hash is stored server-side (on the projects row), so it can't be recovered later.
  3. GET /settings/api/api-key-status returns {api_id, has_key} for the active project, so the dashboard can show whether a key currently exists.
  4. Revoke (POST /settings/api/revoke-api-key, rate-limited 5/minute) invalidates the current key immediately. Generating a new key also replaces the old one.

api_id is the project's project_id. You'll need both api_id and api_key for every call below.

Making a request

POST /api/v1/
Content-Type: application/json

{
  "api_id": "<project_id>",
  "api_key": "<plaintext key from generation>",
  "request_type": "grab_products",
  "requested_data": ["sku", "name"]
}

Errors

Status Cause
400 requested_data missing, request_type not recognized, or requested_data doesn't match what that request_type expects (e.g. wrong number of items).
401 api_id/api_key don't match an active key.
500 Unexpected server-side failure while handling the request.

Note: requesting a column name that doesn't exist on the underlying table returns 200 with {"error": "..."} in the body rather than a 4xx — check the response body, not just the status code, for that case.

Request types

There is no separate products table — a project's items live entirely in inventory, and category is the grouping mechanism (there is no product_id anymore). All three request types below read from inventory; grab_products/grab_single_product are kept as names for compatibility but now behave the same as grab_single_inventory.

Available columns on every request type: sku_id, project_id, user_email, sku, name, description, quantity, unit, price, cost, category, low_stock_threshold, location, created_at, updated_at, images.

images and location are stored as JSON text, and come back as a JSON-encoded string, not an array — e.g. "images": "[\"...\"]" and "location": "[]". Decode them yourself (JSON.parse / json.loads) before use.

grab_products

Returns every inventory item for the project.

grab_single_product

Returns one inventory item by SKU.

grab_single_inventory

Returns one inventory item by SKU. Identical behavior to grab_single_product above — both are kept as separate request types for compatibility with existing integrations.

Breaking change: these request types previously took a product_id integer as the first requested_data element and products didn't have a sku column. They now take the item's sku (string) instead, and product_id is no longer a valid column name — update any existing calls accordingly.

Example

curl -X POST https://acriumautomated.com/api/v1/ \
  -H "Content-Type: application/json" \
  -d '{
    "api_id": "123",
    "api_key": "acrm-...",
    "request_type": "grab_single_inventory",
    "requested_data": ["WIDGET-1", "sku", "quantity", "price"]
  }'

Response:

{
  "sku": "WIDGET-1",
  "quantity": 42,
  "price": 19.99
}