If your billing cycle started before November 5, you may see only partial account-level usage data through the APIs for the current cycle, depending on your monthly billing reset date. This is a one-time limitation in API visibility — your data is still there, and the APIs will show complete data for your next monthly billing cycle. Your complete usage data is available through CSV export or data share (for Cloud Enterprise customers).
Use this tutorial to set limits for multiple accounts in one API request, review the result for each account, and verify each account’s limit and current usage.
You’ll work with the Rovo credits meter in this tutorial.
For more details on meters and usage, see What is Platform usage?
For full technical details of available operations, see the meters API.
This tutorial does not cover:
DELETE.To complete this tutorial, you need the following:
| Placeholder | Replace it with |
|---|---|
{orgId} | Your organization ID |
{meterId} | The ID of a meter that supports limits (see Find the Rovo credits meter ID) |
<api_key> | Your organization API key |
{accountId} | An Atlassian account ID (for example, a user or a service account) |
{newLimit} | A whole-number monthly limit in credits (25 or greater). The new limit replaces an account’s existing limit. |
An API token is not an API key.
Authorization: Bearer <api_key>.This tutorial uses an organization API key as a Bearer token.
Keep the API key out of source code and version control.
Follow the steps in Find the Rovo credits meter ID if you haven’t already made a copy of your meter ID.
You can set limits for Rovo credits for multiple accounts in batches. Some useful information about how limits work:
accountId.25 or greater) in limit.Example request body:
1 2 3 4 5 6 7 8 9 10 11 12 13{ "rows": [ { "accountId": "5b10ac8d82e05b22cc7d4ef5", "limit": 1000 }, { "accountId": "712020:6f2e0a7b-3c1d-4e2f-9a8b-1c2d3e4f5a6b", "limit": 1000 } ] }
accountId and an absolute limit in credits, as a whole number.Set limits for Rovo credits for multiple accounts with the operation:
PUT /admin/v1/orgs/{orgId}/meters/{meterId}/limits
1 2 3 4 5 6 7curl --request PUT \ --url "https://api.atlassian.com/admin/v1/orgs/{orgId}/meters/{meterId}/limits" \ --header "Authorization: Bearer <api_key>" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{"rows": [{"accountId": "{accountId}", "limit": {newLimit}}]}'
{orgId}, {meterId}, and <api_key>.rows array with all of the account-limit objects you prepared earlier.PUT request for the prepared batch.Your API tool will return a response. Here’s an example of a response that contains a status of SUCCESS and a status of FAILURE:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22{ "data": [ { "accountId": "5b10ac8d82e05b22cc7d4ef5", "status": "SUCCESS", "result": { "limit": 1000 } }, { "accountId": "712020:6f2e0a7b-3c1d-4e2f-9a8b-1c2d3e4f5a6b", "status": "FAILURE", "error": { "type": "https://developer.atlassian.com/cloud/admin/organization/meters/problems/account-not-found", "title": "Account not found", "status": 404, "detail": "The account doesn't exist or isn't active." } } ] }
Use the following table as a reference for the top-level response to your request.
| Response | Meaning | What to do |
|---|---|---|
207 | The API processed the rows, but one or more rows might have failed. | Inspect the status of every row in the response. Continue to the next step. |
400 with duplicate-account | An account appears in two or more rows. No rows were written. | Remove duplicate account IDs and send the request again. |
400 with invalid-request | The request body is invalid. No rows were written. | Correct the request body syntax and send the request again. |
400 with limits-not-supported | The selected meter does not support limits. No rows were written. | Use a meter that supports limits. |
400 with too-many-rows | The request contains more than 50 rows or contains no rows. No rows were written. | Send between 1 and 50 rows. |
404 with meter-not-found | The meter is not one of the organization’s meters, or it’s deactivated. | Check {meterId} and select an active organization meter. |
429 | You sent too many requests for your organization. No rows were written. | Wait, then send the same batch again. If the response has an X-Retry-After header, wait that long first. |
500 with internal-error | Something went wrong unexpectedly. Some rows might have been written. | Wait a short time, then retry the entire request. Retrying is safe because every row sets an absolute limit. |
503 | The request could not be completed. Some rows might still have been written. | Wait a short time, then retry the entire request. Retrying is safe because every row sets an absolute limit. |
A 207 Multi-Status response contains a data array with one result object per account. You must still check each result separately. For each row in the response, read its status value.
SUCCESS, result.limit contains the limit that was set.FAILURE, check error.status, error.type, and error.detail to understand the failure.The field names below refer to each account’s result.
| Row response | Meaning | What to do |
|---|---|---|
SUCCESS | The limit was created or replaced. | Proceed to the next step to verify the limit. |
400 with invalid-account or invalid-limit | The account ID or limit value is invalid. | Correct that row and retry sending the request. |
404 with account-not-found | The account doesn’t exist or isn’t active. | Check the account ID. If the account was deactivated or deleted, remove the row. |
409 with limit-rejected | The service rejected the limit. | Read the error details and resolve the reported issue before trying again. |
500 with internal-error | The service encountered an internal error. | Retry the row later. Contact support if the error continues. |
503 with service-unavailable | The service was temporarily unavailable for that row. | Retry the row later. Retrying is safe because the row sets an absolute limit. |
After your batch request has completed, you can verify account limits and current usage in one call with this read-only operation:
POST /admin/v1/orgs/{orgId}/meters/{meterId}/usage/search
You can include up to 100 account IDs in one verification request. Because it’s a read-only operation, there’s no risk of overwriting any account limits. The response can include these values for each account:
limitusagebalanceusageState1 2 3 4 5 6 7curl --request POST \ --url "https://api.atlassian.com/admin/v1/orgs/{orgId}/meters/{meterId}/usage/search" \ --header "Authorization: Bearer <api_key>" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data '{"filters": {"accountIds": ["{accountId}", "{accountId}"]}}'
{orgId}, {meterId}, and <api_key>.accountIds array with the account IDs you want to verify.POST request for the prepared batch.For every account ID you send in the request, the response returns an account record in the same order. Successful responses return a data array. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19{ "data": [ { "accountId": "5b10ac8d82e05b22cc7d4ef5", "limit": 1000, "usage": 250, "balance": 750, "usageState": "WITHIN_LIMIT" }, { "accountId": "712020:6f2e0a7b-3c1d-4e2f-9a8b-1c2d3e4f5a6b", "limit": null, "usage": 0, "balance": null, "usageState": "WITHIN_LIMIT" } ] }
In the example response, the account starting with 712020 failed in Step 4 and had no previous limit, so its limit is null. For an account whose update returned FAILURE, a returned limit that differs from the one you sent is expected. For an account that returned SUCCESS, follow the numbered steps below.
The field names below refer to each account record. Each record includes the account’s limit, usage, and balance. Its usageState is either WITHIN_LIMIT or LIMIT_REACHED, indicating whether the account has reached its own limit.
Other field details to note:
limit: null and balance: null.usage: 0.null if it had none.usage: 0. This does not confirm that the account exists.usageState of WITHIN_LIMIT means the account's own limit isn't blocking it. If the organization has reached its limit, the account will still be blocked even if it shows WITHIN_LIMIT.To verify each account’s limit and usage, follow these steps.
limit with the limit you sent.SUCCESS but its returned limit does not match the limit you sent, wait a few seconds, then send the verification request again. Limit changes can take a few seconds to appear in this response. If the limit still doesn’t match after a few tries, contact support.For more examples and details, see the meters API documentation.
Rate this page: