API Keys

API Documentation

Read-only REST API for pulling your campaign data into external tools, dashboards, and AI agents.

Authentication

All requests require an API key passed in the x-api-key header. Create keys in Settings → API Keys.

Base URL

https://api.roas.to/external/v1/facebook

Example Request

curl -H "x-api-key: roas_your_key_here" \
  "https://api.roas.to/external/v1/facebook/campaigns?start_date=2026-03-29&end_date=2026-04-05"

Read-only

Only GET requests. No writes.

EST timestamps

All dates returned in America/New_York.

Budget units

Budget fields ending in Minor use account-currency minor units.

Endpoints

Ad Accounts
1
Campaigns
2
Ad Sets
2
Ads
2
Conversions
1
Daily Aggregates
1
Automation
1
Batches
1

Metrics Reference

Every performance endpoint returns both Facebook-reported metrics and your true tracked metrics side by side.

FieldSourceDescription
fbImpressions
Facebook
Total impressions (Facebook-reported)
fbClicks
Facebook
Total clicks (all types)
fbLinkClicks
Facebook
Link clicks only (outbound)
fbSpend
Facebook
Total spend in account currency
fbReach
Facebook
Unique users reached
fbCtr
Facebook
Click-through rate (%)
fbCpc
Facebook
Cost per click
fbCpm
Facebook
Cost per 1,000 impressions
fbPurchases
Facebook
Facebook-reported purchases (pixel)
fbPurchaseValue
Facebook
Facebook-reported purchase value
ourConversions
ROAS.to
Conversions tracked by ROAS.to
ourRevenue
ROAS.to
Revenue tracked by ROAS.to
trueRoas
ROAS.to
ourRevenue / fbSpend (your real ROAS)
trueCpa
ROAS.to
fbSpend / ourConversions (your real CPA)
profitLoss
ROAS.to
ourRevenue - fbSpend (daily endpoint only)

Rate Limits & Errors

60 requests / minute

Per API key. Check response headers for remaining quota.

1,000 max per page

Use limit + offset for pagination. Default: 100.

Rate Limit Headers

HeaderDescription
X-RateLimit-LimitMax requests per window (60)
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets
X-TimezoneTimezone of response timestamps (America/New_York)

Error Codes

StatusMeaning
401
Missing or invalid API key
404
Resource not found (or belongs to another workspace)
405
Method not allowed (only GET is supported)
429
Rate limit exceeded. Wait and retry.
500
Internal server error. Contact support@roas.to.