Aller au contenu
La référence de l’API est en anglais.

Register or update tenants of a site

POST
/v1/tenants
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.

X-Request-Id
string

Optional idempotency/request correlation identifier.

Media typeapplication/json
object
site_id
required
string
tenants
required
Array<object>
<= 100 items
object
tenant_id
required

Stable tenant identifier chosen by the platform.

string
/^[A-Za-z0-9_-]{1,200}$/
tenant_slug
required

Routing slug, unique within the site.

string
/^[a-z0-9][a-z0-9-]{0,127}$/
tenant_name
required

Display name.

string
<= 200 characters
status

Omitted keeps the stored status (ACTIVE for a new tenant). INACTIVE is the only way to deactivate a tenant.

string
Allowed values: ACTIVE INACTIVE

OK

Media typeapplication/json
object
items
required
Array
object
tenant_id
required

Stable tenant identifier.

string
tenant_slug
required

Current routing slug from the tenant registry.

string
tenant_name
required

Current display name from the tenant registry.

string
status
required
string
Allowed values: ACTIVE INACTIVE
result
required
string
Allowed values: created updated unchanged
created
required
integer
updated
required
integer
unchanged
required
integer
Example
{
"items": [
{
"status": "ACTIVE",
"result": "created"
}
]
}
X-Request-Id
string

Request identifier for troubleshooting.

X-Pomelo-Usage-Warning
string
Allowed values: near_hard_cap

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.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN INVALID_METHOD INVALID_PARAMS RETENTION_EXCEEDED RATE_LIMITED HARD_CAP_REACHED REPORT_NOT_AVAILABLE_FOR_REQUESTED_PERIOD REPORT_RESPONSE_TOO_LARGE INTERNAL_ERROR NOT_FOUND
message
required
string
request_id
required
string
details
object
key
additional properties
any
Example
{
"error": {
"code": "UNAUTHORIZED"
}
}
X-Request-Id
string

Request identifier for troubleshooting.

Token scope/site/plan does not allow this request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN INVALID_METHOD INVALID_PARAMS RETENTION_EXCEEDED RATE_LIMITED HARD_CAP_REACHED REPORT_NOT_AVAILABLE_FOR_REQUESTED_PERIOD REPORT_RESPONSE_TOO_LARGE INTERNAL_ERROR NOT_FOUND
message
required
string
request_id
required
string
details
object
key
additional properties
any
Example
{
"error": {
"code": "UNAUTHORIZED"
}
}
X-Request-Id
string

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.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: TENANT_SLUG_CONFLICT TENANT_CONFLICT
message
required
string
request_id
required
string
details
object
key
additional properties
any
Example
{
"error": {
"code": "TENANT_SLUG_CONFLICT"
}
}
X-Request-Id
string

Request identifier for troubleshooting.

Request parameters are invalid, or the result is below the minimum reporting cohort (REPORTING_THRESHOLD, no details).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN INVALID_METHOD INVALID_PARAMS RETENTION_EXCEEDED RATE_LIMITED HARD_CAP_REACHED REPORT_NOT_AVAILABLE_FOR_REQUESTED_PERIOD REPORT_RESPONSE_TOO_LARGE INTERNAL_ERROR NOT_FOUND
message
required
string
request_id
required
string
details
object
key
additional properties
any
Example
{
"error": {
"code": "UNAUTHORIZED"
}
}
X-Request-Id
string

Request identifier for troubleshooting.

Request was throttled.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: UNAUTHORIZED FORBIDDEN INVALID_METHOD INVALID_PARAMS RETENTION_EXCEEDED RATE_LIMITED HARD_CAP_REACHED REPORT_NOT_AVAILABLE_FOR_REQUESTED_PERIOD REPORT_RESPONSE_TOO_LARGE INTERNAL_ERROR NOT_FOUND
message
required
string
request_id
required
string
details
object
key
additional properties
any
Example
{
"error": {
"code": "UNAUTHORIZED"
}
}
X-Request-Id
string

Request identifier for troubleshooting.

X-RateLimit-Limit
integer

Maximum requests allowed during current short window.

X-RateLimit-Remaining
integer

Remaining requests in current short window.

X-RateLimit-Reset
integer

Unix timestamp when short window resets.