Skip to content

API Overview

GET/api/v1
sh
# cURL is most likely already installed on your machine
curl -G "https://api.bitfetcher.io/v1/" \
  -d api_key=YOUR_API_KEY \
  -d url=https://httpbin.io/anything
py
# pip install requests
import requests

url = 'https://httpbin.io/anything'
apikey = 'YOUR_API_KEY'
params = {
    'url': url,
    'api_key': apikey,
	'js_render': 'true',
}
response = requests.get('https://api.bitfetcher.io/v1/', params=params)
print(response.text)
js
// npm install axios
const axios = require('axios');

const url = 'https://httpbin.io/anything';
const apikey = 'YOUR_API_KEY';
axios({
    url: 'https://api.bitfetcher.io/v1/',
    method: 'GET',
    params: {
        'url': url,
        'api_key': apikey,
        'js_render': 'true',
    },
})
    .then(response => console.log(response.data))
    .catch(error => console.log(error));
go
package main

import (
	"io"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "https://api.bitfetcher.io/v1/?api_key=YOUR_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fanything&js_render=true", nil)
	resp, err := client.Do(req)
	if err != nil {
		log.Fatalln(err)
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatalln(err)
	}

	log.Println(string(body))
}

Parameters

Customize your scraping requests using the following parameters:

NameDescriptionTypeDefault
api_key requiredYour unique API key for authenticationstring
url requiredURL of the page you want to scrapestring
block_resourcesComma-separated list of resources to block from loading: image, stylesheet, font, media, manifest, other.string""
custom_cookiesEnable custom cookies to be passed to the request.booleanFalse
custom_headersEnable custom headers to be passed to the request.booleanFalse
deviceUse either desktop or mobile user agents in the headers. (Not yet available)string""
js_renderRender the JavaScript on the page with a headless browser.booleanFalse
js_scenarioThe JavaScript instructions to execute on the page.string""
json_responseReturn the response in JSON format.booleanFalse
premium_proxyUse premium proxies to make the request harder to detect.booleanFalse
proxy_countryGeolocation of the IP used to make the request. Only for Premium Proxies.string""
custom_proxyUse a custom proxy to make the request.string""
screenshotTake a screenshot of the page.booleanFalse
screenshot_formatThe format of the screenshot: choose between png and jpeg formats, with PNG being the defaultstringpng
screenshot_fullpageTake a full page screenshot. By default, only the visible portion of the page/viewport is captured.booleanFalse
screenshot_qualityThe quality of the screenshot (1-100). Only applies to jpeg format.integer100
screenshot_selectorTake a screenshot of a specific CSS selector.string""
session_idA unique identifier for the session. This is useful for tracking requests and debugging.string""
waitWait a fixed amount of time before returning the content (in milliseconds). (0-30000 milliseconds)integer0
wait_forWait for a given CSS/XPath Selector to load in the DOM before returning the content.string""
extract_rulesDefine rules to extract specific data from the page using CSS/XPath selectorsstring""

Models

Codes

CodeDescriptionTypeNote
200OKResponse / HtmlYou will get Response model if json_response=true
otherwise the HTML of scraped page
400Bad RequestErrorRequest was not processed, usually an error
on the parameters
500Internal Server ErrorError
html
<html>parsed content</html>
json
{
  "message": "<string>",
  "query": {
    "<parameter>": "<string>"
  }
}
json
{
  "message": "<string>"
}

Error

NameTypeDescription
messagestringThe error message (optional)
queryjsonThe query parameters that caused the error

Response

NameTypeDescription
bodystringThe content of the page
cookiesarray of CookieThe cookies set by the server
headersobjectThe headers of the response
js_scenario_debugarray of JSScenarioDebugOptional, debug information for each instruction
screenshotScreenshotOptional, base64 encoded image
status_codeintegerThe status code of the response
typestringhtml, json, xml, text, ...
extracted_dataobjectThe extracted data based on the extract_rules provided

Cookie represents an HTTP cookie, it's included in the response model.

NameTypeDescriptionRequired
domainstringoptionalNo
expiresstringoptionalNo
namestringNo
pathstringNo
urlstringNo
valuestringNo

JSScenarioDebug

NameTypeDescription
actionstringAction executed
durationintegerDuration of the action
errorstringError message if the action failed
paramsobjectParameters of the action
successbooleanIf the action was successful

Screenshot

Screenshot response model

NameTypeDescription
datastringBase64 encoded image
heightintegerHeight of the screenshot (in pixels)
typestringImage type (e.g. image/png)
widthintegerWidth of the screenshot (in pixels)