API Guide (EN)

How to retrieve your daily statistics via API.

Powerspace API – Developer Guide

How to retrieve your daily statistics via the v4 API.

Key Information:

  • Base URL: https://api.powerspace.com
  • Method: GET
  • Date format: YYYY-MM-DD

1. Overview

GET /v4/advertiser

Retrieves statistics for a given day. The two required parameters are date and token.

📘

Important Note

If no data is available for the requested date, the API returns an empty array.


2. Authentication

Generate an API token from the Powerspace interface (API tab), then pass it as a query string: ?token=<YOUR_TOKEN>.

Best Practices:

  • Store the token in an environment variable (e.g., POWERS_API_TOKEN)
  • Never commit the token in plain text to a repository
  • Revoke and regenerate the token if exposed

3. Parameters

NameTypeRequiredExampleNotes
datestringYes2025-10-13ISO 8601 format YYYY-MM-DD. Defaults to UTC.
tokenstringYes********API token generated in the interface.

4. API Call Examples

cURL

curl -s "https://api.powerspace.com/v4/advertiser?date=2025-10-13&token=${POWERS_API_TOKEN}"

Python (requests)

import os, requests

BASE_URL = "https://api.powerspace.com/v4/advertiser"
TOKEN = os.environ["POWERS_API_TOKEN"]

res = requests.get(BASE_URL, params={"date": "2025-10-13", "token": TOKEN}, timeout=30)
res.raise_for_status()
ct = res.headers.get("content-type", "")
print(res.json() if "application/json" in ct else res.text)

Node.js (fetch)

const base = 'https://api.powerspace.com/v4/advertiser';
const token = process.env.POWERS_API_TOKEN;

(async () => {
  const url = base + `?date=2025-10-13&token=${token}`;
  const r = await fetch(url);
  if (!r.ok) throw new Error(r.status + ' ' + r.statusText);
  const ct = r.headers.get('content-type') || '';
  console.log(ct.includes('application/json') ? await r.json() : await r.text());
})();

Bash – Date Range

start=2025-10-01; end=2025-10-07
current=$start
while [ "$current" != "$(date -I -d "$end + 1 day")" ]; do
  url="https://api.powerspace.com/v4/advertiser?date=$current&token=$POWERS_API_TOKEN"
  echo Fetching $current... >&2
  curl -s "$url" > "stats_$current.json"
  current=$(date -I -d "$current + 1 day")
done

5. Response Structure

The API can return JSON (daily statistics)


6. Security

  • Store the token in a secret (Vault, GitHub Actions, Docker env vars, etc.)
  • Apply the principle of least privilege
  • Periodically renew and revoke unused tokens

7. Production Checklist

  • ✅ Token injected via secrets & environment variables
  • ✅ Strict validation of YYYY-MM-DD format
  • ✅ Handle cases with no data
  • ✅ Logging and alerting on errors ≥ 400
  • ✅ Retries/backoff on 429/5xx
  • ✅ Integration tests on a sample of known dates

Ready-to-Use Example

export POWERS_API_TOKEN=<YOUR_TOKEN>
curl -s "https://api.powerspace.com/v4/advertiser?date=$(date -I)&token=${POWERS_API_TOKEN}"