---
type: api
title: Authentication
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-billing/authentication
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/cloud-billing/authentication
products:
  - Elastic Cloud Hosted
---

# Authentication

Platform Billing Service API supports key-based authentication.
You must [create an API key](https://www.elastic.co/guide/en/cloud/current/ec-api-authentication.html) 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"
```

