# Get usage summary

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

GET https://admin-api.alchemy.com/v1/usage/summary

Retrieves usage totals for the current billing period and recent rolling windows.

Reference: https://www.alchemy.com/docs/tutorials/tools/admin-api/usage-api-endpoints/get-usage-summary

## Headers

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Authorization | string | Yes | Bearer authentication token |

## Code Examples

### cURL

```bash
curl --request GET \
  --url https://admin-api.alchemy.com/v1/usage/summary \
  --header 'Authorization: Bearer <token>'
```

### JavaScript

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://admin-api.alchemy.com/v1/usage/summary', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://admin-api.alchemy.com/v1/usage/summary"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://admin-api.alchemy.com/v1/usage/summary"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.get("https://admin-api.alchemy.com/v1/usage/summary")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://admin-api.alchemy.com/v1/usage/summary");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /v1/usage/summary
method: GET
operation:
  operationId: GetUsageSummary
  responses:
    '200':
      description: Retrieved usage summary successfully
      content:
        application/json:
          schema:
            description: |-
              Standard API response wrapper.
              All API responses are wrapped in this format for consistency.
            properties:
              data:
                properties:
                  billingPeriod:
                    properties:
                      endTime:
                        type: string
                      startTime:
                        type: string
                    required:
                      - endTime
                      - startTime
                    type: object
                  totals:
                    properties:
                      last30Days:
                        properties:
                          amount:
                            type: string
                            description: Product-native amount in the associated MoneyUnit.
                          unit:
                            type: string
                            description: Billing service MoneyUnit enum name.
                            example: ALCHEMY_COMPUTE_UNIT
                          usd:
                            type: string
                            description: Estimated fiat equivalent in USD.
                        required:
                          - amount
                          - unit
                        type: object
                        additionalProperties: false
                      last7Days:
                        properties:
                          amount:
                            type: string
                            description: Product-native amount in the associated MoneyUnit.
                          unit:
                            type: string
                            description: Billing service MoneyUnit enum name.
                            example: ALCHEMY_COMPUTE_UNIT
                          usd:
                            type: string
                            description: Estimated fiat equivalent in USD.
                        required:
                          - amount
                          - unit
                        type: object
                        additionalProperties: false
                      monthToDate:
                        properties:
                          amount:
                            type: string
                            description: Product-native amount in the associated MoneyUnit.
                          unit:
                            type: string
                            description: Billing service MoneyUnit enum name.
                            example: ALCHEMY_COMPUTE_UNIT
                          usd:
                            type: string
                            description: Estimated fiat equivalent in USD.
                        required:
                          - amount
                          - unit
                        type: object
                        additionalProperties: false
                    required:
                      - last30Days
                      - last7Days
                      - monthToDate
                    type: object
                  usageLimit:
                    properties:
                      unit:
                        enum:
                          - CU
                          - USD
                        type: string
                      limit:
                        type: string
                      used:
                        type: string
                      remaining:
                        type: string
                      percentUsed:
                        type: number
                        format: double
                    required:
                      - unit
                      - limit
                      - used
                    type: object
                    additionalProperties: false
                  freshness:
                    properties:
                      dataThrough:
                        type: string
                      containsPartialToday:
                        type: boolean
                      updateCadence:
                        enum:
                          - minute
                        type: string
                    required:
                      - dataThrough
                      - containsPartialToday
                      - updateCadence
                    type: object
                    additionalProperties: false
                required:
                  - billingPeriod
                  - totals
                  - freshness
                type: object
                additionalProperties: false
            required:
              - data
            type: object
            additionalProperties: false
    '401':
      description: Requires authentication
      content:
        application/json:
          schema:
            description: |-
              Standard error response wrapper.
              All error responses are wrapped in this format for consistency.
            properties:
              error:
                properties:
                  message:
                    type: string
                  code:
                    anyOf:
                      - type: integer
                        format: int32
                      - enum:
                          - 500
                          - 400
                          - 401
                          - 403
                          - 404
                          - 200
                          - 201
                          - 1000
                        type: number
                  status:
                    type: integer
                    format: int32
                  context:
                    description: Additional information about the error specific to the endpoint.
                    properties: {}
                    type: object
                    additionalProperties: {}
                required:
                  - message
                  - code
                  - status
                type: object
                additionalProperties: false
            required:
              - error
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                error:
                  code: 401
                  status: 401
                  message: Requires authentication
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            description: |-
              Standard error response wrapper.
              All error responses are wrapped in this format for consistency.
            properties:
              error:
                properties:
                  message:
                    type: string
                  code:
                    anyOf:
                      - type: integer
                        format: int32
                      - enum:
                          - 500
                          - 400
                          - 401
                          - 403
                          - 404
                          - 200
                          - 201
                          - 1000
                        type: number
                  status:
                    type: integer
                    format: int32
                  context:
                    description: Additional information about the error specific to the endpoint.
                    properties: {}
                    type: object
                    additionalProperties: {}
                required:
                  - message
                  - code
                  - status
                type: object
                additionalProperties: false
            required:
              - error
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                error:
                  code: 403
                  status: 403
                  message: Forbidden
    '404':
      description: Not found
      content:
        application/json:
          schema:
            description: |-
              Standard error response wrapper.
              All error responses are wrapped in this format for consistency.
            properties:
              error:
                properties:
                  message:
                    type: string
                  code:
                    anyOf:
                      - type: integer
                        format: int32
                      - enum:
                          - 500
                          - 400
                          - 401
                          - 403
                          - 404
                          - 200
                          - 201
                          - 1000
                        type: number
                  status:
                    type: integer
                    format: int32
                  context:
                    description: Additional information about the error specific to the endpoint.
                    properties: {}
                    type: object
                    additionalProperties: {}
                required:
                  - message
                  - code
                  - status
                type: object
                additionalProperties: false
            required:
              - error
            type: object
            additionalProperties: false
          examples:
            Example 1:
              value:
                error:
                  code: 404
                  status: 404
                  message: Path not found
  description: Retrieves usage totals for the current billing period and recent rolling windows.
  summary: Get usage summary
  security:
    - user_auth:
        - viewer
        - developer
        - admin
  parameters: []
```
