Register or update tenants of a site
const url = 'https://api.pomeloanalytics.com/v1/tenants';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"site_id":"example","tenants":[{"tenant_id":"example","tenant_slug":"example","tenant_name":"example","status":"ACTIVE"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pomeloanalytics.com/v1/tenants \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "site_id": "example", "tenants": [ { "tenant_id": "example", "tenant_slug": "example", "tenant_name": "example", "status": "ACTIVE" } ] }'Requires the dedicated tenants:write scope, distinct from the read
scopes; a token restricted to some tenants cannot hold it.
Additive and idempotent. The listed tenants are created or updated;
tenants that are not listed are never changed. Sending the same body
again changes nothing (unchanged). A tenant is deactivated only by
an explicit status: INACTIVE. The whole body is validated before
the first write; a batch interrupted by a failure is resumed by
sending it again. At most 100 tenants per request: send larger
registries in several requests. A slug already used by another tenant
of the site is refused with 409 TENANT_SLUG_CONFLICT. A tenant
changed by another write between the read and the write is refused with
409 TENANT_CONFLICT: nothing is overwritten, send the request again.
Authorizations
Section intitulée « Authorizations »Parameters
Section intitulée « Parameters »Header Parameters
Section intitulée « Header Parameters »Optional idempotency/request correlation identifier.
Request Bodyrequired
Section intitulée « Request Bodyrequired »object
object
Stable tenant identifier chosen by the platform.
Routing slug, unique within the site.
Display name.
Omitted keeps the stored status (ACTIVE for a new tenant).
INACTIVE is the only way to deactivate a tenant.
Responses
Section intitulée « Responses »OK
object
object
Stable tenant identifier.
Current routing slug from the tenant registry.
Current display name from the tenant registry.
Example
{ "items": [ { "status": "ACTIVE", "result": "created" } ]}Request identifier for troubleshooting.
Present with the value near_hard_cap once the workspace has used 80 %
of its monthly API hard cap. Plan for the ceiling before requests are
refused with HARD_CAP_REACHED. Never sent to a token restricted to
tenants.
Invalid or revoked API token.
object
object
object
Example
{ "error": { "code": "UNAUTHORIZED" }}Request identifier for troubleshooting.
Token scope/site/plan does not allow this request.
object
object
object
Example
{ "error": { "code": "UNAUTHORIZED" }}Request identifier for troubleshooting.
TENANT_SLUG_CONFLICT: a slug is already used by another tenant of the site. TENANT_CONFLICT: a tenant was changed concurrently; send the request again.
object
object
object
Example
{ "error": { "code": "TENANT_SLUG_CONFLICT" }}Request identifier for troubleshooting.
Request parameters are invalid, or the result is below the minimum reporting cohort (REPORTING_THRESHOLD, no details).
object
object
object
Example
{ "error": { "code": "UNAUTHORIZED" }}Request identifier for troubleshooting.
Request was throttled.
object
object
object
Example
{ "error": { "code": "UNAUTHORIZED" }}Request identifier for troubleshooting.
Maximum requests allowed during current short window.
Remaining requests in current short window.
Unix timestamp when short window resets.