hosting
GET /v1/sites/capacity
Whether this organization may create another site, and how much room is left.
身份验证
请将 API 密钥作为 bearer 令牌发送。此端点在规范中未指明具体的权限,因此请为您的密钥赋予所需的最小权限,并通过检查响应来确认,而不是盲目假设。
您的组织 ID 应填在此处
此端点将 org_id 作为查询参数。不填则调用涵盖您的整个租户子树;发送该参数则将调用范围缩小到一个组织。
您的组织ID位于控制面板的API密钥屏幕上,就在密钥本身的旁边。这是您在每次调用时使用的相同ID。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X GET https://api.zinndigital.com/v1/sites/capacity \
-H "Authorization: Bearer zdk_live_…"已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
The site cap **as `POST /v1/sites` would apply it**, answered before the customer fills the form in rather than after. Until this existed the cap was reachable only by failing: the create refused with `SITE_QUOTA_EXCEEDED` or `PLAN_REQUIRED` at the end of a three-step wizard, which is the worst moment to learn a plan is full. It resolves through the same function the refusal does, so the screen and the refusal cannot disagree. It is **advisory and takes no lock**: another member of the organization may take the last slot between this answer and the create, in which case the create still refuses. The engine is the control; this endpoint is what lets a client disable a button *with a reason* instead of letting it fail. `has_room` is always answered — it discloses nothing a caller cannot obtain by POSTing — but every **figure** is gated twice: on the `billing.view` permission (plan size is what that permission means) and on whether the governing plan belongs to an organization already inside the caller's scope. Under hierarchical tenancy the plan may be an ancestor's and `used` is counted across that ancestor's whole subtree, so a client-org member is told their plan is managed elsewhere rather than handed an aggregate over sibling tenants.
参数
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
org_id (query) | Uuid | 否 | The organization to answer for. Required when the caller can create sites in more than one; otherwise defaults to theirs. |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
has_room | boolean | 是 | Whether one more site may be created right now. Always answered, at every permission level — it discloses nothing a caller cannot obtain by POSTing. Advisory: no lock is taken,… |
unlimited | boolean | 是 | Whether the grant is uncapped. When true, `limit` and `remaining` are null. |
source | string<subscription, trial, staff, none> | 是 | What grants the allowance — `subscription`, `trial`, `staff`, or `none` when nothing in the organization chain grants hosting at all. |
has_plan | boolean | 是 | Whether anything grants hosting. `false` is the `PLAN_REQUIRED` state the create would refuse with, reported before the customer fills the form in. |
broken_chain | boolean | 是 | The organization's `parent_org` chain could not be walked — a data defect, not a customer without a plan. A client must say "contact support" for this, never "choose a plan", or… |
disclosed | boolean | 是 | Whether the figures below are populated. False when the caller lacks `billing.view`, or when the governing plan belongs to an organization outside their scope. |
managed_elsewhere | boolean | 是 | There IS a plan, and it is not this caller's to see — a client organization hosted under its parent's plan. The sentence to render instead of a number. |
limit | integer | 否 | How many sites the plan covers. Null when undisclosed or unlimited. |
used | integer | 否 | Sites already consuming the allowance, counted across the entitling organization's whole subtree. Null when undisclosed. |
remaining | integer | 否 | Slots left, never negative — a downgrade to a smaller tier does not delete existing sites, so `used` may legitimately exceed `limit`. Null when undisclosed or unlimited. |
entitling_org_id | Uuid | 否 | Which organization's plan applied — this one, or an ancestor under hierarchical tenancy. Null when undisclosed. |
breakdown | object | 否 | `used`, split by the site status holding each slot — the answer to "what are my occupied slots actually holding?". Keys are `SiteStatus` values; the counts sum to `used` exactly… |
此端点可能返回的错误
401 · 403