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
| Method | Path | Description |
|---|---|---|
| GET | /admin/projects/:projectId/inventory/:userId | List a user's inventory with catalog item info. |
| POST | /admin/projects/:projectId/inventory/grant | Grant an item (upsert on (user, item) unique key). |
| POST | /admin/projects/:projectId/inventory/revoke | Revoke an item — decrement the held quantity (inverse). |
GET /admin/projects/:projectId/inventory/:userId
Response 200
Errors
500 FETCH_FAILED.
Try it:
/admin/projects/%7B%7BprojectId%7D%7D/inventory/%7B%7BuserId%7D%7Dcurl -X GET 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/inventory/%7B%7BuserId%7D%7D'Curl:
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)
| Field | Type | Required | Default |
|---|---|---|---|
app_user_id | uuid | yes | — |
catalog_item_id | uuid | yes | — |
quantity | number | no | 1 |
Response 201
Errors
500 GRANT_FAILED.
Try it:
/admin/projects/%7B%7BprojectId%7D%7D/inventory/grantcurl -X POST 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/inventory/grant'Curl:
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)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
app_user_id | uuid | yes | — | User to revoke from. |
catalog_item_id | uuid | yes | — | Catalog item to revoke. |
quantity | number | no | 1 | Positive 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.
Errors
400 VALIDATION_ERROR—app_user_idorcatalog_item_idmissing.400 INVALID_QUANTITY—quantityisn't a positive integer.400 INVALID_ID—app_user_idorcatalog_item_idisn't a UUID.400 INSUFFICIENT_QUANTITY— the user holds fewer thanquantity. 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:
/admin/projects/%7B%7BprojectId%7D%7D/inventory/revokecurl -X POST 'https://api.amba.dev/v1/admin/projects/%7B%7BprojectId%7D%7D/inventory/revoke'Curl: