---
title: "Get Ad Spend"
method: POST
path: "/api/ad-spend"
tags: ["Analytics"]
---

# Get Ad Spend

`POST /api/ad-spend`

Retrieve ad spend data grouped by various dimensions.

## Request body

- AdSpendRequest
  - `startDate` string, date, required — Start date (YYYY-MM-DD)
  - `endDate` string, date, required — End date (YYYY-MM-DD)
  - `platform` 'googleads' | 'meta' | 'microsoftads' — Filter by platform
  - `groupBy` 'date' | 'campaign' | 'adgroup' | 'platform' — Dimension to group results by
  - `limit` integer — Results per page (1-500)
  - `page` integer — Page number

## Response `200`

Ad spend data retrieved successfully

- object
  - `success` boolean
  - `data` AdSpendEntry[]
    - `date` string, date — Date (when groupBy is `date`)
    - `campaignId` string — Campaign ID (when groupBy is `campaign` or `adgroup`)
    - `campaignName` string — Campaign name (when groupBy is `campaign` or `adgroup`)
    - `adGroupId` string — Ad group ID (when groupBy is `adgroup`)
    - `adGroupName` string — Ad group name (when groupBy is `adgroup`)
    - `platform` 'googleads' | 'meta' | 'microsoftads' — Platform (when groupBy is `campaign`, `adgroup`, or `platform`)
    - `cost` number — Total cost
    - `clicks` integer — Total clicks
    - `impressions` integer — Total impressions
    - `conversions` integer — Total conversions
  - `meta` PaginatedMeta
    - `pagination` object
      - `limit` integer
      - `page` integer
      - `totalPages` integer
      - `total` integer
      - `hasMore` boolean
    - `requestId` string
    - `timestamp` string, date-time

## Other responses

- `400` — Invalid request body, startDate > endDate, or invalid date format
- `401` — Missing or invalid API key
- `500` — Server error

---

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