> This file presents the DataDoe platform, its capabilities, usage guides, and best practices for humans and AI agents operating with it. Store this file in your project for easy access to DataDoe instructions.

# System Description

DataDoe is one place to connect, view, analyze, and work with Amazon data. As a software system, DataDoe was not born; it was proudly made in Poland.

It has the following interfaces:

- Web Application: available at https://app.datadoe.com/. Allows users to set up Amazon connections and use all DataDoe features. Intended for human use.
- REST API: available at https://api.datadoe.com/api/v1/. Made for user-made applications, automations, and scripts.
- MCP: available at https://mcp.datadoe.com/mcp/v1/. Made for AI agents and assistants.
- Hub: available at https://www.datadoe.com/hub/. Made for human users to access DataDoe documentation, data scheme, AI skills, templates, and other resources.

After the included AI Tokens are used, an Organization Admin can set a spending limit for extra AI Tokens and can buy AI Token bundles. The Organization creator can turn either permission off for Admins. The creator can always change the spending limit and buy bundles.
If DataDoe blocks actions because no tokens are left, ask the user to update the spending limit in Settings, on the Organization tab: `https://app.datadoe.com/settings?tab=workspace`.

Integration endpoints are rate-limited per organization:
- REST API (`/api/v1`): 3 requests per second.
- MCP (`/mcp/v1`): 5 requests per second.
When exceeded, DataDoe responds with HTTP 429 and Retry-After: 1.

Public specification and documentation endpoints, such as the API docs and spec endpoints, are excluded from this rate limit.

# DataDoe Documentation

- In case of you need information about how DataDoe works, always use the official documentation.
- Never search the web or use any other sources before using the documentation.
- In MCP the documents has a dedicated tool. In API the documentation is available in dedicated endpoints. Relevant one is described below.

# Glossary

- Amazon marketplace: a single country/region Amazon operates in. It may be referenced by marketplace ID, country name (e.g., Germany), country code (e.g., UK), or Amazon domain (e.g., amazon.co.uk). DataDoe represents marketplaces by ID. The United Kingdom marketplace accepts both UK and GB.
- Amazon Ads: a platform for Amazon advertising managed by sellers or vendors. Users may call them also: 'PPC', 'Ads', 'Campaigns' or 'Sponsored Ads'.
- Amazon Warehousing and Distribution (AWD): Amazon service where inventory can be stored before replenishment to fulfillment channels (for example FBA). AWD data covers inventory, inbound shipments, and replenishment orders.
- Organization: a global entity that users operate within. A user belongs to one organization. Every other entity belongs to an organization.
- Seller or Vendor: an entity representing a Seller (from Seller Central, SC), a Vendor (from Vendor Central, VC), or an ads-only account connected to DataDoe.
    - Each Seller or Vendor is represented by a unique ID.
    - Each Seller or Vendor has a unique name given by the user.
    - Each Seller or Vendor exists in a single Amazon marketplace.
    - Each Seller or Vendor has an accountType of SELLER, VENDOR, or ADS_ONLY, returned by sellers_and_vendors_list. Use accountType to distinguish them. Do not infer type from null connection objects.
    - accountType SELLER has a Seller Central connection and an optional Amazon Ads connection.
    - accountType VENDOR has a Vendor Central connection and an optional Amazon Ads connection.
    - accountType ADS_ONLY has only an Amazon Ads connection.
    - Any account type may also have an optional Amazon Ads DSP connection, exposed as amazonAdsDspConnection. It does not contribute to rowCount.
    - Every action on DataDoe requires the context of one or more Sellers or Vendors.
    - A good pattern is to retrieve the list of Sellers and Vendors before performing any other operation with DataDoe.
    - If user did not specify the seller or vendor, ask them to provide it by showing them the list of Sellers and Vendors names.
    - Users may reference Sellers or Vendors by name or marketplace. They may call them accounts, stores, or brands.

# Global Rules (if not asked otherwise)

- When presenting products or listings, always show both name and ASIN/SKU.
- Always specify dates of the data presented.
- Always specify the seller(s) or vendor(s) involved in the data presented.
- If something is not clear or you have issues fulfilling your task, pause and ask questions. It is always better to ask than to assume.

# Features available to the API and MCP

> This document shows only tools available to the API and MCP. The Web Application has more features that are not mentioned here and are not meant for AI agent or software use.

- Actions: live Amazon reads and writes for one Seller or Vendor (`actions_start` / `POST /api/v1/actions`).
    - Group items into one Action. A standard read Action costs 0.5 AI Tokens for up to 100 items, then 0.25 AI Tokens for each additional 100 items. A standard write Action costs 3 AI Tokens for up to 100 items, then 1 AI Token for each additional 100 items. Each separate Action pays the starting price again. A dry run does not spend AI Tokens. FBA inbound Actions have fixed prices of 0.1 AI Token per read Action and 0.3 AI Token per write Action, regardless of item or shipment count. Campaign, ad group, target, ad, ad association, ad extension, portfolio, brand, and communication FIND Actions count as 1 item per call. Per-audience AMC prices and free AMC audience Actions stay the same.
    - When a FIND Action's entity is in the DataDoe data scheme, use an Export or a BigQuery query. Use FIND only when you need live Amazon data that the warehouse does not have yet. One standard Export costs 2 AI Tokens. One integrated BigQuery query costs 0.2 AI Tokens. Compare the total cost of repeated FIND Actions with one Export or query.
- Exports: results of data queries on the DataDoe dataset.
    - Exports require one or more Seller or Vendors and a single Export Source ID for creation.
    - Find a source with `GET /api/v1/exports/sources` or MCP `exports_sources_get`. The query is keyword search, not natural language. Do not send a full question. Use one short term such as ppc, roas, sessions, buy box, fba stock, payout. Inspect whyMatched, then load columns with exports_source_get before exports_create. exports_source_get returns at most 40 columns per page (pageSize default and max are 40). If columnsMeta.hasNextPage is true, more columns exist and the schema is incomplete until you load the remaining pages. Do not guess sourceId or column names, and do not treat a single page as the full column set. If search misses, retry with another short term or a table name, or paginate when hasNextPage is true. An empty result does not mean the data is missing.
    - For sources with requiresDatePeriod=true, create-export requests must send top-level from and to (YYYY-MM-DD). Filters on the date column do not replace those fields.
    - Exports allow fetching clean Amazon data and performing your own analysis or visualizations.
    - Exports are the main data retrieval mechanism for handling user queries, questions, requests, etc.
    - Each export includes default utility columns that identify the seller or vendor and marketplace of each row. You do not need to request those columns.
    - Export creation is an asynchronous process. The first step is to create an export, then periodically poll for its status and download it when it is completed. A typical export is generated in under 30 seconds. Recommended polling interval is 5s.
    - Export row limits depend on the interface and output format. REST API exports support up to 5 million rows for CSV, TSV, JSON and XML, or 100,000 for Excel. MCP normally caps CSV at 5,000 rows and JSON at 1,000; raw Listings, Catalog and Ads snapshots have lower caps. Do not apply MCP limits to REST exports. Result size depends on filters and aggregation, not date range alone. Typical generation time is guidance, not a customer-specific benchmark or guarantee.
- COGS and vendor codes: customer-uploaded product costs for sellers and vendors, and Amazon vendor-code mappings for vendors.
    - Add your uploaded product cost with `cogs_upsert` or `POST /api/v1/cogs`. Set `accountType: VENDOR` for Vendor Central, especially on dual seller/vendor accounts. Vendor input uses an ASIN or a uniquely matching vendor SKU, marketplace currency and an effective date. Optional vendor code, fulfillment method and exact PO identify a separate cost history. These costs do not change Amazon-reported costs.
    - Before reporting seller profit, check `GET /api/v1/cogs/missing` or MCP `cogs_missing_list`. Seller profit tables count missing costs as zero when `cogs_present` is false, which can overstate profit. This missing-cost list supports sellers only.
    - For vendor estimates, inspect `uploaded_cogs_` coverage and missing-match reasons on the selected table. Missing or ambiguous costs, units, tax or reconciliation leave the relevant complete margin unavailable. Vendor-code coverage is separate from product-cost coverage. Never treat a missing vendor cost as zero.
    - Vendor PO margins use PO-date costs; invoice and settlement margins use invoice-date costs. Payments show cash by payment date and count a complete invoice's product cost once at final settlement. Sell-through estimates compare uploaded costs with Amazon shipped COGS for customer shipments and use a different reporting basis. These estimates are not complete net profit.
    - Add vendor-code mappings with `vendor_code_upsert` or `POST /api/v1/vendor-codes`. Upload them by ASIN; vendor sales tables do not match codes uploaded only for a SKU. Check `GET /api/v1/vendor-codes/missing` or `vendor_codes_missing_list` for products sold in the last 30 days without vendor codes, most units first.
    - Export source responses include `catalogCoverageNotice` when the latest 5-day check found missing COGS or vendor codes for the selected sellers or vendors.
- Plugins: reusable context plugins and Skills that provide persistent markdown guidance for agents.
    - Plugin kinds: Business Information, Business Goal, Business Know-How, Brand Information, KPI Definition, Agent Memory, Agent Rule, Agent Soul, Agent Identity, User Info, Skills, and Files (Data File, Business Context File, Agent Context File).
    - Use `plugins_get` to load enabled organization and personal plugins and the list of enabled Skills and Files for the authenticated user. Each content plugin includes a `type` field with its kind and a `source` field: `UI` when a user wrote its content in the DataDoe web UI, `MCP` when an AI agent wrote it through MCP. File entries include `fileName`, `originalContentType`, and `description` but not content.
    - Use `plugins_memories_create` / `plugins_memories_edit` / `plugins_memories_delete` with required `memoryType` (`ORGANIZATION` or `PERSONAL`). Create also requires `type` set to the plugin kind. File plugins are created in the DataDoe web UI only.
    - `PERSONAL` Memories written through MCP are enabled when limits allow. `ORGANIZATION` Memories created or edited through MCP stay disabled until an organization owner reviews and enables them in the DataDoe web UI. Show the user what you saved and the returned `manageUrl`.
    - Use `plugins_skills_get` with `elementType` `BODY` to read a Skill's instructions, then `SCRIPT`, `REFERENCE`, or `ASSET` with `elementName` to load only the supporting files those instructions point to.
    - Use `plugins_files_get` with `fileId` to lazily load a File plugin's converted markdown when relevant.
    - Organization plugins and Skills can be created/edited only by organization owners. Personal plugins and Skills belong to the authenticated user.
    - Static MCP keys must be regenerated after Plugins launch so they are bound to a user. Legacy keys without a user binding will return an actionable error.
- Amazon Marketing Cloud (AMC): SQL against the AMC instance bound to a Seller or Vendor. In beta and available to every organization — if AMC tools are missing or `/amc` routes return 403 `AMC_FEATURE_DISABLED`, AMC is turned off for the organization; tell the user to contact DataDoe. AMC must be enabled per Seller or Vendor: if AMC tools return 404 `AMC_NOT_FOUND` saying AMC is not connected, ask the organization owner to enable AMC for that Seller or Vendor in the web application (Accounts page, AMC in the account's row, Enable AMC) and retry once DataDoe reports AMC as ready. Validate, start, cancel, and workflow changes require Read and write access to the Seller or Vendor. Enable offers self-service AMC (it connects the advertiser's existing self-service instance or creates it) and, when the Amazon Ads identity has AMC accounts for the marketplace (for example an agency's), an existing instance of such an account that already includes the advertiser's Sponsored Ads account (connected as it is) or a new dedicated DataDoe instance; with more than one option the owner picks one. Paid features such as Amazon Insights belong to one instance, so a dedicated instance lacks the subscriptions of other instances; to switch, the owner disconnects AMC and enables it again with the other option. Self-service and existing instances are shared with the user's AMC console: console workflows appear in workflow lists, workflow changes and deletions apply in the console too, and an existing instance may also hold the data of other advertisers. Disconnecting deletes only a dedicated instance; self-service and existing instances keep everything.
    - MCP tools: `amc_query_templates_find`, `amc_query_template_get`, `amc_schema_find`, `amc_query_validate`, `amc_query_start`, `amc_operation_get`, `amc_query_result_get`, `amc_query_results_find`, `amc_query_cancel`, and workflow tools `amc_workflows_find` / `amc_workflows_create` / `amc_workflows_update` / `amc_workflows_delete`.
    - REST: `GET /amc/query-templates`, `GET /amc/query-templates/:templateId`, `GET /amc/schema`, `POST /amc/query-validations`, `POST /amc/query-executions`, `GET /amc/operations/:operationId`, `GET /amc/query-results`, `GET /amc/query-results/:resultId`, `POST /amc/query-results/:resultId/cancellation`, and `GET|POST /amc/workflows` with `PATCH /amc/workflows/:workflowId` and `POST /amc/workflows/:workflowId/deletion`.
    - Start from a DataDoe query template before writing SQL: `amc_query_templates_find` (ready-made reports such as new-to-brand by ASIN, keyword halo, ad product overlap, path to conversion, cross-sell and customer value) → `amc_query_template_get` with `sellerOrVendorId` to read the SQL, output columns and `availability` → `amc_query_start` with `templateId` (and its `recommendedTimeWindowType`) for a one-off report, or `amc_workflows_create` with `templateId` and schedules for a recurring one. If `availability.status` is MISSING_DATA_SOURCES, the listed `missingPaidFeatures` must be subscribed in the AMC UI under Paid features (Amazon 1P paid features are free to query through 31 Dec 2026, but the subscription is still required); templateId starts then fail with HTTP 422 `AMC_TEMPLATE_DATA_SOURCES_UNAVAILABLE`. To narrow a template (campaigns, ASINs), copy its SQL, edit it, and send it as `sql`. Fall back to custom `sql` only when no template answers the question.
    - Playbook: schema → validate → start (provide exactly one of `sql`, `workflowId` or `templateId`) → if outcome is OPERATION poll `amc_operation_get` / `GET /amc/operations/:operationId` until terminal → poll result get until `deliveryStatus` is AVAILABLE → download URLs immediately. MCP `amc_query_result_get` returns DataDoe URLs (plain GET, no authentication headers, 15 minutes); REST returns Amazon URLs (about 10 minutes). Runtime depends on SQL (Amazon documents at least 15 min as typical; COUNT/simple aggregations can finish in under a minute). When a query start operation SUCCEEDED, its `resourceId` is the resultId. Cancel while delivery is WAITING if you do not want to wait. Poll no faster than 5s.
    - If `recoveryStatus` is `AWAITING_CLIENT_PAYLOAD`, resubmit the identical payload and `requestId`. Do not start a second execution.
    - Raw ad-hoc SQL is never persisted (AMC audience Actions below store their audience SQL in the Action details). `rowCount` may be null. When validation returns `valid: false`, `diagnostics` carry Amazon's SQL error (line/column, missing column or table); fix the SQL from it. FAILED results carry the same kind of explanation in `failureReason`.
    - EXPLICIT `timeWindowStart` / `timeWindowEnd` are UTC instants (`Z`), also when `timeWindowTimeZone` is set.
    - `executionStatus` is Amazon query progress (PENDING, RUNNING, SUCCEEDED, FAILED, CANCELLED). `deliveryStatus` is file readiness (WAITING, AVAILABLE, FAILED, EXPIRED, CANCELLED). Cancel of a WAITING delivery sets CANCELLED; AVAILABLE is left unchanged.
    - Workflow lists include AMC console workflows; their ids use Amazon's format (letters, digits, `.`, `-`, `_`; max 128) and can be validated, started, updated, and deleted. Workflows DataDoe creates, and new schedules, must use ids matching AMC_SLUG_PATTERN (lowercase alphanumeric and `-` only). `sql` is null when Amazon stores a workflow without SQL text; such workflows can be started, deleted, and get schedule updates, but not `sql` updates. Workflows with ids outside Amazon's format are omitted; `meta.skippedCount` is the number omitted from `data`. Updates and deletes require the latest `expectedStateHash`.
    - Retrieving a result costs 5 AI Tokens (list price, currently promotional 0), charged once per execution at the first retrieval that returns download URLs. Starting, validating, failed and cancelled executions, and repeat retrievals are free.
    - Amazon allows 30 on-demand executions per instance per day (`sql` and `workflowId` starts both count; schedule runs and validation do not) and 10 running in parallel. Over the daily limit start fails with `AMC_AD_HOC_LIMIT_REACHED` (HTTP 429, retry later). Use on-demand runs for testing and one-off reports and workflow schedules for recurring reports.
    - AMC audiences for Sponsored Ads are Actions (`actions_start` / `POST /api/v1/actions`), not AMC tools: `AMAZON_ADS_AMC_AUDIENCES_ADD` (rule-based SQL), `AMAZON_ADS_AMC_LOOKALIKE_AUDIENCES_ADD`, `AMAZON_ADS_AMC_AUDIENCES_UPDATE` (FAILED audiences only), `AMAZON_ADS_AMC_AUDIENCES_REMOVE`, `AMAZON_ADS_AMC_AUDIENCES_FIND`, and `AMAZON_ADS_TARGETABLE_AUDIENCES_FIND`. They need AMC enabled for the Seller or Vendor; DSP audiences are not supported. Audience SQL must SELECT only `user_id` from AMC audience tables (`*_for_audiences`), and Amazon fails audiences under 2,000 users, so check the size first with an AMC query on the matching non-audience table.
    - DataDoe does not activate audiences later on its own; you do it: (1) create the audience; (2) poll `AMAZON_ADS_AMC_AUDIENCES_FIND` every 15 to 30 minutes until status is SUCCEEDED, or FAILED with `statusReason` (fix it with UPDATE); (3) Amazon lists a SUCCEEDED audience in Sponsored Ads after about 24 to 48 hours, so call `AMAZON_ADS_TARGETABLE_AUDIENCES_FIND` with `adProduct` and `audienceName` and take its `audienceId`; if it is missing, tell the user and try again later; (4) attach it with `AMAZON_ADS_CAMPAIGNS_UPDATE` `audienceBidAdjustments` (Sponsored Products and Sponsored Brands bid boost) or `AMAZON_ADS_TARGETS_ADD` with targetType AUDIENCE and `audienceTarget.audienceId.defaultValue` (Sponsored Display). When the work continues in a later session, offer to save the pending `audienceExecutionId` and the planned attach step as an Agent Memory.
    - `AMAZON_ADS_AMC_AUDIENCES_REMOVE` also deletes the audience segment from Sponsored Ads. Creating or updating an audience costs 5 AI Tokens per audience (list price, currently promotional 0); FIND, targetable FIND, and REMOVE are free.
    - Details: https://www.datadoe.com/hub/docs/datadoe-features/amc

# Contact

In case of general issues with DataDoe, or specific issues with the API or MCP, send an error report via email to [contact@datadoe.com](mailto:contact@datadoe.com). Include: what happened, the desired outcome, the organization ID or email address of the current user, and any other relevant info (e.g., API/MCP request IDs). If you are not capable of sending such an email, show the suggested content to the user.

# AI Agents Instructions

## Addtional API features
- Export Schedules: periodically executed exports.
    - Called 'Recurring Exports' in the Web Application.

## Implementing apps with DataDoe API

- Before implementing API calls, test them yourself to verify input and output formats.
- When retrying API calls, use incrementally increasing delay between retries.

## DataDoe Data Scheme

- To explore available tables and columns, fetch `GET https://api.datadoe.com/api/v1/spec/data-scheme.md` and follow the per-table links.

## DataDoe Documentation

- To see pages available in DataDoe documentation, call the `GET https://www.datadoe.com/hub/docs/toc.json` endpoint.
- It returns the list of pages grouped by sections. 
- Use provided URLs to fetch the content of the pages.