Platform Billing Service API supports key-based authentication. You must create an API key and use the encoded value in the request header. For convenience, you can export your API key into your shell environment:

export EC_API_KEY="YOUR_GENERATED_API_KEY"

For example, the following curl command retrieves costs associated with all items:

curl -H "Authorization: ApiKey $EC_API_KEY" "https://cloud.elastic.co/api/v2/billing/organizations/{organization_id}/costs/items?from=2025-08-01T00:00:00Z&to=2025-08-31T00:00:00Z"