> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evomarketing.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Data API examples

> Copy requests and bring results into your own reports

Replace `YOUR_API_KEY` with your brand's key. Keep it out of shared files and repositories. The API base URL is `https://dialedapi.evomarketing.co/api/v1`.

## Check totals with curl

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://dialedapi.evomarketing.co/api/v1/metrics/summary?period=30d"
```

To download daily results as CSV:

```bash theme={null}
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://dialedapi.evomarketing.co/api/v1/metrics/daily.csv?period=30d" \
  -o evo-daily.csv
```

## Export every placement with Python

Install `requests`, then set `EVO_API_KEY` in your environment. The script follows `next_cursor` until `has_more` is false and writes a CSV.

```bash theme={null}
python -m pip install requests
export EVO_API_KEY="YOUR_API_KEY"
```

```python theme={null}
import csv
import os
import requests

url = "https://dialedapi.evomarketing.co/api/v1/posts"
headers = {"Authorization": f"Bearer {os.environ['EVO_API_KEY']}"}
params = {"period": "30d", "limit": 100}
columns = [
    "id", "url", "platform", "caption", "posted_at", "campaign_id",
    "campaign_name", "creator_id", "creator_name", "creator_handle",
    "views", "likes", "comments", "shares", "engagement_rate",
]

with open("evo-placements.csv", "w", newline="", encoding="utf-8") as output:
    writer = csv.DictWriter(output, fieldnames=columns)
    writer.writeheader()
    while True:
        response = requests.get(url, headers=headers, params=params, timeout=30)
        response.raise_for_status()
        result = response.json()
        for placement in result["data"]:
            writer.writerow({
                **{key: placement.get(key) for key in columns},
                "campaign_id": placement["campaign"]["id"],
                "campaign_name": placement["campaign"]["name"],
                "creator_id": placement["creator"]["id"],
                "creator_name": placement["creator"]["name"],
                "creator_handle": placement["creator"]["handle"],
            })
        if not result["pagination"]["has_more"]:
            break
        params["cursor"] = result["pagination"]["next_cursor"]
```

## Read a summary with JavaScript

Set `EVO_API_KEY` in your environment, then run this with Node.js.

```javascript theme={null}
const response = await fetch(
  "https://dialedapi.evomarketing.co/api/v1/metrics/summary?period=30d",
  { headers: { Authorization: `Bearer ${process.env.EVO_API_KEY}` } }
);

if (!response.ok) throw new Error(`Data API returned ${response.status}`);
const { data, meta } = await response.json();
console.log(meta.brand.name, data.views, data.creators);
```

## Join daily views with your conversions

Export daily metrics and your own conversions with a `date` column in each CSV. This example joins them by date.

```python theme={null}
import pandas as pd

views = pd.read_csv("evo-daily.csv", parse_dates=["date"])
conversions = pd.read_csv("conversions.csv", parse_dates=["date"])
report = views.merge(conversions, on="date", how="left")
report.to_csv("views-and-conversions.csv", index=False)
```

Use `attribution=view_date` when you want views counted on the day they happened. See [common parameters](/data-api/endpoints#common-parameters) for the difference between attribution choices.

## Import the OpenAPI document into Postman

In Postman, select **Import**, choose **Link**, and paste `https://dialedapi.evomarketing.co/api/v1/openapi.json`. Add your key as a Bearer token in the imported collection before you send a request. The OpenAPI document itself is public.
