# Scrape a page and return the mapped Scrapfly response

Operation ID: `connectors.scrapflyScrape`

Scrape a page and return the mapped Scrapfly response. GETs ``/scrape`` with anti-scraping protection (``asp``) and JS rendering enabled and returns the mapped ``ScrapflyScrapeResponse`` (including the rendered HTML under ``result.content``).

## Public method

`scrape`

Signature: `connectors.scrapfly.createClient(config).scrape(body)`

Return type: `Promise<ScrapflyScrapeResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`POST /connectors/scrapfly/scrape`

## Path parameters

None.

## Query parameters

None.

## Body parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `body` | [`ScrapflyScrapeRequest`](../models/ScrapflyScrapeRequest.md) | Yes |  |  |  | No |  |

Request model: [`ScrapflyScrapeRequest`](../models/ScrapflyScrapeRequest.md)

## Request example

```json
{
  "api_key": "example-api-key",
  "asp": true,
  "mode": "sandbox",
  "render_js": true,
  "rendering_wait": 10000,
  "url": "https://example.com/"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`ScrapflyScrapeResponse`](../models/ScrapflyScrapeResponse.md) | application/json | Successful response |

## Success response examples

### 200

```json
{
  "config": {
    "asp": true,
    "auto_scroll": false,
    "cache": false,
    "cache_clear": false,
    "cache_ttl": 86400,
    "compliance": {
      "client_ip": "+15555550123",
      "client_user_agent": "python-requests/2.34.2",
      "hipaa": false
    },
    "debug": false,
    "dns": false,
    "enable_backend_profile": false,
    "enable_cdp_trace": false,
    "env": "LIVE",
    "format": "raw",
    "headers": {},
    "log_eviction_date": "2026-08-24 18:14:56",
    "method": "GET",
    "origin": "example-origin",
    "prod_mode": false,
    "project": "default",
    "project_uuid": "example-project_uuid",
    "proxy_pool": "example-proxy_pool",
    "render_js": true,
    "rendering_stage": "complete",
    "rendering_wait": 10000,
    "request_id": "example-request_id",
    "retry": true,
    "session_sticky_proxy": true,
    "ssl": false,
    "timeout": 150000,
    "url": "https://example.com/",
    "user_uuid": "example-user_uuid",
    "uuid": "example-uuid"
  },
  "context": {
    "cache": {
      "state": "MISS"
    },
    "cookies": [],
    "cost": {
      "details": [
        {
          "amount": 1,
          "code": "example-code",
          "description": "Proxy Network (Datacenter)"
        }
      ],
      "total": 6
    },
    "created_at": "2026-08-17 18:14:56.790777",
    "env": "LIVE",
    "headers": {},
    "is_xml_http_request": false,
    "lang": "en",
    "optimizations": [],
    "os": {
      "name": "mac",
      "version": "26.4.1"
    },
    "project": "default",
    "proxy": {
      "country": "ph",
      "identity": "example-identity",
      "network": "datacenter",
      "pool": "example-pool"
    },
    "redirects": [],
    "retry": 0,
    "uri": {
      "base_url": "https://example.com",
      "host": "example.com",
      "port": 443,
      "root_domain": "example.com",
      "scheme": "https"
    },
    "url": "https://example.com/"
  },
  "result": {
    "content": "<!doctype html><html lang=\"en\"><head><title>Example Domain</title><link rel=\"icon\" href=\"data:,\"><meta name=\"viewport\" c",
    "content_type": "text/html",
    "duration": 18.76,
    "format": "text",
    "reason": "OK",
    "status_code": 200,
    "success": true,
    "url": "https://example.com/"
  },
  "uuid": "example-uuid"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | Connector validation rejected the payload, or a required field was missing or of the wrong type. |
| `401` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | The HealthCloud bearer token is missing or invalid, or the vendor rejected the supplied connector credentials. |
| `500` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | The connector failed unexpectedly. |
| `502` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | The vendor returned an application or transport-level failure. |
| `504` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | The vendor did not respond within the connector timeout. |

## Error examples

### 400 — Invalid request

```json
{
  "error": "Invalid request"
}
```

### 401 — Authorization required

```json
{
  "error": "Authorization required"
}
```

### 500 — Internal error

```json
{
  "error": "Internal error"
}
```

### 502 — Upstream vendor error

```json
{
  "error": "Upstream vendor error"
}
```

### 504 — Upstream timeout

```json
{
  "error": "Upstream timeout"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
import type { ScrapflyScrapeRequest } from "@healthcloudai/hc-sdk";
```

```ts
const body = {
  "api_key": "example-api-key",
  "asp": true,
  "mode": "sandbox",
  "render_js": true,
  "rendering_wait": 10000,
  "url": "https://example.com/"
};

const result = await connectors.scrapfly.createClient(config).scrape(body);
```

## cURL

```bash
curl -X POST \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{"api_key":"example-api-key","asp":true,"mode":"sandbox","render_js":true,"rendering_wait":10000,"url":"https://example.com/"}' \
  'https://dev-api-connectors.health.cloud/connectors/scrapfly/scrape'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
