{"openapi":"3.1.0","info":{"title":"AdsGenius API","version":"1.0.0","description":"Read synced ad accounts, results, findings and audits, and suggest changes for people to approve. Authenticate with an API key created in Settings → API keys, sent as `Authorization: Bearer agk_…`. Each key has scopes and a per-minute rate limit (headers X-RateLimit-Limit, -Remaining and -Reset; 429 with Retry-After when exceeded). A key can never approve or apply a change. Conversions are as each ad platform reports them. Money is in each account's own currency unless a converted total is asked for."},"servers":[{"url":"/"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"agk_<prefix>_<secret>","description":"Scopes: accounts:read, metrics:read, structure:read, findings:read, audits:read, reports:read, changes:read, changes:propose, fx:read."}},"responses":{"BadRequest":{"description":"Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, unknown, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The key lacks a scope this route needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"Too many requests this minute","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string"},"detail":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}}},"Page":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"next":{"type":["integer","null"]}}},"Account":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"businessId":{"type":"string","format":"uuid"},"network":{"type":"string"},"externalId":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"timezone":{"type":"string"},"status":{"type":"string"},"lastSyncedAt":{"type":["string","null"],"format":"date-time"}}},"Entity":{"type":"object","properties":{"accountId":{"type":"string"},"level":{"enum":["campaign","ad_group","ad"]},"id":{"type":"string"},"parentId":{"type":["string","null"]},"name":{"type":"string"},"status":{"type":"string"},"dailyBudget":{"type":["number","null"]}}},"MetricRow":{"type":"object","description":"One day of one campaign, ad or keyword. Level-specific fields are present for their level.","properties":{"accountId":{"type":"string"},"day":{"type":"string","format":"date"},"currency":{"type":"string"},"spend":{"type":"number"},"impressions":{"type":"integer"},"clicks":{"type":"integer"},"conversions":{"type":"number"},"conversionValue":{"type":["number","null"]},"campaignId":{"type":"string"},"adGroupId":{"type":"string"},"adId":{"type":"string"},"keywordId":{"type":"string"},"matchType":{"type":"string"},"qualityScore":{"type":["integer","null"]}}},"Totals":{"type":"object","properties":{"spend":{"type":"number"},"impressions":{"type":"integer"},"clicks":{"type":"integer"},"conversions":{"type":"number"},"conversionValue":{"type":["number","null"]},"leads":{"type":["number","null"]}}},"Finding":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"kind":{"type":"string"},"severity":{"enum":["info","warning","critical"]},"title":{"type":"string"},"summary":{"type":"string"},"evidence":{"type":"object"},"status":{"type":"string"}}},"Audit":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"score":{"type":["integer","null"]},"grade":{"type":["string","null"]},"checks":{"type":"array","items":{"type":"object"}},"createdAt":{"type":"string","format":"date-time"}}},"ChangeRequest":{"type":"object","properties":{"id":{"type":"string"},"accountId":{"type":"string"},"operation":{"type":"string"},"level":{"type":"string"},"entityId":{"type":"string"},"status":{"type":"string"},"requestedAt":{"type":"string","format":"date-time"}}},"CustomMetric":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"formula":{"type":"string"},"format":{"type":"string"}}},"FxRate":{"type":"object","properties":{"day":{"type":"string","format":"date"},"base":{"type":"string"},"quote":{"type":"string"},"rate":{"type":"number"},"source":{"type":"string"}}}}},"paths":{"/v1/accounts":{"get":{"summary":"List connected ad accounts","security":[{"apiKey":["accounts:read"]}],"x-scopes":["accounts:read"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Account"}},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/campaigns":{"get":{"summary":"List campaigns, ad groups or ads as last synced","security":[{"apiKey":["structure:read"]}],"x-scopes":["structure:read"],"parameters":[{"name":"account","in":"query","schema":{"type":"string","format":"uuid"},"description":"Limit to one ad account."},{"name":"level","in":"query","schema":{"enum":["campaign","ad_group","ad"],"default":"campaign"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Entity"}},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/metrics":{"get":{"summary":"Daily results per campaign, ad or keyword","security":[{"apiKey":["metrics:read"]}],"x-scopes":["metrics:read"],"parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day, YYYY-MM-DD, in each account's timezone."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day, at most 366 days after from."},{"name":"account","in":"query","schema":{"type":"string","format":"uuid"},"description":"Limit to one ad account."},{"name":"level","in":"query","schema":{"enum":["campaign","ad","keyword"],"default":"campaign"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/MetricRow"}},"page":{"$ref":"#/components/schemas/Page"}}},{"type":"object","properties":{"level":{"type":"string"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/metrics/summary":{"get":{"summary":"Totals per account with custom metrics, and a converted total","security":[{"apiKey":["metrics:read","reports:read"]}],"x-scopes":["metrics:read","reports:read"],"parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day, YYYY-MM-DD, in each account's timezone."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day, at most 366 days after from."},{"name":"currency","in":"query","schema":{"type":"string","pattern":"^[A-Z]{3}$"},"description":"Convert every account into this currency, day by day, with ECB reference rates."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"customMetrics":{"type":"array","items":{"$ref":"#/components/schemas/CustomMetric"}},"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"currency":{"type":"string"},"totals":{"$ref":"#/components/schemas/Totals"},"customMetrics":{"type":"object","additionalProperties":{"type":["number","null"]}}}}},"converted":{"type":["object","null"],"properties":{"currency":{"type":"string"},"complete":{"type":"boolean"},"totals":{"$ref":"#/components/schemas/Totals"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/custom-metrics":{"get":{"summary":"List the organization's custom metrics","security":[{"apiKey":["reports:read"]}],"x-scopes":["reports:read"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomMetric"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/findings":{"get":{"summary":"List findings","security":[{"apiKey":["findings:read"]}],"x-scopes":["findings:read"],"parameters":[{"name":"account","in":"query","schema":{"type":"string","format":"uuid"},"description":"Limit to one ad account."},{"name":"status","in":"query","schema":{"enum":["open","dismissed","resolved"],"default":"open"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Finding"}},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/audits":{"get":{"summary":"List account audits, newest first","security":[{"apiKey":["audits:read"]}],"x-scopes":["audits:read"],"parameters":[{"name":"account","in":"query","schema":{"type":"string","format":"uuid"},"description":"Limit to one ad account."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Audit"}},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/change-requests":{"get":{"summary":"List change requests","security":[{"apiKey":["changes:read"]}],"x-scopes":["changes:read"],"parameters":[{"name":"account","in":"query","schema":{"type":"string","format":"uuid"},"description":"Limit to one ad account."},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["data","page"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChangeRequest"}},"page":{"$ref":"#/components/schemas/Page"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/suggestions":{"post":{"summary":"Suggest a change for people to review","security":[{"apiKey":["changes:propose"]}],"x-scopes":["changes:propose"],"parameters":[],"responses":{"201":{"description":"Recorded as a suggestion. Nothing was changed.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"const":"suggested"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"description":"Unknown account or entity"},"429":{"$ref":"#/components/responses/RateLimited"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["accountId","level","entityId","operation"],"properties":{"accountId":{"type":"string","format":"uuid"},"level":{"enum":["campaign","ad_group","ad"]},"entityId":{"type":"string"},"operation":{"enum":["pause","resume","set_daily_budget"]},"dailyBudget":{"type":"number","exclusiveMinimum":0},"note":{"type":"string","maxLength":500}}}}}}}},"/v1/fx-rates":{"get":{"summary":"Daily reference exchange rates","security":[{"apiKey":["fx:read"]}],"x-scopes":["fx:read"],"parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"First day, YYYY-MM-DD, in each account's timezone."},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Last day, at most 366 days after from."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FxRate"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/v1/openapi.json":{"get":{"summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1"}}}}}}