> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Zero data retention

> Send zeroDataRetention to keep nothing from a call: no stored copy read or made, nothing logged. Which endpoints take it, what it changes and what it costs.

Send `zeroDataRetention: true` and Stophy keeps nothing from that call: no stored copy of the page is read or made, and nothing from the call is logged. You set it on each call. There is nothing to switch on in your account.

## Make a request

This request reads `example.com` with zero data retention.

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "formats": ["markdown"],
    "zeroDataRetention": true
  }'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com",
    formats: ["markdown"],
    zeroDataRetention: true,
  }),
});
const { data, id } = await response.json();
console.log(data.metadata.cacheState, id);
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://example.com",
        "formats": ["markdown"],
        "zeroDataRetention": True,
    },
)
body = response.json()
print(body["data"]["metadata"]["cacheState"], body["id"])
```

## Read the response

> [accordion] Response
>
> This real response is cut to a few fields.
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "markdown": "This domain is for use in documentation examples without needing permission. …",
>     "metadata": {
>       "title": "Example Domain",
>       "sourceURL": "https://example.com/",
>       "statusCode": 200,
>       "cacheState": "miss",
>       "scrapeId": "f9a3f2e7-124d-4623-9bba-6408b5eebfa3",
>       "costUsd": 0.003
>     }
>   },
>   "id": "f9a3f2e7-124d-4623-9bba-6408b5eebfa3",
>   "costUsd": 0.003
> }
> ```

The answer is the same shape as any scrape. `cacheState` is `miss` because no stored copy was read. The call cost $0.003: $0.001 for the page and \$0.002 for zero data retention.

To check that nothing was kept, read the result again. A normal scrape can be read for 24 hours with `GET /v1/scrape/{id}`. A zero-data-retention scrape answers `404`.

```bash theme={null}
curl https://api.stophy.dev/v1/scrape/f9a3f2e7-124d-4623-9bba-6408b5eebfa3 \
  -H "Authorization: Bearer $STOPHY_API_KEY"
```

```json theme={null}
{
  "success": false,
  "error": "No scrape with that id. Results are kept for 24 hours.",
  "code": "notFound",
  "retryable": false
}
```

The call is still billed, so it still shows in [`GET /v1/logs`](https://docs.stophy.dev/production/usage-and-logs), with its endpoint, status and cost. This entry is cut to the fields it holds.

```json theme={null}
{
  "id": "8dea175f-e1e4-4bd9-9e0e-bacc2f64c130",
  "requestId": "f9a3f2e7-124d-4623-9bba-6408b5eebfa3",
  "endpoint": "scrape",
  "method": "POST",
  "status": 200,
  "costUsd": 0.003
}
```

## Where to send it

| Endpoint | Where | What it adds |
| - | - | - |
| [Scrape](https://docs.stophy.dev/scrape/overview) | `zeroDataRetention` in the body | \$2 per 1,000 pages. Not with a screenshot. |
| [Search](https://docs.stophy.dev/search/overview) | `scrapeOptions.zeroDataRetention` | \$2 per 1,000 pages read. Not with a screenshot. |
| [Extract](https://docs.stophy.dev/extract/overview) | `zeroDataRetention` in the body, or `scrapeOptions.zeroDataRetention` | \$2 per 1,000 pages read. Not with a screenshot. |
| [Crawl](https://docs.stophy.dev/crawl/overview) | `zeroDataRetention` in the body, or `scrapeOptions.zeroDataRetention` | \$2 per 1,000 pages. Not with a screenshot. |
| [Batches](https://docs.stophy.dev/batches/overview) | `zeroDataRetention` in the body | \$2 per 1,000 pages. Not with a screenshot. |
| [Parse](https://docs.stophy.dev/parse/overview) | `zeroDataRetention` in the body | \$2 per 1,000 calls |
| [Agent](https://docs.stophy.dev/agent/overview) | `zeroDataRetention` in the body | \$2 per 1,000 pages read. Not with `threadId`. |
| [Browser sessions](https://docs.stophy.dev/browser/overview) | `zeroDataRetention` in the body | See the endpoint's page |
| [Interact on a scrape](https://docs.stophy.dev/scrape/interact.md) | `zeroDataRetention` in the first call | Billed like a browser session |

[Monitors](https://docs.stophy.dev/monitors/overview) do not take it. A monitor keeps a snapshot of each page to compare with the next one, and a monitor with `zeroDataRetention` is refused.

## What changes

* **Stored copies.** No stored copy of the page is read or made, so every read is live.
* **Results.** A zero-data-retention scrape is not kept, so `GET /v1/scrape/{id}` answers `404` and the scrape cannot be interacted with. Start a session with `POST /v1/browser` and open the page there.
* **Jobs.** A crawl, a batch or an extract with zero data retention keeps its results for 1 hour after it finishes instead of 24 hours. After that they are gone, and so are their pages. A webhook delivery for such a job is recorded without its payload.
* **Agent.** The prompt, the steps and the result are held for one hour at most.
* **Logs.** Nothing from the call is logged except the bill: the endpoint, the time and the cost.
* **Browser sessions.** A session has no [replay](https://docs.stophy.dev/browser/recordings-and-replay.md). It cannot be recorded, and it cannot use a [profile](https://docs.stophy.dev/browser/profiles.md), because a profile keeps cookies.
* **Interact.** Send `zeroDataRetention` on the first call. If the scrape's session is already open without it, stop that session with `DELETE /v1/scrape/{id}/interact` and start again.

Your own app stays responsible for what it stores and logs from the answers.

## Limits and errors

| Case | Answer |
| - | - |
| `zeroDataRetention` with a screenshot format, a `screenshot` or `pdf` action, or `onlyCleanContent`, on scrape, search, extract, crawl or batches | `400 invalidRequest` |
| `zeroDataRetention` with `threadId` on agent | `400 invalidRequest` |
| `zeroDataRetention` with `profile` or `recording` on a browser session | `400 invalidRequest` |
| `zeroDataRetention` on a monitor | `400 invalidRequest` |
| Reading a zero-data-retention scrape by id | `404 notFound` |

## Related

* [Usage and logs](https://docs.stophy.dev/production/usage-and-logs.md)
* [Responsible use](https://docs.stophy.dev/production/responsible-use.md)
* [Pricing](https://docs.stophy.dev/account/pricing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.