ads_create_workflow_execution
Run an AMC SQL query over the store's AMC data (an ad-hoc execution).
readAmazon Adsads.amc-reporting
Answers at once with an execution id; poll ads_get_workflow_execution, then read the rows with ads_get_workflow_execution_download_urls. Check a new query with dry_run first: AMC validates it in seconds without running it. Amazon Ads API · createWorkflowExecution · POST /amc/reporting/{instanceId}/workflowExecutions Docs: https://advertising.amazon.com/API/docs/en-us/amc-reporting#tag/Workflow-executions/operation/createWorkflowExecution
Call it
In an AI client (MCP)
{
"name": "ads_create_workflow_execution",
"arguments": {
"store": "myStore-US",
"country_code": "<country_code>",
"sql_query": "<sql_query>"
}
}From code (Tool API)
curl -X POST https://api.sellersheetai.com/api/v1/tools/ads_create_workflow_execution \
-H "Authorization: Bearer $SELLERSHEET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"store":"myStore-US","country_code":"<country_code>","sql_query":"<sql_query>"}'Early access — the Tool API is open on request, contact us.
Arguments
| Name | Type | Description |
|---|---|---|
storerequired | string | the store ref `<store>-<CC>` (name-country, e.g. 'myStore-US') — one of get_user_context's store_refs, verbatim. |
country_coderequired | string | the Ads profile's 2-letter country code (e.g. 'US'). |
sql_queryrequired | string | AMC SQL; line breaks are joined into one line for Amazon. The final SELECT must aggregate (GROUP BY dimensions, SUM / COUNT(DISTINCT user_id)). |
time_window_type | string | which days of data the query reads; EXPLICIT needs time_window_start and time_window_end. Amazon's default is MOST_RECENT_DAY. Allowed: ALL | CURRENT_MONTH | EXPLICIT | MOST_RECENT_DAY | MOST_RECENT_WEEK | PREVIOUS_MONTH. Optional. The type of time window to use to for specifying input data for the workflow execution. If not provided, the time window type of MOST_RECENT_DAY will be used. The following table lists available types: EXPLICIT: The start and end of the time window must be explicitly provided in the request; MOST_RECENT_DAY: The time window will be the most recent 1-day window for which the instance is likely to have data, aligned to day boundaries; MOST_RECENT_WEEK: The time window will be the most recent 1-week window for which the instance is likely to have data, aligned to day boundaries; CURRENT_MONTH: The time window will be the start of the current month up to the most recent time for which the instance is likely to have data; PREVIOUS_MONTH: The time window will be the entire previous month; ALL: The time window will include all available dataALLCURRENT_MONTHEXPLICITMOST_RECENT_DAYMOST_RECENT_WEEKPREVIOUS_MONTH |
time_window_start | string | EXPLICIT only — 'YYYY-MM-DDTHH:MM:SS'. Optional. Only used with a timeWindowType of EXPLICIT. The start of the time window for input data for the workflow execution. This is a nominal time window and not a guarantee that timestamps on any rows will be inside this window. If provided, must also provide a timeWindowEnd. Required format is yyyy-MM-dd'T'HH:mm:ss. |
time_window_end | string | EXPLICIT only — 'YYYY-MM-DDTHH:MM:SS', exclusive. Optional. Only used with a timeWindowType of EXPLICIT. The end of the time window for input data for the workflow execution. This is a nominal time window and not a guarantee that timestamps on any rows will be inside this window. If provided, must also provide a timeWindowStart. Required format is yyyy-MM-dd'T'HH:mm:ss. |
time_window_time_zone | string | the window's IANA zone, e.g. 'Asia/Dubai' (the marketplace's own day); default UTC. |
parameter_values | object | values for parameters the SQL declares. |
dry_run | boolean | true to validate the SQL and the time window only — nothing is computed, no Amazon quota is used; the run then ends SUCCEEDED (valid, no rows) or REJECTED with Amazon's reason. Optional - if true, the execution will be processed but not submitted to compute, at which point the execution will be marked as complete. This can be used to quickly validate workflow executions (e.g., the sqlQuery) without consuming quotas or compute resources. The workflow execution will not generate output results. If false, the workflow execution will be submitted to compute, thereby running normally and generating output results. The default value, if no input is provided, is false. |
Result
Every tool answers {notification, data, human_action}; data carries:
data.workflow_execution_id— pass to ads_get_workflow_execution.data.status— PENDING at first.
Body (Amazon schema)
timeWindowType: ALL | CURRENT_MONTH | EXPLICIT | MOST_RECENT_DAY | MOST_RECENT_WEEK | PREVIOUS_MONTH
+ 15 more: additionalAcrResultsReceivers, advertisers, disableAggregationControls, dryRun,
maxCertifiedTime, maxDimensionTime, parameterValues, requireSyntheticData, skipPublish, timeWindowEnd,
timeWindowStart, timeWindowTimeZone, workflow, workflowExecutionTimeoutSeconds, workflowId
Full schema: the Docs link above.Gotchas
- Gate: none — a report request; it reads the advertiser's own AMC data.
- AMC runs at most 10 queries at a time per instance; wait for one to finish before starting more.
- For numbers that no longer change, query amazon_attributed_events_by_conversion_time: its window is complete once it ends. The by_traffic_time table (the SP console's view) keeps adding purchases for up to 30 days after the window.
- A SQL keyword as a column alias (`hour`, `date`) is REJECTED as unparsable.
- Outputting user_id or another VERY_HIGH column is REJECTED.
- spend is in microcents: divide by 100,000,000 for the currency.
- For Sponsored Products the detail_page_view / add_to_cart columns of the attributed-events tables are 0; join the clickers in sponsored_ads_traffic to `conversions` (event_subtype 'shoppingCart') on user_id instead.