# Making Requests

Source: https://docs.scrappey.com/docs/api-reference/requests

> Send a POST request to the Scrappey API with a URL, optional headers, cookies, and proxy, and the platform manages browser execution, rendering, session state, and response collection automatically.

## Parameters

| Parameter | Type | Required | Description |
| --------- | ------ | -------- | ----------- |
| `cmd` | string | Yes | The command to execute, e.g. [`request.get`](/docs/request-get), [`request.post`](/docs/request-post), or one of the [other request commands](/docs/request-others). |
| `url` | string | Yes | The target URL to request. |
| `headers` | object | No | Custom request headers to send. |
| `cookies` | array | No | Cookies to include with the request. |
| `proxy` | string | No | [Proxy](/docs/premium-proxy) to route the request through. |

## Request

Authenticate by including your API key in the query string. Send the command and target URL as a JSON body.

```javascript
const response = await fetch('https://publisher.scrappey.com/api/v1?key=YOUR_API_KEY', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    cmd: 'request.get',
    url: 'https://example.com'
  })
});

const data = await response.json();
console.log(data.solution.response);
```

## Response

A successful response returns `solution.verified: true` along with the page content, cookies, headers, and IP info.

```json
{
    "solution": {
        "verified": true,
        "currentUrl": "https://httpbin.rs/get",
        "statusCode": 200,
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0",
        "innerText": "{\"body_string\":\"\",\"headers\":{\"accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\"accept-encoding\":\"gzip, br\",\"accept-language\":\"en-US,en;q=0.5\",\"cache-control\":\"no-cache\",\"cdn-loop\":\"cloudflare; loops=1\",\"cf-connecting-ip\":\"161.0.248.139\",\"cf-ipcountry\":\"TT\",\"cf-ray\":\"947fb8313e8fd6db-IAD\",\"cf-visitor\":\"{\\\"scheme\\\":\\\"https\\\"}\",\"host\":\"httpbin.rs\",\"pragma\":\"no-cache\",\"priority\":\"u=0, i\",\"sec-fetch-dest\":\"document\",\"sec-fetch-mode\":\"navigate\",\"sec-fetch-site\":\"none\",\"sec-fetch-user\":\"?1\",\"upgrade-insecure-requests\":\"1\",\"user-agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0\",\"x-forwarded-for\":\"161.0.248.139, 172.71.194.68\",\"x-forwarded-host\":\"httpbin.rs\",\"x-forwarded-port\":\"80\",\"x-forwarded-proto\":\"https\",\"x-forwarded-server\":\"ab65c85a31ae\",\"x-is-trusted\":\"yes\",\"x-real-ip\":\"161.0.248.139\"},\"json\":null,\"method\":\"GET\",\"origin\":\"161.0.248.139\",\"query\":null,\"uri\":\"/get\"}",
        "cookies": [],
        "cookieString": "",
        "response": "<html><head><link rel=\"stylesheet\" href=\"resource://content-accessible/plaintext.css\"></head><body><pre>{\"body_string\":\"\",\"headers\":{\"accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\"accept-encoding\":\"gzip, br\",\"accept-language\":\"en-US,en;q=0.5\",\"cache-control\":\"no-cache\",\"cdn-loop\":\"cloudflare; loops=1\",\"cf-connecting-ip\":\"161.0.248.139\",\"cf-ipcountry\":\"TT\",\"cf-ray\":\"947fb8313e8fd6db-IAD\",\"cf-visitor\":\"{\\\"scheme\\\":\\\"https\\\"}\",\"host\":\"httpbin.rs\",\"pragma\":\"no-cache\",\"priority\":\"u=0, i\",\"sec-fetch-dest\":\"document\",\"sec-fetch-mode\":\"navigate\",\"sec-fetch-site\":\"none\",\"sec-fetch-user\":\"?1\",\"upgrade-insecure-requests\":\"1\",\"user-agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0\",\"x-forwarded-for\":\"161.0.248.139, 172.71.194.68\",\"x-forwarded-host\":\"httpbin.rs\",\"x-forwarded-port\":\"80\",\"x-forwarded-proto\":\"https\",\"x-forwarded-server\":\"ab65c85a31ae\",\"x-is-trusted\":\"yes\",\"x-real-ip\":\"161.0.248.139\"},\"json\":null,\"method\":\"GET\",\"origin\":\"161.0.248.139\",\"query\":null,\"uri\":\"/get\"}</pre></body></html>",
        "responseHeaders": {
            "date": "Fri, 30 May 2025 16:48:31 GMT",
            "content-type": "application/json; charset=utf-8",
            "cf-ray": "947fb8313e8fd6db-IAD",
            "server": "cloudflare",
            "content-encoding": "zstd",
            "cf-cache-status": "DYNAMIC",
            "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=vjiHLteAY5BudLpu8FBSR7H1zrEVyMaB3p05NXTLkkFdkMwe2nW7pH2mmR2H1YZX6SnueOYkFzZ%2F6vNoSp9vHy5WiHmX%2FnYJ2SJ%2B3I7eebUZYEefUHJTlkRsbjMD\"}], \"group\":\"cf-nel\", \"max_age\":604800}",
            "nel": "{\"success_fraction\":0, \"report_to\":\"cf-nel\", \"max_age\":604800}",
            "alt-svc": "h3=\":443\"; ma=86400",
            "server-timing": "cfCacheStatus;desc=\"DYNAMIC\", cfL4;desc=\"?proto=TCP&rtt=87643&min_rtt=82738&rtt_var=21002&sent=7&recv=9&lost=0&retrans=0&sent_bytes=3978&recv_bytes=2399&delivery_rate=52499&cwnd=238&unsent_bytes=0&cid=76cb71c0b81a2239&ts=388&x=0\"",
            "x-firefox-spdy": "h2"
        },
        "requestHeaders": {
            "host": "httpbin.rs",
            "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0",
            "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "accept-language": "en-US,en;q=0.5",
            "accept-encoding": "gzip, deflate, br, zstd",
            "upgrade-insecure-requests": "1",
            "sec-fetch-dest": "document",
            "sec-fetch-mode": "navigate",
            "sec-fetch-site": "none",
            "sec-fetch-user": "?1",
            "connection": "keep-alive",
            "priority": "u=0, i",
            "pragma": "no-cache",
            "cache-control": "no-cache"
        },
        "ipInfo": {
            "status": "success",
            "country": "Trinidad and Tobago",
            "countryCode": "TT",
            "region": "CHA",
            "regionName": "Chaguanas",
            "city": "Chaguanas",
            "zip": "",
            "lat": 10.5167,
            "lon": -61.4167,
            "timezone": "America/Port_of_Spain",
            "isp": "Columbus Communications Trinidad Limited.",
            "org": "Columbus Communications Trinidad Limited",
            "as": "AS27665 Columbus Communications Trinidad Limited.",
            "mobile": false,
            "proxy": false,
            "hosting": false,
            "query": "161.0.248.139"
        },
        "method": "GET",
        "type": "browser"
    },
    "timeElapsed": 10269,
    "data": "success",
    "session": "06c9de79-a61b-4eae-9121-11814440cc07"
}
```

## Error Response

An error returns a status code 200 with `solution.verified` set to `false`. This request is not charged. The response always includes `"data": "error"` and an `"error"` field explaining the failure reason.

```json
{
    "solution": {
        "verified": false
    },
    "timeElapsed": 4405,
    "data": "error",
    "error": "Verification provider rejected session. Review proxy configuration and authorization for the target site.",
    "info": "https://wiki.scrappey.com/getting-started#db336d2e7b3e42429966b01e2efb7d18",
    "session": "4f8904bb-aac3-40d1-939e-55a00d3acafd"
}
```
