Amba

Inventory

Per-user inventory reads and admin-side grants.

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

/inventory/revoke is the support / moderation inverse of /inventory/grant — use it to claw back a wrongly-granted item or correct a quantity.

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).
POST/admin/projects/:projectId/inventory/revokeRevoke an item — decrement the held quantity (inverse).

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/v1/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/v1/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 '{}'

POST /admin/projects/:projectId/inventory/revoke

The inverse of /grant: decrement the user's held quantity of a catalog item. For support and moderation — claw back a wrongly-granted item or correct a quantity. There is no client-side equivalent; items otherwise only leave an inventory when a consumable is used.

A revoke that zeroes the holding deletes the row entirely, so a subsequent read won't return a phantom zero-quantity item.

Request (RevokeItemInput)

FieldTypeRequiredDefaultDescription
app_user_iduuidyesUser to revoke from.
catalog_item_iduuidyesCatalog item to revoke.
quantitynumberno1Positive integer. Must be ≤ the quantity the user currently holds.

Response 200

When the holding survives, item is the updated inventory row. When the revoke zeroes the holding, the row is deleted and item is null.

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

Errors

  • 400 VALIDATION_ERRORapp_user_id or catalog_item_id missing.
  • 400 INVALID_QUANTITYquantity isn't a positive integer.
  • 400 INVALID_IDapp_user_id or catalog_item_id isn't a UUID.
  • 400 INSUFFICIENT_QUANTITY — the user holds fewer than quantity. The message includes both the held and requested amounts; no partial revoke.
  • 404 INVENTORY_ITEM_NOT_FOUND — the user doesn't hold this item at all.
  • 500 REVOKE_FAILED.

Try it:

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

Curl:

curl -X POST '${BASE_URL}/admin/projects/{projectId}/inventory/revoke' \
  -H 'Authorization: Bearer ${DEV_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
        "app_user_id": "…",
        "catalog_item_id": "…",
        "quantity": 1
      }'

On this page