# amazon-order-reports-api

> Scrapes orders and refunds from Amazon.com

Latest version **3.3.4** (published 2022-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install amazon-order-reports-api
pnpm add amazon-order-reports-api
yarn add amazon-order-reports-api
bun add amazon-order-reports-api
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.4 |
| Published | 2022-08-07 |
| First published | 2021-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 84 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Shaun Starsprung |
| Maintainers | starsprung |

## Links

- npm: https://www.npmjs.com/package/amazon-order-reports-api
- Repository: https://github.com/starsprung/amazon-order-reports-api
- Homepage: https://github.com/starsprung/amazon-order-reports-api#readme
- Issues: https://github.com/starsprung/amazon-order-reports-api/issues
- npm.io page: https://npm.io/package/amazon-order-reports-api

## Dependencies (11)

- [uuid](https://npm.io/package/uuid.md) ^3.4.0
- [delay](https://npm.io/package/delay.md) ^4.4.0
- [luxon](https://npm.io/package/luxon.md) ^1.25.0
- [otplib](https://npm.io/package/otplib.md) ^12.0.1
- [winston](https://npm.io/package/winston.md) ^3.3.3
- [camelcase](https://npm.io/package/camelcase.md) ^5.3.1
- [csv-parse](https://npm.io/package/csv-parse.md) ^4.14.2
- [puppeteer](https://npm.io/package/puppeteer.md) ^5.5.0
- [query-string](https://npm.io/package/query-string.md) ^6.13.7
- [puppeteer-extra](https://npm.io/package/puppeteer-extra.md) ^3.1.15
- [puppeteer-extra-plugin-stealth](https://npm.io/package/puppeteer-extra-plugin-stealth.md) ^2.6.5

## Recent versions

- 3.3.4 (latest) — 2022-08-07
- 3.3.3 — 2021-01-05
- 3.3.2 — 2021-01-05
- 3.3.1 — 2021-01-04
- 3.3.0 — 2021-01-04
- 3.2.1 — 2021-01-02
- 3.2.0 — 2021-01-02
- 3.1.0 — 2021-01-02
- 3.0.1 — 2021-01-01
- 3.0.0 — 2021-01-01
- 2.0.1 — 2021-01-01
- 2.0.0 — 2021-01-01
- 1.1.0 — 2021-01-01
- 1.0.0 — 2021-01-01

## README

# amazon-order-reports-api

Scrapes orders and refunds from Amazon.com.

There's no offical API to retrieve these, so this library uses [Puppeteer](https://github.com/puppeteer/puppeteer/) internally to access them. As this isn't an officially supported API, it may break at any time. Puppeteer comes with some other caveats, notably when running in Docker. See [Puppeteer's troubleshooting section](https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md) if you run into issues.

This library has only been tested on Amazon.com with the language set to English. It's unknown if it will work in other regions/languages.

## Installation

```
npm i amazon-order-reports-api
```

## Usage

```
import { AmazonOrderReportsApi } from 'amazon-order-reports-api';

(async () => {
  const api = new AmazonOrderReportsApi({
    username: 'test@example.com',
    password: 'password1234',
    // Or use otpFn
    otpSecret: 'USJF YSN7 87YR PP4D AN78 FAAF 81D8 1PU9 JJRF QP87 9UDM IO3W SJRY'
  });

  for await (const item of api.getItems({
    startDate: new Date('2020-10-01'),
    endDate: new Date('2020-12-31')
  })) {
    console.log(item);
  }

  for await (const refund of api.getRefunds({
    startDate: new Date('2020-10-01'),
    endDate: new Date('2020-12-31')
  })) {
    console.log(refund);
  }

  await api.stop();
})();
```

## API

API docs are available on the [docs site](https://docs.starsprung.com/amazon-order-reports-api/)

## Email notifications

As a side effect of generating an order report, Amazon will send an email notification that the order report is ready. This can generate a large volume of emails if reports are retrieved frequently. In many mail providers, an e-mail filter can be used to delete or move these emails. E.g. in Gmail:

```
from:(no-reply@amazon.com) subject:(Your order history report)
```

---
_Source: https://npm.io/package/amazon-order-reports-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
