# request_export

**Request export** · Changes data

Request one asynchronous `ranks_by_asin.1` or `project_keywords.1` export from this account's marketplace projects.

- Both accept format and project/marketplace/project-label/keyword-label filters; ranks also accepts ASIN-label filters and `primary_asin_only`.
- Filters combine with AND, values within a filter with OR.
- Omitted filters select every owned project in supported marketplaces at generation time.
- Resolve ambiguous project or marketplace selections with the user before requesting.
- Names and attachments are current at each generation attempt, not frozen at acceptance.
- Ranks requires 1 to 31 inclusive Los Angeles days ending no later than today in Los Angeles; future dates are refused.
- Today is provisional: its rows are a snapshot taken when the file is generated.
- Project keywords has no dates or ASIN options.
- Leave format unset (JSON) so the rows can be read inline with `get_export_records`; set format only when the user asks for a file in a particular format.
- When the rows are for analysis in the chat, narrow the selection with filters so the export stays within the 10,000 rows that tool reads; when the user wants the file, keep the selection they asked for.
- Returns an export ID and queued state, not a completed file.
- Poll `get_export` at least 5 seconds apart.
- A queued export can wait several minutes for its turn, so keep polling for at least 10 minutes before treating it as stuck, and do not switch to per-ASIN `get_project_asin_ranks` calls while it is queued or processing.
- When ready, read the rows with `get_export_records`, or give the user `get_export_download_link` for the file.
- Every call creates an independent export even with identical inputs.
- If a response is lost, inspect `list_exports` before requesting again; never blindly repeat.
- No removal confirmation is needed.

**Cost and limits**

- Costs 1 credit per 100 records generated, at least 1 credit.
- The estimated credits are held when the export is accepted, and the request is refused with `insufficient_credits` when the credit balance cannot cover them; on successful completion the credits for the actual rows are consumed and the hold released, and a failed export costs nothing.
- Estimates or output above 1,000,000 rows, or output costing more credits than are left, fail asynchronously.
- At most five outstanding exports per account; shared 60-per-minute limit.

## Input

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `export_type` | `"ranks_by_asin.1" \| "project_keywords.1"` | Required | Dataset and parameter contract. |
| `parameters` | `object` | Required | Type-specific parameters. For `project_keywords.1` an empty object selects all current keyword attachments. |

### `parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"json" \| "jsonl" \| "csv"` | Optional | Gzip file contents. Default json. |
| `start_date` | `string` | Optional | Required for ranks only: first Los Angeles day, YYYY-MM-DD. Maximum length 10. |
| `end_date` | `string` | Optional | Required for ranks only: last Los Angeles day, inclusive, YYYY-MM-DD; today at the latest. Maximum length 10. |
| `primary_asin_only` | `boolean` | Optional | Ranks only: default true; false includes every attached ASIN. |
| `project_ids` | `integer[]` | Optional | Marketplace project IDs from `list_projects` `marketplaces[].project_id`, never group IDs. Omit for all owned projects. At least 1 item. At most 1000 items. |
| `marketplaces` | `string[]` | Optional | Supported marketplace codes. Omit for every supported marketplace. Each item is one of `US`, `CA`, `MX`, `UK`, `DE`, `FR`, `IT`, `ES`, `AU`. At least 1 item. At most 1000 items. |
| `project_label_ids` | `integer[]` | Optional | Project label IDs from `list_project_labels`; projects matching any selected label. At least 1 item. At most 1000 items. |
| `asin_label_ids` | `integer[]` | Optional | Ranks only: item label IDs from `list_item_labels`; ASINs matching any selected label. At least 1 item. At most 1000 items. |
| `keyword_label_ids` | `integer[]` | Optional | Item label IDs from `list_item_labels`; keywords matching any selected label. At least 1 item. At most 1000 items. |

## Output

Read this object from the result's `structuredContent`. The result's `content` carries a text version for the model, which is not always the same JSON.

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.

`data` is one of 2 shapes.

### RanksByAsinExportRun

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Required |  |
| `state` | `string` | Required | `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`. One of `queued`, `processing`, `ready`, `failed`, `expired`. |
| `failure_code` | `string \| null` | Required | 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` | `string \| null` | Required | Plain-language explanation and next step for a `failed` export. Null in every other state. |
| `created_at` | `string (date-time)` | Required | When the export request was accepted. |
| `started_at` | `string \| null (date-time)` | Required |  |
| `completed_at` | `string \| null (date-time)` | Required |  |
| `result` | `object \| null` | Required | 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. |
| `export_type` | `"ranks_by_asin.1"` | Required |  |
| `parameters` | `RankingExportRunParameters` | Required | The parameters echoed on a stored export: the request parameters with `format` and `primary_asin_only` always present after defaults are applied. |

#### `data.result`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `row_count` | `integer` | Required | Minimum 0. |
| `compressed_bytes` | `integer` | Required | Minimum 0. |
| `expires_at` | `string (date-time)` | Required |  |

#### `data.parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"json" \| "jsonl" \| "csv"` | Required | 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` | `string (date)` | Required |  |
| `end_date` | `string (date)` | Required | 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` | `boolean` | Required | Default `true`. |
| `project_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |
| `marketplaces` | `string[]` | Optional | Each item is one of `US`, `CA`, `MX`, `UK`, `DE`, `FR`, `IT`, `ES`, `AU`. At least 1 item. At most 1000 items. |
| `project_label_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |
| `asin_label_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |
| `keyword_label_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |

### ProjectKeywordsExportRun

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Required |  |
| `state` | `string` | Required | `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`. One of `queued`, `processing`, `ready`, `failed`, `expired`. |
| `failure_code` | `string \| null` | Required | 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` | `string \| null` | Required | Plain-language explanation and next step for a `failed` export. Null in every other state. |
| `created_at` | `string (date-time)` | Required | When the export request was accepted. |
| `started_at` | `string \| null (date-time)` | Required |  |
| `completed_at` | `string \| null (date-time)` | Required |  |
| `result` | `object \| null` | Required | 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. |
| `export_type` | `"project_keywords.1"` | Required |  |
| `parameters` | `object` | Required | The parameters echoed on a stored export: the request parameters with `format` always present after the default is applied. |
| `metrics_window` | `MetricsWindow` | Required | The window the file's keyword metrics cover, fixed by the account's plan when the export was accepted. |

#### `data.result`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `row_count` | `integer` | Required | Minimum 0. |
| `compressed_bytes` | `integer` | Required | Minimum 0. |
| `expires_at` | `string (date-time)` | Required |  |

#### `data.parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `format` | `"json" \| "jsonl" \| "csv"` | Required | 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` | `integer[]` | Optional | At least 1 item. At most 1000 items. |
| `marketplaces` | `string[]` | Optional | Each item is one of `US`, `CA`, `MX`, `UK`, `DE`, `FR`, `IT`, `ES`, `AU`. At least 1 item. At most 1000 items. |
| `project_label_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |
| `keyword_label_ids` | `integer[]` | Optional | At least 1 item. At most 1000 items. |

<details>
<summary>Full input and output JSON Schema</summary>

```json
{
  "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."
      }
    }
  }
}
```

</details>
