{
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"export_type": {
"type": "string",
"enum": [
"ranks_by_asin.1",
"project_keywords.1"
],
"description": "Dataset and parameter contract."
},
"parameters": {
"type": "object",
"properties": {
"format": {
"description": "Gzip file contents. Default json.",
"type": "string",
"enum": [
"json",
"jsonl",
"csv"
]
},
"start_date": {
"description": "Required for ranks only: first Los Angeles day, YYYY-MM-DD.",
"type": "string",
"maxLength": 10
},
"end_date": {
"description": "Required for ranks only: last Los Angeles day, inclusive, YYYY-MM-DD; today at the latest.",
"type": "string",
"maxLength": 10
},
"primary_asin_only": {
"description": "Ranks only: default true; false includes every attached ASIN.",
"type": "boolean"
},
"project_ids": {
"description": "Marketplace project IDs from list_projects marketplaces[].project_id, never group IDs. Omit for all owned projects.",
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"marketplaces": {
"description": "Supported marketplace codes. Omit for every supported marketplace.",
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "string",
"enum": [
"US",
"CA",
"MX",
"UK",
"DE",
"FR",
"IT",
"ES",
"AU"
]
}
},
"project_label_ids": {
"description": "Project label IDs from list_project_labels; projects matching any selected label.",
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"asin_label_ids": {
"description": "Ranks only: item label IDs from list_item_labels; ASINs matching any selected label.",
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"keyword_label_ids": {
"description": "Item label IDs from list_item_labels; keywords matching any selected label.",
"minItems": 1,
"maxItems": 1000,
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
}
},
"additionalProperties": false,
"description": "Type-specific parameters. For project_keywords.1 an empty object selects all current keyword attachments."
}
},
"required": [
"export_type",
"parameters"
],
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"$ref": "#/$defs/ExportRun"
}
},
"$defs": {
"ExportRun": {
"type": "object",
"description": "One accepted export and its result. `failure_code` is machine-readable and `failure_message` says what to do next: `export_record_limit_exceeded` means the estimated or generated count exceeds 1,000,000 records; reduce the selection or dates. `insufficient_credits` means the complete file costs more credits than the balance covers, so submit a smaller request; `export_allowance_insufficient` is historical, from before credits, so submit a new export; `selected_label_deleted` and `project_access_changed` are retained historical failures, so submit a new export; `generation_failed` retries internally; `retry_exhausted` is terminal, so submit a new export; `invalid_export_context` means the saved request could not be processed, so submit a new export; Failed exports cost nothing. Finished details remain at least 90 days after activity and cycle end and longer while reconciliation needs them, then may return 404. Usage counters remain.",
"required": [
"export_type"
],
"oneOf": [
{
"$ref": "#/$defs/RanksByAsinExportRun"
},
{
"$ref": "#/$defs/ProjectKeywordsExportRun"
}
]
},
"RanksByAsinExportRun": {
"title": "Ranks by ASIN",
"allOf": [
{
"$ref": "#/$defs/ExportRunBase"
},
{
"type": "object",
"required": [
"export_type",
"parameters"
],
"properties": {
"export_type": {
"type": "string",
"enum": [
"ranks_by_asin.1"
]
},
"parameters": {
"$ref": "#/$defs/RankingExportRunParameters"
}
}
}
]
},
"ExportRunBase": {
"type": "object",
"required": [
"id",
"state",
"failure_code",
"failure_message",
"created_at",
"started_at",
"completed_at",
"result"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"state": {
"type": "string",
"enum": [
"queued",
"processing",
"ready",
"failed",
"expired"
],
"description": "`queued` and `processing` are unfinished; poll at least 5 seconds apart. `ready` has a file. `failed` and `expired` are terminal. Decide failure from `state`, not `failure_code`."
},
"failure_code": {
"type": [
"string",
"null"
],
"description": "Stable terminal failure code. export_record_limit_exceeded means the estimated or generated count exceeds 1,000,000 per export. insufficient_credits means the complete file costs more credits than its hold and the rest of the credit balance. export_allowance_insufficient is historical, from exports accepted before credits launched. See Get an export for recovery guidance."
},
"failure_message": {
"type": [
"string",
"null"
],
"description": "Plain-language explanation and next step for a `failed` export. Null in every other state."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "When the export request was accepted."
},
"started_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"completed_at": {
"type": [
"string",
"null"
],
"format": "date-time"
},
"result": {
"type": [
"object",
"null"
],
"description": "Null until successful completion, including failed exports. Ready and expired exports retain this metadata; a successful empty file has row_count 0. Download URLs are returned only by the download-link endpoint.",
"required": [
"row_count",
"compressed_bytes",
"expires_at"
],
"properties": {
"row_count": {
"type": "integer",
"minimum": 0
},
"compressed_bytes": {
"type": "integer",
"minimum": 0
},
"expires_at": {
"type": "string",
"format": "date-time"
}
}
}
}
},
"RankingExportRunParameters": {
"title": "ranks_by_asin.1 parameters (normalised)",
"description": "The parameters echoed on a stored export: the request parameters with `format` and `primary_asin_only` always present after defaults are applied.",
"allOf": [
{
"$ref": "#/$defs/RankingExportParameters"
},
{
"type": "object",
"required": [
"format",
"primary_asin_only"
]
}
]
},
"RankingExportParameters": {
"title": "ranks_by_asin.1 parameters",
"type": "object",
"required": [
"start_date",
"end_date"
],
"properties": {
"format": {
"type": "string",
"enum": [
"json",
"jsonl",
"csv"
],
"description": "CSV prefixes an apostrophe to text starting with an ASCII control character or DEL, or with =, +, - or @ after optional whitespace, so spreadsheets treat those cells as text. This includes project names and keywords. Numeric columns and JSON/JSONL values are unchanged.",
"default": "json"
},
"start_date": {
"type": "string",
"format": "date"
},
"end_date": {
"type": "string",
"format": "date",
"description": "Inclusive Los Angeles ranking day, no later than today in America/Los_Angeles. Today's records are a snapshot taken when the file is generated. Future dates return `400 future_dates_not_allowed`."
},
"primary_asin_only": {
"type": "boolean",
"default": true
},
"project_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"marketplaces": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "string",
"enum": [
"US",
"CA",
"MX",
"UK",
"DE",
"FR",
"IT",
"ES",
"AU"
]
}
},
"project_label_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"asin_label_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"keyword_label_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
}
},
"description": "Daily keyword ranks for the selected ASINs over an inclusive date range. Every option, including the output format and the filter parameters, is a direct property of this object. Before file generation, the background worker estimates selected ASINs × selected keywords × inclusive days per marketplace project and sums those products. Estimates above 1,000,000 fail asynchronously; equality passes. Acceptance holds credits for the estimate. Historical tracking periods do not reduce the estimate."
},
"ProjectKeywordsExportRun": {
"title": "Project keywords",
"allOf": [
{
"$ref": "#/$defs/ExportRunBase"
},
{
"type": "object",
"required": [
"export_type",
"parameters",
"metrics_window"
],
"properties": {
"export_type": {
"type": "string",
"enum": [
"project_keywords.1"
]
},
"parameters": {
"$ref": "#/$defs/ProjectKeywordsExportRunParameters"
},
"metrics_window": {
"$ref": "#/$defs/MetricsWindow",
"description": "The window the file's keyword metrics cover, fixed by the account's plan when the export was accepted."
}
}
}
]
},
"ProjectKeywordsExportRunParameters": {
"title": "project_keywords.1 parameters (normalised)",
"description": "The parameters echoed on a stored export: the request parameters with `format` always present after the default is applied.",
"allOf": [
{
"$ref": "#/$defs/ProjectKeywordsExportParameters"
},
{
"type": "object",
"required": [
"format"
]
}
]
},
"ProjectKeywordsExportParameters": {
"title": "project_keywords.1 parameters",
"type": "object",
"properties": {
"format": {
"type": "string",
"enum": [
"json",
"jsonl",
"csv"
],
"description": "CSV joins label names with \", \" and prefixes an apostrophe to text starting with an ASCII control character or DEL, or with =, +, - or @ after optional whitespace, so spreadsheets treat those cells as text. This includes project names, keywords and label names. Numeric columns and JSON/JSONL values are unchanged.",
"default": "json"
},
"project_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"marketplaces": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "string",
"enum": [
"US",
"CA",
"MX",
"UK",
"DE",
"FR",
"IT",
"ES",
"AU"
]
}
},
"project_label_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
},
"keyword_label_ids": {
"type": "array",
"minItems": 1,
"maxItems": 1000,
"items": {
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
}
},
"description": "The current keyword metrics of every selected keyword attachment, one record each. Every parameter is optional; an empty object exports every keyword attachment in your projects. There are no dates: `start_date`, `end_date`, `asin_label_ids`, `primary_asin_only` and any other key are rejected with `invalid_export_parameters`. After acceptance, each generation attempt first estimates one record per selected keyword attachment. Estimates above 1,000,000 fail asynchronously; equality passes. Acceptance holds credits for the estimate."
},
"MetricsWindow": {
"type": "string",
"enum": [
"four_weeks",
"latest_month"
],
"description": "The period the keyword metrics cover, set by the account's plan. `four_weeks`: the latest four loaded weeks, compared with the four weeks before them. `latest_month`: the latest loaded month, compared with the month before it, for plans without weekly data. Fields ending in `_l4w` hold values for this window whichever it is."
}
}
}
}