How to pass date in Elastic co billing API

Hi,
I have generate API key and I am getting data for current month by default using the curl command.
I am checking for some format how to add dates in api to retrieve data for last 3 months.
I checked documentation but didn't found any example using dates.

curl -XGET https://api.elastic-cloud.com/api/v1/billing/costs/<organization_id> \
-H "Authorization: ApiKey <yourapikey>"

Query parameters

Name Type Required Description
from string N A datetime for the beginning of the desired range for which to fetch costs. Defaults to start of current month. Note: there is currently a three-month maximum date range.
to string N A datetime for the end of the desired range for which to fetch costs. Defaults to end of current month. Note: there is currently a three-month maximum date range.

https://www.elastic.co/guide/en/cloud/current/Billing_Costs_Analysis.html#Billing_Costs_Analysis

curl -XGET "https://api.elastic-cloud.com/api/v1/billing/costs/4212746406/deployments?from=2021-07-01&to=2021-08-01" -H "Authorization: ApiKey $EC_API_KEY"

Not the Times are UTC
Note the quotes around the URL etc syntax is key.

Here specify detailed Date with Time

curl -XGET "https://api.elastic-cloud.com/api/v1/billing/costs/4212746406/deployments?from=2021-07-01T00:00:00.000Z&to=2021-08-01T00:00:00.000Z" -H "Authorization: ApiKey $EC_API_KEY"

This is a valid Date

2021-08-01

This is a valid Date-Time

2021-08-01T00:00:00.000Z

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.