Skip to content

Tenant API

Base URL: the ApiGatewayUrl output of the tenant’s stack, which is the apiGatewayUrl in GET /tenant-config/{name}. Every route needs Authorization: Bearer <ID token> from that stack’s user pool. Never send a tenant id: it comes from the token.

Item keys have the form <shardId>:<itemId>. URL-encode them in paths.

Method Path Result
GET /whoami What the authorizer derived from the token
{ "tenantId": "6e02dc17-…", "tenantTier": "BASIC", "userRole": "TenantAdmin", "userName": "docs-demo",
"apiKeyId": "6bo0lteh78", "scopedCredentialsReceived": true, "codeVersion": "YTZTkJso…" }
Method Path Body
GET /products
POST /products {"sku","name","price","category"}
GET /products/{key}
PUT /products/{key} same as POST
DELETE /products/{key}
{ "key": "6e02dc17-…-5:40a0b8a1-…", "shardId": "6e02dc17-…-5", "productId": "40a0b8a1-…",
"sku": "AN-1", "name": "Anvil XL", "price": 60, "category": "heavy" }
Method Path Body
GET /orders
POST /orders {"orderName","orderProducts":[{"productId","price","quantity"}]}
GET /orders/{key}
PUT /orders/{key} same as POST
DELETE /orders/{key}
Method Path Allowed for Body
GET /users TenantAdmin, TenantUser
GET /users/{username} TenantAdmin, TenantUser
POST /users TenantAdmin {"userName","userEmail","userRole"}
PUT /users/{username} TenantAdmin {"userEmail"?,"userRole"?}
DELETE /users/{username}/disable TenantAdmin
PUT /users/{username}/enable TenantAdmin
DELETE /users/{username} TenantAdmin

userRole must be TenantAdmin or TenantUser. A user can’t edit their own record.

Code Meaning
401 Missing, invalid or expired token, a token from another user pool, or a tier this stack doesn’t serve
403 The key belongs to another tenant, the role isn’t allowed, or (briefly) a fresh deploy is propagating
429 The tier’s usage plan rate or quota was exceeded

CORS allows any origin, so you can call the API from a browser on any host.