Parameters as Headers

Along with the “traditional” means of passing parameters, we also support passing parameters as headers. Passing parameters such as api_key, render, ultra_premium and instruction_set is very straightforward.

  • API REQUEST

Instead of including the parameters in the URL

curl https://api.scraperapi.com/?api_key=<API_KEY>&render=true&url=https://www.example.com

you can just pass them as headers

curl https://api.scraperapi.com -H “x-sapi-url: https://www.example.com” -H “x-sapi-api_key: <API_KEY>” -h “x-sapi-render: true”

Please note that the 'x-sapi-' prefix is used on each header to avoid collisions with headers used by target sites. We support all standard parameters available with the API. The instruction_set parameter is specifically supported only through headers.

  • PROXY MODE

curl -k --proxy “http://scraperapi:<API_KEY>@proxy-server.scraperapi.com:8001” https://www.example.com -H “x-sapi-render: true”

Note that credentials must still be passed to the proxy in the manner shown above, not as headers.

Last updated