ask
Ask a natural language question about your purchase data. The server translates it into SQL and returns the results — no SQL knowledge required. Parameters:
Example questions:
- “Show me the top 5 retailers by purchase count this year”
- “How many active connections do I have?”
- “What are my highest-value purchases from the last 30 days?”
- “Which brands appear most frequently in my items?”
- Questions must be plain English — embedded SQL will be rejected
- Only
SELECTqueries are generated — your data is never modified - Results are limited to 100 rows and 5 MB
- A 5-second execution timeout is enforced
ask uses an AI model to translate your question into SQL. For best results, be specific about the data you want, time ranges, and how results should be grouped or sorted. To inspect the data model itself (entities, fields, relationships), use get_data_model instead.get_retailers
List the retailers available to your account as structured rows. By default returns only the retailers enabled for your team (each with a Subtotal Link URL); passinclude="all" to list every active retailer in the catalog, annotated with whether it’s enabled for your team.
Requires the retailers:read OAuth scope. Connectors set up before this scope existed need to disconnect and reconnect to grant it; until then the tool returns error_category: "insufficient_scope".
Parameters:
Response format:
This is the same retailer contract returned by the public
GET /retailers API. With include="all", link_url is null for retailers not enabled for your team.update_retailer
Update a retailer for your account: enable or disable it, and set who sees it on the Subtotal Link retailer-selection page. Every argument exceptretailer_id is optional, and omitted ones are left unchanged, but a call must set at least one of enabled, link_visibility or link_audience. Requires the retailers:write OAuth scope; a connector without it gets error_category: "insufficient_scope".
- Visibility needs the retailer enabled: either already, or with
enabled: truein the same call. link_audiencereplaces the stored lists. Send both lists to keep entries you want.restrictedneeds an audience: at least one email or domain, counting lists already stored.- Disabling takes no visibility settings:
enabled: falsecan’t be combined withlink_visibilityorlink_audience.
Example — enable and restrict to one domain in a single call:
enabled: false, link_url, link_visibility and link_audience come back null.
Returns the same row shape as
get_retailers and the public PATCH /retailers/{retailer_id} API. Repeating a call returns the current row. These return an error field with error_category: "invalid_input": an unknown retailer_id, no fields to update, visibility settings for a retailer that isn’t enabled, visibility settings with enabled: false, or restricted with no audience. Invalid emails or domains, more than 100 entries in a list, or a link_visibility other than the three values are also rejected.get_data_model
Returns the data model for your purchase data, including entities, fields, types, and relationships. Parameters: None Returns: A plain-text data model describing six entities:connection, purchase, item, retailer, product, and brand.
If you’re using
ask, you typically don’t need to call get_data_model — the server already has the data model when answering questions.