# request_report

**Request report** · Changes data

Request one asynchronous report generated for any keyword or ASIN, whether or not a project tracks it.

- `keywords_for_keyword.1` (Keyword Spy data) returns the keyword and every keyword that contains it, as the app's default Keyword Spy search finds them.
- `keywords_for_asin.1` (ASIN Insights data) returns the keywords an ASIN and its variations get sales from, with the ASIN's KPS, relevancy and ranks for each.
- Every keyword has clicks, sales, conversion rate and top ASIN averaged over the range, and DSTR from the marketplace's latest four weeks whatever the range.
- Leave format and `include_periods` unset (a JSON report without periods) so the keywords can be read inline with `get_report_records`.
- Set format csv only when the user asks for a CSV file, and `include_periods` true only when they ask for week-by-week or month-by-month detail; both are delivered only as a file through `get_report_download_link`.
- For period detail on a few keywords, `get_keyword_data` is cheaper.
- `start_date` must start a period: the first day of a month, or the Sunday that starts a week.
- The range covers at most 12 weeks or months; a range outside the plan's research data is refused with `unavailable_dates`, which gives `earliest_date` and `latest_date`.
- Returns a report ID and queued state, not the data.
- Poll `get_report` at least 5 seconds apart.
- Every call creates an independent, separately charged report even with identical inputs.
- If a response is lost, inspect `list_reports` before requesting again; never blindly repeat.

**Cost and limits**

- Costs 100 credits, plus 100 per week or month with `include_periods`.
- The credits are held when the report is accepted, and the request is refused with `insufficient_credits` when the credit balance cannot cover them; a report that finally fails costs nothing.
- Reading, polling, listing and download links cost nothing.
- At most five outstanding exports and reports per account; shared 60-per-minute limit.

## Input

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `report_type` | `"keywords_for_keyword.1" \| "keywords_for_asin.1"` | Required | `keywords_for_keyword.1` for a keyword's related keywords; `keywords_for_asin.1` for an ASIN's keywords. |
| `parameters` | `object` | Required | The report type's parameters. A parameter of the other type is refused. |

### `parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `keyword` | `string` | Optional | Required for `keywords_for_keyword.1` only: the keyword to research, 1 to 200 characters. Maximum length 1024. |
| `asin` | `string` | Optional | Required for `keywords_for_asin.1` only: a 10-character ASIN. Its variations are always included. Maximum length 32. |
| `marketplace` | `string` | Required | Marketplace code, any letter case: US, CA, MX, UK, DE, FR, IT, ES, AU. Maximum length 32. |
| `interval` | `string` | Optional | weekly or monthly: whether clicks and sales are weekly or monthly averages. Default monthly. Maximum length 32. |
| `start_date` | `string` | Required | First week or month, YYYY-MM-DD: the first day of a month, or the Sunday that starts a week. Maximum length 10. |
| `end_date` | `string` | Required | Last day the report covers, YYYY-MM-DD, on or after `start_date`. Maximum length 10. |
| `include_periods` | `boolean` | Optional | Default false. true adds each keyword's week-by-week or month-by-month detail to the file only, at extra cost; only when the user asks for it. |
| `format` | `string` | Optional | json, jsonl or csv: the gzip file's contents. Default json. csv only when the user asks for a CSV file; it cannot be read inline. Maximum length 32. |

## 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 report and its result. `report_type` says which type it is and which `parameters` it has. `failure_code` is machine-readable and `failure_message` says what to do next; see Get a report for every code.

`data` is one of 2 shapes.

### KeywordsForKeywordReport

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Required |  |
| `report_type` | `"keywords_for_keyword.1"` | Required |  |
| `parameters` | `object` | Required | The request's parameters as accepted: normalised, with the defaults of `interval`, `include_periods` and `format` filled in. |
| `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. See Get a report for recovery. |
| `failure_message` | `string \| null` | Required | Plain-language explanation and next step for a `failed` report. Null in every other state. |
| `created_at` | `string (date-time)` | Required | When the 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. Ready and expired reports keep this metadata; a report with no matching keywords has `row_count` 0. Download links come only from the download endpoint. |

#### `data.parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `keyword` | `string` | Required | The keyword to research. The report covers it and every keyword that contains it, as the app's default Keyword Spy search finds them. For data on an exact list of keywords use `GET /v0/keywords`. Surrounding and repeated spaces are removed and it is stored in lower case. Minimum length 1. Maximum length 200. |
| `marketplace` | `string` | Required | The marketplace to research. Case-insensitive; stored in upper case. One of `US`, `CA`, `MX`, `UK`, `DE`, `FR`, `IT`, `ES`, `AU`. |
| `interval` | `"weekly" \| "monthly"` | Required | Whether `clicks` and `sales` are weekly or monthly averages. `weekly` returns `403 weekly_interval_not_allowed` on plans without weekly data. Default `"monthly"`. |
| `start_date` | `string (date)` | Required | First week or month of the range, `YYYY-MM-DD`: the first day of a month, or the Sunday that starts a week. Any other day returns `400 invalid_date` with `error.suggested_start_date`. |
| `end_date` | `string (date)` | Required | Last week or month of the range, `YYYY-MM-DD`, on or after `start_date`. The range covers at most 12 weeks or months and must lie within the research data available on your plan. |
| `include_periods` | `boolean` | Optional | Whether each record has a `periods` array with the keyword's week-by-week or month-by-month detail. Default `false`. |
| `format` | `"json" \| "jsonl" \| "csv"` | Optional | The file format. Default `"json"`. |

#### `data.result`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `row_count` | `integer` | Required | Keywords in the file, whatever its format. A CSV header is not counted, and a CSV with periods can have more rows than keywords. Minimum 0. |
| `compressed_bytes` | `integer` | Required | Minimum 0. |
| `expires_at` | `string (date-time)` | Required |  |

### KeywordsForAsinReport

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string (uuid)` | Required |  |
| `report_type` | `"keywords_for_asin.1"` | Required |  |
| `parameters` | `object` | Required | The request's parameters as accepted: normalised, with the defaults of `interval`, `include_periods` and `format` filled in. |
| `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. See Get a report for recovery. |
| `failure_message` | `string \| null` | Required | Plain-language explanation and next step for a `failed` report. Null in every other state. |
| `created_at` | `string (date-time)` | Required | When the 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. Ready and expired reports keep this metadata; a report with no matching keywords has `row_count` 0. Download links come only from the download endpoint. |

#### `data.parameters`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `asin` | `string` | Required | The ASIN to research: 10 letters and digits. Surrounding spaces are removed and it is stored in upper case. The report always includes the ASIN's variations. Pattern `^[A-Za-z0-9]{10}$`. |
| `marketplace` | `string` | Required | The marketplace to research. Case-insensitive; stored in upper case. One of `US`, `CA`, `MX`, `UK`, `DE`, `FR`, `IT`, `ES`, `AU`. |
| `interval` | `"weekly" \| "monthly"` | Required | Whether `clicks` and `sales` are weekly or monthly averages. `weekly` returns `403 weekly_interval_not_allowed` on plans without weekly data. Default `"monthly"`. |
| `start_date` | `string (date)` | Required | First week or month of the range, `YYYY-MM-DD`: the first day of a month, or the Sunday that starts a week. Any other day returns `400 invalid_date` with `error.suggested_start_date`. |
| `end_date` | `string (date)` | Required | Last week or month of the range, `YYYY-MM-DD`, on or after `start_date`. The range covers at most 12 weeks or months and must lie within the research data available on your plan. |
| `include_periods` | `boolean` | Optional | Whether each record has a `periods` array with the keyword's week-by-week or month-by-month detail. Default `false`. |
| `format` | `"json" \| "jsonl" \| "csv"` | Optional | The file format. Default `"json"`. |

#### `data.result`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `row_count` | `integer` | Required | Keywords in the file, whatever its format. A CSV header is not counted, and a CSV with periods can have more rows than keywords. Minimum 0. |
| `compressed_bytes` | `integer` | Required | Minimum 0. |
| `expires_at` | `string (date-time)` | Required |  |

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

```json
{
  "inputSchema": {
    "type": "object",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
      "report_type": {
        "type": "string",
        "enum": [
          "keywords_for_keyword.1",
          "keywords_for_asin.1"
        ],
        "description": "keywords_for_keyword.1 for a keyword's related keywords; keywords_for_asin.1 for an ASIN's keywords."
      },
      "parameters": {
        "type": "object",
        "properties": {
          "keyword": {
            "description": "Required for keywords_for_keyword.1 only: the keyword to research, 1 to 200 characters.",
            "type": "string",
            "maxLength": 1024
          },
          "asin": {
            "description": "Required for keywords_for_asin.1 only: a 10-character ASIN. Its variations are always included.",
            "type": "string",
            "maxLength": 32
          },
          "marketplace": {
            "type": "string",
            "maxLength": 32,
            "description": "Marketplace code, any letter case: US, CA, MX, UK, DE, FR, IT, ES, AU."
          },
          "interval": {
            "description": "weekly or monthly: whether clicks and sales are weekly or monthly averages. Default monthly.",
            "type": "string",
            "maxLength": 32
          },
          "start_date": {
            "type": "string",
            "maxLength": 10,
            "description": "First week or month, YYYY-MM-DD: the first day of a month, or the Sunday that starts a week."
          },
          "end_date": {
            "type": "string",
            "maxLength": 10,
            "description": "Last day the report covers, YYYY-MM-DD, on or after start_date."
          },
          "include_periods": {
            "description": "Default false. true adds each keyword's week-by-week or month-by-month detail to the file only, at extra cost; only when the user asks for it.",
            "type": "boolean"
          },
          "format": {
            "description": "json, jsonl or csv: the gzip file's contents. Default json. csv only when the user asks for a CSV file; it cannot be read inline.",
            "type": "string",
            "maxLength": 32
          }
        },
        "required": [
          "marketplace",
          "start_date",
          "end_date"
        ],
        "additionalProperties": false,
        "description": "The report type's parameters. A parameter of the other type is refused."
      }
    },
    "required": [
      "report_type",
      "parameters"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "data"
    ],
    "properties": {
      "data": {
        "$ref": "#/$defs/Report"
      }
    },
    "$defs": {
      "Report": {
        "type": "object",
        "description": "One accepted report and its result. `report_type` says which type it is and which `parameters` it has. `failure_code` is machine-readable and `failure_message` says what to do next; see Get a report for every code.",
        "required": [
          "report_type"
        ],
        "oneOf": [
          {
            "$ref": "#/$defs/KeywordsForKeywordReport"
          },
          {
            "$ref": "#/$defs/KeywordsForAsinReport"
          }
        ]
      },
      "KeywordsForKeywordReport": {
        "title": "Keywords for a keyword",
        "type": "object",
        "description": "One accepted keywords_for_keyword.1 report and its result. The fields and states are those of an export, with `report_type` in place of `export_type`.",
        "required": [
          "id",
          "report_type",
          "parameters",
          "state",
          "failure_code",
          "failure_message",
          "created_at",
          "started_at",
          "completed_at",
          "result"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "report_type": {
            "type": "string",
            "enum": [
              "keywords_for_keyword.1"
            ]
          },
          "parameters": {
            "$ref": "#/$defs/KeywordsForKeywordReportRunParameters"
          },
          "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. See Get a report for recovery."
          },
          "failure_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain-language explanation and next step for a `failed` report. Null in every other state."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the 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. Ready and expired reports keep this metadata; a report with no matching keywords has `row_count` 0. Download links come only from the download endpoint.",
            "required": [
              "row_count",
              "compressed_bytes",
              "expires_at"
            ],
            "properties": {
              "row_count": {
                "type": "integer",
                "minimum": 0,
                "description": "Keywords in the file, whatever its format. A CSV header is not counted, and a CSV with periods can have more rows than keywords."
              },
              "compressed_bytes": {
                "type": "integer",
                "minimum": 0
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "KeywordsForKeywordReportRunParameters": {
        "title": "Keywords for a keyword parameters, as accepted",
        "type": "object",
        "required": [
          "keyword",
          "marketplace",
          "interval",
          "start_date",
          "end_date"
        ],
        "properties": {
          "keyword": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "The keyword to research. The report covers it and every keyword that contains it, as the app's default Keyword Spy search finds them. For data on an exact list of keywords use `GET /v0/keywords`. Surrounding and repeated spaces are removed and it is stored in lower case."
          },
          "marketplace": {
            "type": "string",
            "enum": [
              "US",
              "CA",
              "MX",
              "UK",
              "DE",
              "FR",
              "IT",
              "ES",
              "AU"
            ],
            "description": "The marketplace to research. Case-insensitive; stored in upper case."
          },
          "interval": {
            "type": "string",
            "enum": [
              "weekly",
              "monthly"
            ],
            "default": "monthly",
            "description": "Whether `clicks` and `sales` are weekly or monthly averages. `weekly` returns `403 weekly_interval_not_allowed` on plans without weekly data."
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "First week or month of the range, `YYYY-MM-DD`: the first day of a month, or the Sunday that starts a week. Any other day returns `400 invalid_date` with `error.suggested_start_date`."
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "description": "Last week or month of the range, `YYYY-MM-DD`, on or after `start_date`. The range covers at most 12 weeks or months and must lie within the research data available on your plan."
          },
          "include_periods": {
            "type": "boolean",
            "default": false,
            "description": "Whether each record has a `periods` array with the keyword's week-by-week or month-by-month detail."
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "jsonl",
              "csv"
            ],
            "default": "json",
            "description": "The file format."
          }
        },
        "description": "The request's parameters as accepted: normalised, with the defaults of `interval`, `include_periods` and `format` filled in."
      },
      "KeywordsForAsinReport": {
        "title": "Keywords for an ASIN",
        "type": "object",
        "description": "One accepted keywords_for_asin.1 report and its result. The fields and states are those of an export, with `report_type` in place of `export_type`.",
        "required": [
          "id",
          "report_type",
          "parameters",
          "state",
          "failure_code",
          "failure_message",
          "created_at",
          "started_at",
          "completed_at",
          "result"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "report_type": {
            "type": "string",
            "enum": [
              "keywords_for_asin.1"
            ]
          },
          "parameters": {
            "$ref": "#/$defs/KeywordsForAsinReportRunParameters"
          },
          "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. See Get a report for recovery."
          },
          "failure_message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Plain-language explanation and next step for a `failed` report. Null in every other state."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the 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. Ready and expired reports keep this metadata; a report with no matching keywords has `row_count` 0. Download links come only from the download endpoint.",
            "required": [
              "row_count",
              "compressed_bytes",
              "expires_at"
            ],
            "properties": {
              "row_count": {
                "type": "integer",
                "minimum": 0,
                "description": "Keywords in the file, whatever its format. A CSV header is not counted, and a CSV with periods can have more rows than keywords."
              },
              "compressed_bytes": {
                "type": "integer",
                "minimum": 0
              },
              "expires_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "KeywordsForAsinReportRunParameters": {
        "title": "Keywords for an ASIN parameters, as accepted",
        "type": "object",
        "required": [
          "asin",
          "marketplace",
          "interval",
          "start_date",
          "end_date"
        ],
        "properties": {
          "asin": {
            "type": "string",
            "pattern": "^[A-Za-z0-9]{10}$",
            "description": "The ASIN to research: 10 letters and digits. Surrounding spaces are removed and it is stored in upper case. The report always includes the ASIN's variations."
          },
          "marketplace": {
            "type": "string",
            "enum": [
              "US",
              "CA",
              "MX",
              "UK",
              "DE",
              "FR",
              "IT",
              "ES",
              "AU"
            ],
            "description": "The marketplace to research. Case-insensitive; stored in upper case."
          },
          "interval": {
            "type": "string",
            "enum": [
              "weekly",
              "monthly"
            ],
            "default": "monthly",
            "description": "Whether `clicks` and `sales` are weekly or monthly averages. `weekly` returns `403 weekly_interval_not_allowed` on plans without weekly data."
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "First week or month of the range, `YYYY-MM-DD`: the first day of a month, or the Sunday that starts a week. Any other day returns `400 invalid_date` with `error.suggested_start_date`."
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "description": "Last week or month of the range, `YYYY-MM-DD`, on or after `start_date`. The range covers at most 12 weeks or months and must lie within the research data available on your plan."
          },
          "include_periods": {
            "type": "boolean",
            "default": false,
            "description": "Whether each record has a `periods` array with the keyword's week-by-week or month-by-month detail."
          },
          "format": {
            "type": "string",
            "enum": [
              "json",
              "jsonl",
              "csv"
            ],
            "default": "json",
            "description": "The file format."
          }
        },
        "description": "The request's parameters as accepted: normalised, with the defaults of `interval`, `include_periods` and `format` filled in."
      }
    }
  }
}
```

</details>
