# Security and privacy (/concepts/security)

## Protect credentials [#protect-credentials]

Keep Data API keys on a trusted server, worker, or CI secret store. Do not put long-lived keys in browser bundles, URLs, query parameters, analytics, logs, or error reports. The Console shows newly created secrets only once.

Headers and cookies inside a scrape request belong to the target site. They are not a second way to authenticate RunHarvester. Never forward a RunHarvester API key to the target site through request headers or cookies.

For credential rotation and scopes, see [Authentication](/getting-started/authentication).

## Browser requests and CORS [#browser-requests-and-cors]

The API playground sends requests directly from the browser to the public API; the documentation site does not proxy them. CORS controls whether browser code may read a response, but it does not protect an API key embedded in that browser code.

For a deliberate browser integration, allow only the origins you need and use the API's header-based authentication. Do not send `credentials: "include"` with a wildcard CORS policy. For production integrations, keep the key on your backend and let the browser call your own server.

## Retention and returned data [#retention-and-returned-data]

| Data | Retention |
| --- | ---: |
| HTML and text results | 7 days after completion |
| Markdown result | Derived from retained HTML; available during the same 7-day retention window |
| Trace and event records | 90 days |
| API-key usage and audit records | 90 days |
| Idempotency submissions | 24 hours |

Public request DTOs expose status and billing metadata. The submitted URL summary is reduced, but `result_meta.final_url` can include the final path, query string, and fragment. Its URL credentials are removed; query values are not automatically redacted. Treat that field and returned page content as potentially sensitive when logging or sharing results.

Public request DTOs do not return request headers or cookies, proxy endpoints or credentials, API-key secrets, provider keys, or CAPTCHA solutions.

Treat target content and credentials as sensitive before submitting them. Redact them from logs and support requests, and use the documented [result retention](/resources/limits) window when designing storage.

## Preview HTML safely [#preview-html-safely]

`result.html` and `result.markdown` are target-controlled content. Do not inject HTML or Markdown-produced HTML into your application's main origin. Use a Markdown renderer that sanitizes raw HTML and links; for an HTML visual preview, use a sandboxed iframe without `allow-same-origin` or `allow-scripts`.