List workspace rate limits
/v1/workspace/rate-limits// Workspace limits matter with several workspaces, or one that kept a limit after a deletion.
const { data } = await bird.workspace.rateLimits.list();
for (const policy of data) {
// Check usage.status first: workspace_remaining is also null when the
// workspace has no limit of its own or its usage is not measured yet.
console.log(policy.key, policy.limit, policy.usage.workspace_remaining);
}# Workspace limits matter with several workspaces, or one that kept a limit after a deletion.
limits = client.workspace.rate_limits.list()
for policy in limits.data:
# Check usage.status first: workspace_remaining is also None when the
# workspace has no limit of its own or its usage is not measured yet.
print(policy.key, policy.limit, policy.usage.workspace_remaining)// Workspace limits matter with several workspaces, or one that kept a limit after a deletion.
limits, err := client.Workspace.RateLimits.List(context.Background())
if err != nil {
log.Fatal(err)
}
for _, policy := range limits.Data {
fmt.Println(policy.Key, policy.Limit, policy.OrganizationLimit)
}// Workspace limits matter with several workspaces, or one that kept a limit after a deletion.
$limits = $bird->workspace->rateLimits->list();
foreach ($limits->getData() ?? [] as $policy) {
echo $policy->getKey() . ' ' . $policy->getLimit() . PHP_EOL;
}bird workspace rate-limits listcurl -X GET "https://us1.platform.bird.com/v1/workspace/rate-limits" \
-H "Authorization: Bearer $TOKEN"{
"data": [
{
"key": "email_send",
"workspace_limit": {
"status": "active"
},
"limit_source": "manual",
"attribution": {
"status": "unavailable"
},
"usage": {
"status": "available"
}
}
]
}
Only relevant to organizations with several workspaces, or one left with a workspace limit or enabled allocation after a deletion. When deleting workspaces leaves one, its manual limits apply until removed or expired, and enabled allocation continues. Without an active manual limit or allocation, one workspace uses the shared organization limit.
Returns every rate-limit policy as it applies to the current workspace: the organization limit shared by all workspaces, any manual or automatic workspace limit, and the remaining capacity observed in the current window.
A workspace limit is not reserved capacity. A request is refused when either the organization
limit or the workspace limit is reached. When usage cannot be read, usage.status is unavailable and
the remaining counts are null. usage.workspace_remaining is also null when neither a manual nor
an automatic limit applies, or attribution.status is not ready, so check usage.status before treating null
as a failed read.
Rate limits are served from the organization's home region. A request sent to another region returns 421 Misdirected Request; retry it on that region's host.
Payload Respons
dataTampilkan atribut turunan
data.keyStable key of the rate-limit policy.
data.namedata.descriptiondata.unitWhat the policy counts, such as request or message.
data.window_secondsThe rolling window length in seconds.
data.organization_limitMaximum policy units per rolling window for the whole organization, shared by all its workspaces.
data.workspace_limitThe workspace's own saved limit. null when none is saved; limit_source and automatic_limit then show whether an automatic share applies.
data.limitThe lower of the organization limit and the workspace's active limit or automatic share. Requests can still be refused below it when other workspaces use the shared organization limit.
data.limit_sourceWhich limit bounds the workspace's own usage.
manual: the workspace's own active limit.automatic: the workspace's share of the organization limit under its automatic allocation.organization: no workspace limit applies; only the shared organization limit does.
Possible values (may grow over time): manual, automatic, organization
data.automatic_limitThe workspace's share under the organization's automatic allocation, at least 1 per window. Set only when limit_source is automatic; it is never saved as a workspace limit.
data.allocation_enabledWhether the organization has an automatic allocation of this policy. It can be true while limit_source is manual. When true, changing or removing this workspace's limit can change other workspaces' automatic shares.
data.attributionWhen workspace usage has been measured for long enough to set a new workspace limit for this policy. Readiness covers timing only; a new limit also needs an organization with several workspaces, and with one workspace only an existing unexpired limit can be changed.
data.usageRemaining capacity in the current rolling window. Taking the observation consumes no capacity, but the request that reads it counts against its own policy, api_list, like any other read. It is measured against the limits that requests were checked against when it was read, which can briefly differ from the configured top-level organization_limit and workspace_limit after a limit changes.
Tampilkan atribut turunan
data.usage.statusWhether current usage could be read.
available: the remaining counts reflect usage atobserved_at.unavailable: usage could not be read. Remaining counts are unknown, not zero.
Possible values: available, unavailable
data.usage.observed_atWhen usage was read.
data.usage.organization_limitThe organization limit requests were checked against when usage was read. null when usage is unavailable.
data.usage.organization_remainingUnits the whole organization can still use in this window, shared by all its workspaces. null when usage is unavailable.
data.usage.workspace_limitThe workspace's own limit or automatic share requests were checked against when usage was read. null when no workspace limit applied or usage is unavailable.
data.usage.workspace_remainingUnits this workspace can still use under its own limit or automatic share. null when no workspace limit applied, usage is unavailable, or workspace usage is not yet measured for long enough.
data.usage.resets_in_secondsSeconds until the current window ends. null when usage is unavailable.
Sumber daya terkait
Lanjutkan dengan dokumentasi, panduan, dan contoh untuk topik ini.