Create One Cost Explorer Query Process
Creates a query process within the Cost Explorer for the given parameters. A token is returned that can be used to poll the status of the query and eventually retrieve the results.
Path parameters
-
Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the /orgs endpoint to retrieve all organizations to which the authenticated user has access.
Format should match the following pattern:
^([a-f0-9]{24})$
.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelope
JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false
.
Body
Required
Filter parameters for the Cost Explorer query.
-
The list of projects to be included in the Cost Explorer Query.
Format of each should match the following pattern:
^([a-f0-9]{24})$
. -
The exclusive ending date for the Cost Explorer query. The date must be the start of a month.
-
The dimension to group the returned usage results by. At least one filter value needs to be provided for a dimension to be used.
Values are
organizations
,projects
,clusters
, orservices
. -
Flag to control whether usage that matches the filter criteria, but does not have values for all filter criteria is included in response. Default is false, which excludes the partially matching data.
-
The list of organizations to be included in the Cost Explorer Query.
Format of each should match the following pattern:
^([a-f0-9]{24})$
. -
The list of projects to be included in the Cost Explorer Query.
Format of each should match the following pattern:
^([a-f0-9]{24})$
. -
The list of projects to be included in the Cost Explorer Query.
Values are
Atlas
,Clusters
,Storage
,Serverless Instances
,Backup
,Data Transfer
,BI Connector
,Premium Features
,Atlas Data Federation
,Atlas Stream Processing
,App Services
,Charts
,Cloud Manager
,Cloud Manager Standard/Premium
,Legacy Backup
,Flex Consulting
,Support
, orCredits
. -
The inclusive starting date for the Cost Explorer query. The date must be the start of a month.
curl \
--request POST 'https://cloud.mongodb.com/api/atlas/v2/orgs/4888442a3354817a7320eb61/billing/costExplorer/usage' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/vnd.atlas.2023-01-01+json"
{
"clusters": [
"32b6e34b3d91647abb20e7b8"
],
"endDate": "2025-05-04",
"groupBy": "organizations",
"includePartialMatches": true,
"organizations": [
"32b6e34b3d91647abb20e7b8"
],
"projects": [
"32b6e34b3d91647abb20e7b8"
],
"services": [
"Atlas"
],
"startDate": "2025-05-04"
}
{
"token": "d9ab638a801efe182f98ae3e18ea4bb47b9fda808a28a8c7de205bb0e94f7d71"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}