---
title: "View Spend Logs"
method: GET
path: "/spend/logs"
tags: ["Budget & Spend Tracking"]
---

# View Spend Logs

`GET /spend/logs`

[DEPRECATED] This endpoint is not paginated and can cause performance issues.
Please use `/spend/logs/v2` instead for paginated access to spend logs.

View all spend logs, if request_id is provided, only logs for that request_id will be returned

When start_date and end_date are provided:
- summarize=true (default): Returns aggregated spend data grouped by date (maintains backward compatibility)
- summarize=false: Returns filtered individual log entries within the date range

Example Request for all logs
```
curl -X GET "http://0.0.0.0:8000/spend/logs" -H "Authorization: Bearer sk-1234"
```

Example Request for specific request_id
```
curl -X GET "http://0.0.0.0:8000/spend/logs?request_id=chatcmpl-6dcb2540-d3d7-4e49-bb27-291f863f112e" -H "Authorization: Bearer sk-1234"
```

Example Request for specific api_key
```
curl -X GET "http://0.0.0.0:8000/spend/logs?api_key=sk-test-example-key-123" -H "Authorization: Bearer sk-1234"
```

Example Request for specific user_id
```
curl -X GET "http://0.0.0.0:8000/spend/logs?user_id=ishaan@berri.ai" -H "Authorization: Bearer sk-1234"
```

Example Request for date range with individual logs (unsummarized)
```
curl -X GET "http://0.0.0.0:8000/spend/logs?start_date=2024-01-01&end_date=2024-01-02&summarize=false" -H "Authorization: Bearer sk-1234"
```

## Query parameters

- `api_key` string, nullable — Get spend logs based on api key
- `user_id` string, nullable — Get spend logs based on user_id
- `request_id` string, nullable — request_id to get spend logs for specific request_id. If none passed then pass spend logs for all requests
- `start_date` string, nullable — Time from which to start viewing key spend
- `end_date` string, nullable — Time till which to view key spend
- `summarize` boolean — When start_date and end_date are provided, summarize=true returns aggregated data by date (legacy behavior), summarize=false returns filtered individual logs

## Response `200`

Successful Response

- LiteLLMSpendLogs[]
  - `request_id` string, required
  - `api_key` string, required
  - `model` string, nullable
  - `api_base` string, nullable
  - `call_type` string, required
  - `spend` number, nullable
  - `total_tokens` integer, nullable
  - `prompt_tokens` integer, nullable
  - `completion_tokens` integer, nullable
  - `startTime` union, required
    - string
    - string, date-time
  - `endTime` union, required
    - string
    - string, date-time
  - `user` string, nullable
  - `metadata` unknown
  - `cache_hit` string, nullable
  - `cache_key` string, nullable
  - `request_tags` unknown
  - `requester_ip_address` string, nullable
  - `messages` union, required
    - string
    - unknown[]
      - unknown
    - object
  - `response` union, required
    - string
    - unknown[]
      - unknown
    - object

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/flock/apis/litellm-api.md) · [All operations](https://skmtc.net/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flock/litellm-api/revisions/8fbaab4fc7c5/schema)
