API reference
Ad performance, at any level
Spend, revenue, ROAS, CPA and conversions at account, campaign, adset or ad level. Runs the same fetcher and metric catalog the product uses internally.
/v1/metricscurl "https://api.cresva.ai/v1/metrics?date_from=2026-07-01&date_to=2026-07-31&brand_id=brd_8Kq2mR4xVn" \ -H "Authorization: Bearer $CRESVA_API_KEY"Illustrative values. The parameter names, types and defaults are the ones the endpoint enforces.
Authorization
AuthorizationAuthorization: Bearer cresva_sk_live_.... A key beginning cresva_sk_test_ returns simulated data from this endpoint instead.Query parameters
Sent in the query string. Values are coerced to the types below, so numbers may be sent as strings.
date_fromstringrequiredStart date, inclusive.
pattern ^\d{4}-\d{2}-\d{2}$
date_tostringrequiredEnd date, inclusive.
pattern ^\d{4}-\d{2}-\d{2}$
levelenumoptionaldefault "account"Entity level to aggregate at.
One ofaccountcampaignadsetadmetricsstringoptionaldefault "spend,revenue,roas,cpa,conversions"Comma separated metric names.
granularityenumoptionaldefault "day"One ofhourdayweekmonthlimitintegeroptionaldefault 50min 1 · max 500
brand_idstringoptionalBrand to query. Required when the account has more than one brand.
When brand_id is required
/v1/brands to see which ids a key can address.Response
Returns 200 with the fields below. Every successful response also carries meta.request_id, which identifies the call in a support conversation, and meta.simulated, which is true when a test key was used.
brand_idstringrequiredlevelstringrequiredgranularitystringrequireddate_fromstringrequireddate_tostringrequireddataarray of objectrequiredtotalsobject or nullrequiredmetaobjectrequiredPresent on every successful response.
request_idstringrequiredsimulatedbooleanrequiredTrue when a cresva_sk_test_ key was used and the data is simulated.
{ "brand_id": "brd_8Kq2mR4xVn", "level": "campaign", "granularity": "day", "date_from": "2026-07-01", "date_to": "2026-07-31", "data": [ { "...": "provider shaped" } ], "totals": { "...": "provider shaped" }, "meta": { "request_id": "req_01JQ8Z3M6WT4", "simulated": false }}Shape generated from the response schema. The values are illustrative.
Errors
Failures use one envelope: { "error": { "code", "message" } }. The codes this endpoint can return:
400 invalid_request401 unauthorized403 forbidden429 rate_limited500 internal_error