Amba

Inventory

Per-user inventory reads and admin-side grants.

Read a user's owned items or grant items directly (joining rewards, customer support, etc.). The client-side purchase flow lives under /client/inventory/purchase.

Source: apps/api/src/routes/admin/inventory.ts.

Endpoints

MethodPathDescription
GET/admin/projects/:projectId/inventory/:userIdList a user's inventory with catalog item info.
POST/admin/projects/:projectId/inventory/grantGrant an item (upsert on (user, item) unique key).

GET /admin/projects/:projectId/inventory/:userId

Response 200

{
  "data": [
    {
      "app_user_id": "…",
      "catalog_item_id": "…",
      "quantity": 3,
      "acquired_via": "grant",
      "acquired_at": "…",
      "catalog_items": { "key": "…", "name": "…", "icon_url": "…", "item_type": "consumable" }
    }
  ]
}

Errors

  • 500 FETCH_FAILED.

Try it:

GET/admin/projects/%7B%7BprojectId%7D%7D/inventory/%7B%7BuserId%7D%7D
developer auth
curl -X GET 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/inventory/%7B%7BuserId%7D%7D'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X GET '${BASE_URL}/admin/projects/{projectId}/inventory/{userId}' \
  -H 'Authorization: Bearer ${DEV_TOKEN}'

POST /admin/projects/:projectId/inventory/grant

Grant an item to a user. If the user already owns it, the quantity is additive. acquired_via is stamped as "grant".

Request (GrantItemInput)

FieldTypeRequiredDefault
app_user_iduuidyes
catalog_item_iduuidyes
quantitynumberno1

Response 201

{
  "data": {
    "app_user_id": "…",
    "catalog_item_id": "…",
    "quantity": 4,
    "acquired_via": "grant",
    "acquired_at": "…"
  }
}

Errors

  • 500 GRANT_FAILED.

Try it:

POST/admin/projects/%7B%7BprojectId%7D%7D/inventory/grant
developer auth
curl -X POST 'https://api.amba.dev/admin/projects/%7B%7BprojectId%7D%7D/inventory/grant'
Loading auth… Configure auth in the settings drawer (top-right) to run this request.

Curl:

curl -X POST '${BASE_URL}/admin/projects/{projectId}/inventory/grant' \
  -H 'Authorization: Bearer ${DEV_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{}'

On this page