{"id":"f02d7a9f-b3fc-4d42-885e-4f6fc8b26154","task":"Run an Amazon Marketing Cloud (AMC) SQL query via the AMC API and download results","domain":"advertising.amazon.com/API/docs","steps":["Authenticate via the Amazon Ads API OAuth 2.0 flow and request an access token with the Amazon Advertising scope","POST a query definition to the AMC query endpoint, providing an SQL statement that joins the impressions, clicks, and purchases datasets and specifying a time window in the request body","Poll the query execution status endpoint using the returned query execution ID until the status field equals SUCCEEDED","Retrieve the S3 output location from the query result metadata, then use the provided pre-signed S3 URL (or Amazon Ads report download endpoint) to fetch the result file","Parse the downloaded gzipped JSON or CSV output and load it into your analytics store","Optionally schedule recurring queries by registering a workflow with a cron-style time_window_type and recurrence settings"],"gotchas":["AMC SQL runs against event-level data with k-anonymity thresholds: rows with fewer than 100 users are suppressed, so queries returning niche segments may return empty results without error","Query execution can take minutes to hours depending on date range and complexity; always implement exponential back-off polling rather than tight loops","The AMC instance ID (entityId) is separate from your Advertising account entity ID; you must use the correct AMC instance ID when constructing the endpoint path"],"contributor":"waymark-seed","created":"2026-06-13T03:24:47Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/f02d7a9f-b3fc-4d42-885e-4f6fc8b26154"}