# S3 export

> For AI agents: the index of these docs is at https://scrapelyserp.com/docs/llms.txt (every page it lists has a Markdown version like this one).

Have every watchlist event written to your own Amazon S3 bucket, or to any S3-compatible store such as Cloudflare R2, Wasabi, MinIO or Backblaze B2.

## Set it up {#setup}

Each account has one export destination. Set it in **Dashboard → Settings → S3 export**, or with `PUT /v1/exports/s3`. You need an existing bucket and an access key that may write to it.

1. Create (or pick) a bucket. Objects are written under a key prefix, `scrapely/` by default.
2. Create an access key limited to `s3:PutObject` on that bucket and prefix (an example policy is below).
3. Enter the bucket, region and keys, then **Test connection**: we write `scrapely-connection-test.txt` under the prefix and report what the storage service answered.
4. Save. Exports switch on only after a passing test.

**Minimal IAM policy**

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::my-scrapes/scrapely/*"
    }
  ]
}
```

:::hint{style="info" title="Your keys stay secret"}
The secret access key is encrypted (AES-256-GCM) before it is stored and is never shown or returned again, in the dashboard or the API. Only the last four characters of the access key id are displayed. To change keys, send a new pair; editing anything else keeps the stored ones.
:::

## What is written, and where {#layout}

While the destination is on, every [watchlist](/docs/watchlists) event is written to the bucket as one JSON object, in the background as each run finishes: an upload never delays or fails the run. It happens whether or not you also receive the event by [webhook](/docs/webhooks).

| Object key | Body |
| --- | --- |
| `<prefix>watchlists/<watchlist_id>/<run_id>/<event>-<part>.json` | `{ "type", "created_at", "data" }`: `type` is the event (`watchlist.product.changed`, `.matched`, `.delisted` or `watchlist.run.completed`) and `data` is exactly the [webhook payload](/reference/webhook-events), split into the same parts. |
| `<prefix>scrapely-connection-test.txt` | Written by **Test connection** (and before each save). Safe to delete. |

Each object also carries `x-amz-meta-scrapely-watchlist-id`, `x-amz-meta-scrapely-run-id` and `x-amz-meta-scrapely-event`, so you can route it without opening it.

One run with 700 changes, for example, leaves:

- `scrapely/watchlists/wl_3c4d5e6f7a8b9c0d/wlrun_7a8b9c0d1e2f3a4b/watchlist.product.changed-1.json` (the first 500 changes)
- `scrapely/watchlists/wl_3c4d5e6f7a8b9c0d/wlrun_7a8b9c0d1e2f3a4b/watchlist.product.changed-2.json` (the other 200)
- `scrapely/watchlists/wl_3c4d5e6f7a8b9c0d/wlrun_7a8b9c0d1e2f3a4b/watchlist.run.completed-1.json`

## S3-compatible stores {#compatible}

Choose **Custom endpoint** (or send `endpoint`) to write to any service that speaks the S3 API. Requests are signed with AWS Signature Version 4 using the region you give.

| Service | endpoint | region | path_style |
| --- | --- | --- | --- |
| Amazon S3 | (leave empty) | `us-east-1`, `eu-west-2`, … | off (on automatically for bucket names with dots) |
| Cloudflare R2 | `https://<account_id>.r2.cloudflarestorage.com` | `auto` | on |
| Wasabi | `https://s3.<region>.wasabisys.com` | the bucket's region | on |
| Backblaze B2 | `https://s3.<region>.backblazeb2.com` | the bucket's region, e.g. `us-west-004` | on |
| MinIO | your server's public `https://` address | usually `us-east-1` | on |

:::hint{style="warning" title="Allowed endpoints"}
A custom endpoint must be `https://`, on port 443 or 1024–65535, and resolve to a public address: private, loopback, link-local and cloud metadata addresses are refused when you save it and again on every upload. Redirects are never followed.
:::

## Managing it from the API {#api}

| To | Use |
| --- | --- |
| See the destination and its recent uploads | `GET /v1/exports/s3` (the access key id masked, the secret never returned). `404` when there is none. |
| Create it, change it, pause it | `PUT /v1/exports/s3`. Fields you leave out keep their value. It tests the connection first unless `"test": false`; `"enabled": true` is refused (`400`) if the test fails, and nothing is saved. `{ "enabled": false, "test": false }` pauses exports and keeps everything. |
| Try a destination before saving it | `POST /v1/exports/s3/test`: with no body it tests the saved destination; with destination fields it tests those without saving. |
| Remove it | `DELETE /v1/exports/s3`: deletes the destination and its stored keys. Objects already written stay in your bucket. |

**Full reference →** [`PUT /v1/exports/s3`](/reference/s3-export#put-s3-export), [`GET /v1/exports/s3`](/reference/s3-export#get-s3-export), [`POST /v1/exports/s3/test`](/reference/s3-export#test-s3-export), [`DELETE /v1/exports/s3`](/reference/s3-export#delete-s3-export)

## Errors and retries {#errors-and-retries}

An upload that fails because the storage service is busy or unreachable (a timeout, a 5xx, `SlowDown`) is retried after 10 s, 1 min, 5 min, 30 min and 2 h. A refusal (`AccessDenied`, `NoSuchBucket`, a wrong key) is not retried: fix the destination and later events export again. Every attempt is listed under **Recent exports** in Settings and in `recent_exports` from the API (newest 100 kept).

| Code | Means |
| --- | --- |
| `AccessDenied` | The key may not write to this bucket or prefix: allow `s3:PutObject` on `arn:aws:s3:::<bucket>/<prefix>*`. |
| `NoSuchBucket` | The bucket does not exist under that name (or endpoint). |
| `InvalidAccessKeyId` | The access key id is unknown to the service. |
| `SignatureDoesNotMatch` | The secret access key does not belong to the access key id. |
| `PermanentRedirect` / `AuthorizationHeaderMalformed` | The bucket is in another region. The message names it when the service does. |
| `KMS…` | The bucket encrypts with a KMS key this access key may not use. |

---

## For AI agents

- This page for a human reader: https://scrapelyserp.com/docs/s3-export
- The whole space as one Markdown file: https://scrapelyserp.com/docs/llms-full.txt
- Live search + fetch over MCP: https://scrapelyserp.com/docs/_api/public/orgs/affc5b0f-d3c2-423a-8143-9d10db5736ae/spaces/981e6275-da3f-446c-82de-889f59c83b6f/mcp
  - Install (Claude CLI): `claude mcp add scrapely --transport http https://scrapelyserp.com/docs/_api/public/orgs/affc5b0f-d3c2-423a-8143-9d10db5736ae/spaces/981e6275-da3f-446c-82de-889f59c83b6f/mcp`

This Markdown is the same content the page renders — safe to quote and to ground answers in.
