---
openapi: 3.1.0
info:
  title: API Reference
  version: 3.2.0
  description:
    "$ref": "./description.md"
tags:
- name: AI
  description: Analyze web pages using LLMs
- name: HTML
  description: Get full HTML content of pages using proxies and Chromium JS rendering
- name: Text
  description: Get visible text of pages using proxies and Chromium JS rendering
- name: Selected HTML
  description: Get HTML content of selected page areas (like price, search results,
    page title, etc.)
- name: Account
  description: Information about your account API credits quota
paths:
  "/ai/question":
    get:
      summary: Get an answer to a question about a given web page
      description: Returns the answer in plain text. Proxies and Chromium JavaScript
        rendering are used for page retrieval and processing, then the answer is extracted
        using an LLM model.
      operationId: getQuestion
      tags:
      - AI
      parameters:
      - "$ref": "#/components/parameters/url"
      - "$ref": "#/components/parameters/question"
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      - "$ref": "#/components/parameters/format"
      responses:
        '200':
          description: Success
          content:
            text/html:
              schema:
                type: string
              example: Some answer
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/ai/question',
            qs: {
              url: 'SOME_STRING_VALUE',
              question: 'SOME_STRING_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE',
              format: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/ai/question?url=SOME_STRING_VALUE&question=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/ai/fields":
    get:
      summary: Extract structured data fields from a web page
      description: Returns structured data fields extracted from the webpage using
        an LLM model. Proxies and Chromium JavaScript rendering are used for page
        retrieval and processing.
      operationId: getFields
      tags:
      - AI
      parameters:
      - "$ref": "#/components/parameters/url"
      - in: query
        name: fields
        description: Object describing fields to extract from the page and their descriptions
        required: true
        example:
          title: Main product title
          price: Current product price
          description: Full product description
        schema:
          type: object
          additionalProperties:
            type: string
        style: deepObject
        explode: true
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
              example:
                title: Example Product
                price: "$99.99"
                description: This is a sample product description
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/ai/fields',
            qs: {
              url: 'SOME_STRING_VALUE',
              fields: 'SOME_OBJECT_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/ai/fields?url=SOME_STRING_VALUE&fields=SOME_OBJECT_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/html":
    get:
      summary: Page HTML by URL
      description: Returns the full HTML content of a webpage specified by the URL.
        The response is in plain text. Proxies and Chromium JavaScript rendering are
        used for page retrieval and processing.
      operationId: getHTML
      tags:
      - HTML
      parameters:
      - "$ref": "#/components/parameters/url"
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      - "$ref": "#/components/parameters/return_script_result"
      - "$ref": "#/components/parameters/format"
      responses:
        '200':
          description: Success
          content:
            text/html:
              schema:
                type: string
              example: |-
                <html><head>
                    <title>Example Domain</title>
                </head>

                <body>
                <div>
                    <h1>Example Domain</h1>
                </body></html>
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/html',
            qs: {
              url: 'SOME_STRING_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE',
              return_script_result: 'SOME_BOOLEAN_VALUE',
              format: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/html?url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&return_script_result=SOME_BOOLEAN_VALUE&format=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/text":
    get:
      summary: Page text by URL
      description: Returns the visible text content of a webpage specified by the
        URL. Can be used to feed data to LLM models. The response can be in plain
        text, JSON, or XML format based on the text_format parameter. Proxies and
        Chromium JavaScript rendering are used for page retrieval and processing.
        Returns JSON on error.
      operationId: getText
      tags:
      - Text
      parameters:
      - "$ref": "#/components/parameters/text_format"
      - "$ref": "#/components/parameters/return_links"
      - "$ref": "#/components/parameters/url"
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      responses:
        '200':
          description: Success
          content:
            text/html:
              schema:
                type: string
              example: Some content
            text/xml:
              schema:
                type: string
              example: |-
                <title>Some title</title>
                <description>Some description</description>
                <content>Some content</content>
            application/json:
              schema:
                type: string
              example: '{"title":"Some title","description":"Some description","content":"Some
                content"}'
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/text',
            qs: {
              text_format: 'SOME_STRING_VALUE',
              return_links: 'SOME_BOOLEAN_VALUE',
              url: 'SOME_STRING_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/text?text_format=SOME_STRING_VALUE&return_links=SOME_BOOLEAN_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/selected":
    get:
      summary: HTML of a selected page area by URL and CSS selector
      description: Returns HTML of a selected page area by URL and CSS selector. Useful
        if you don't want to do the HTML parsing on your side.
      operationId: getSelected
      tags:
      - Selected HTML
      parameters:
      - in: query
        name: selector
        description: CSS selector (null by default, returns whole page HTML)
        example: h1
        schema:
          type: string
      - "$ref": "#/components/parameters/url"
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      - "$ref": "#/components/parameters/format"
      responses:
        '200':
          description: Success
          content:
            text/html:
              schema:
                type: string
              example: <a href="https://www.iana.org/domains/example">More information...</a>
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/selected',
            qs: {
              selector: 'SOME_STRING_VALUE',
              url: 'SOME_STRING_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE',
              format: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/selected?selector=SOME_STRING_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE&format=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/selected-multiple":
    get:
      summary: HTML of multiple page areas by URL and CSS selectors
      description: Returns HTML of multiple page areas by URL and CSS selectors. Useful
        if you don't want to do the HTML parsing on your side.
      operationId: getSelectedMultiple
      tags:
      - Selected HTML
      parameters:
      - in: query
        name: selectors
        description: Multiple CSS selectors (null by default, returns whole page HTML)
        example:
        - h1
        schema:
          type: array
          items:
            type: string
        style: form
        explode: true
      - "$ref": "#/components/parameters/url"
      - "$ref": "#/components/parameters/headers"
      - "$ref": "#/components/parameters/timeout"
      - "$ref": "#/components/parameters/js"
      - "$ref": "#/components/parameters/js_timeout"
      - "$ref": "#/components/parameters/wait_for"
      - "$ref": "#/components/parameters/proxy"
      - "$ref": "#/components/parameters/country"
      - "$ref": "#/components/parameters/custom_proxy"
      - "$ref": "#/components/parameters/device"
      - "$ref": "#/components/parameters/error_on_404"
      - "$ref": "#/components/parameters/error_on_redirect"
      - "$ref": "#/components/parameters/js_script"
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/SelectedAreas"
              example: '["<a href=''/test''>some link</a>", "Hello"]'
        '400':
          "$ref": "#/components/responses/400"
        '402':
          "$ref": "#/components/responses/402"
        '403':
          "$ref": "#/components/responses/403"
        '429':
          "$ref": "#/components/responses/429"
        '500':
          "$ref": "#/components/responses/500"
        '504':
          "$ref": "#/components/responses/504"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url 'https://api.webscraping.ai/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE'
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {
            method: 'GET',
            url: 'https://api.webscraping.ai/selected-multiple',
            qs: {
              selectors: 'SOME_ARRAY_VALUE',
              url: 'SOME_STRING_VALUE',
              headers: 'SOME_OBJECT_VALUE',
              timeout: 'SOME_INTEGER_VALUE',
              js: 'SOME_BOOLEAN_VALUE',
              js_timeout: 'SOME_INTEGER_VALUE',
              wait_for: 'SOME_STRING_VALUE',
              proxy: 'SOME_STRING_VALUE',
              country: 'SOME_STRING_VALUE',
              custom_proxy: 'SOME_STRING_VALUE',
              device: 'SOME_STRING_VALUE',
              error_on_404: 'SOME_BOOLEAN_VALUE',
              error_on_redirect: 'SOME_BOOLEAN_VALUE',
              js_script: 'SOME_STRING_VALUE'
            }
          };

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE\"\n\n\treq,
          _ := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/selected-multiple?selectors=SOME_ARRAY_VALUE&url=SOME_STRING_VALUE&headers=SOME_OBJECT_VALUE&timeout=SOME_INTEGER_VALUE&js=SOME_BOOLEAN_VALUE&js_timeout=SOME_INTEGER_VALUE&wait_for=SOME_STRING_VALUE&proxy=SOME_STRING_VALUE&country=SOME_STRING_VALUE&custom_proxy=SOME_STRING_VALUE&device=SOME_STRING_VALUE&error_on_404=SOME_BOOLEAN_VALUE&error_on_redirect=SOME_BOOLEAN_VALUE&js_script=SOME_STRING_VALUE",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
  "/account":
    get:
      summary: Information about your account calls quota
      description: Returns information about your account, including the remaining
        API credits quota, the next billing cycle start time, and the remaining concurrent
        requests. The response is in JSON format.
      operationId: account
      tags:
      - Account
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Account"
              example:
                remaining_api_calls: 200000
                resets_at: 1617073667
                remaining_concurrency: 100
        '403':
          "$ref": "#/components/responses/403"
      x-codeSamples:
      - lang: Shell + Curl
        source: |-
          curl --request GET \
            --url https://api.webscraping.ai/account
      - lang: Node + Request
        source: |
          const request = require('request');

          const options = {method: 'GET', url: 'https://api.webscraping.ai/account'};

          request(options, function (error, response, body) {
            if (error) throw new Error(error);

            console.log(body);
          });
      - lang: Python + Python3
        source: |-
          import http.client

          conn = http.client.HTTPSConnection("api.webscraping.ai")

          conn.request("GET", "/account")

          res = conn.getresponse()
          data = res.read()

          print(data.decode("utf-8"))
      - lang: Ruby + Native
        source: |-
          require 'uri'
          require 'net/http'
          require 'openssl'

          url = URI("https://api.webscraping.ai/account")

          http = Net::HTTP.new(url.host, url.port)
          http.use_ssl = true
          http.verify_mode = OpenSSL::SSL::VERIFY_NONE

          request = Net::HTTP::Get.new(url)

          response = http.request(request)
          puts response.read_body
      - lang: Go + Native
        source: "package main\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"io/ioutil\"\n)\n\nfunc
          main() {\n\n\turl := \"https://api.webscraping.ai/account\"\n\n\treq, _
          := http.NewRequest(\"GET\", url, nil)\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer
          res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}"
      - lang: Swift + Nsurlsession
        source: |-
          import Foundation

          let request = NSMutableURLRequest(url: NSURL(string: "https://api.webscraping.ai/account")! as URL,
                                                  cachePolicy: .useProtocolCachePolicy,
                                              timeoutInterval: 10.0)
          request.httpMethod = "GET"

          let session = URLSession.shared
          let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            if (error != nil) {
              print(error)
            } else {
              let httpResponse = response as? HTTPURLResponse
              print(httpResponse)
            }
          })

          dataTask.resume()
      - lang: Php + Curl
        source: |-
          <?php

          $curl = curl_init();

          curl_setopt_array($curl, [
            CURLOPT_URL => "https://api.webscraping.ai/account",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "GET",
          ]);

          $response = curl_exec($curl);
          $err = curl_error($curl);

          curl_close($curl);

          if ($err) {
            echo "cURL Error #:" . $err;
          } else {
            echo $response;
          }
security:
- api_key: []
servers:
- url: https://api.webscraping.ai
components:
  securitySchemes:
    api_key:
      type: apiKey
      name: api_key
      in: query
  responses:
    '400':
      description: Parameters validation error
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Invalid CSS selector
    '402':
      description: Billing issue, probably you've ran out of credits
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Some error
    '403':
      description: Wrong API key
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Some error
    '429':
      description: Too many concurrent requests
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Some error
    '500':
      description: Non-2xx and non-404 HTTP status code on the target page or unexpected
        error, try again or contact support@webscraping.ai
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Unexpected HTTP code on the target page
            status_code: 500
            status_message: Some website error
    '504':
      description: Timeout error, try increasing timeout parameter value
      content:
        application/json:
          schema:
            "$ref": "#/components/schemas/Error"
          example:
            message: Some error
  parameters:
    url:
      in: query
      name: url
      description: URL of the target page.
      required: true
      example: https://example.com
      schema:
        type: string
    postUrl:
      in: query
      name: url
      description: URL of the target page.
      required: true
      example: https://httpbin.org/post
      schema:
        type: string
    headers:
      in: query
      name: headers
      description: 'HTTP headers to pass to the target page. Can be specified either
        via a nested query parameter (...&headers[One]=value1&headers=[Another]=value2)
        or as a JSON encoded object (...&headers={"One": "value1", "Another": "value2"}).'
      example: '{"Cookie":"session=some_id"}'
      schema:
        type: object
        additionalProperties:
          type: string
      style: deepObject
      explode: true
    timeout:
      in: query
      name: timeout
      description: Maximum web page retrieval time in ms. Increase it in case of timeout
        errors (10000 by default, maximum is 30000).
      example: 10000
      schema:
        type: integer
        default: 10000
        minimum: 1
        maximum: 30000
    js:
      in: query
      name: js
      description: Execute on-page JavaScript using a headless browser (true by default).
      example: true
      schema:
        type: boolean
        default: true
    js_timeout:
      in: query
      name: js_timeout
      description: Maximum JavaScript rendering time in ms. Increase it in case if
        you see a loading indicator instead of data on the target page.
      example: 2000
      schema:
        type: integer
        default: 2000
        minimum: 1
        maximum: 20000
    wait_for:
      in: query
      name: wait_for
      description: CSS selector to wait for before returning the page content. Useful
        for pages with dynamic content loading. Overrides js_timeout.
      schema:
        type: string
    proxy:
      in: query
      name: proxy
      description: Type of proxy, use residential proxies if your site restricts traffic
        from datacenters (datacenter by default). Note that residential proxy requests
        are more expensive than datacenter, see the pricing page for details.
      example: datacenter
      schema:
        type: string
        default: datacenter
        enum:
        - datacenter
        - residential
    country:
      in: query
      name: country
      description: Country of the proxy to use (US by default).
      example: us
      schema:
        type: string
        default: us
        enum:
        - us
        - gb
        - de
        - it
        - fr
        - ca
        - es
        - ru
        - jp
        - kr
        - in
    custom_proxy:
      in: query
      name: custom_proxy
      description: Your own proxy URL to use instead of our built-in proxy pool in
        "http://user:password@host:port" format (<a target="_blank" href="https://webscraping.ai/proxies/smartproxy">Smartproxy</a>
        for example).
      example:
      schema:
        type: string
    device:
      in: query
      name: device
      description: Type of device emulation.
      example: desktop
      schema:
        type: string
        default: desktop
        enum:
        - desktop
        - mobile
        - tablet
    error_on_404:
      in: query
      name: error_on_404
      description: Return error on 404 HTTP status on the target page (false by default).
      example: false
      schema:
        type: boolean
        default: false
    error_on_redirect:
      in: query
      name: error_on_redirect
      description: Return error on redirect on the target page (false by default).
      example: false
      schema:
        type: boolean
        default: false
    js_script:
      in: query
      name: js_script
      description: Custom JavaScript code to execute on the target page.
      example: document.querySelector('button').click();
      schema:
        type: string
    return_script_result:
      in: query
      name: return_script_result
      description: Return result of the custom JavaScript code (js_script parameter)
        execution on the target page (false by default, page HTML will be returned).
      example: false
      schema:
        type: boolean
        default: false
    text_format:
      in: query
      name: text_format
      description: Format of the text response (plain by default). "plain" will return
        only the page body text. "json" and "xml" will return a json/xml with "title",
        "description" and "content" keys.
      example: plain
      schema:
        type: string
        default: plain
        enum:
        - plain
        - xml
        - json
    return_links:
      in: query
      name: return_links
      description: "[Works only with text_format=json] Return links from the page
        body text (false by default). Useful for building web crawlers."
      example: false
      schema:
        type: boolean
        default: false
    question:
      in: query
      name: question
      description: Question or instructions to ask the LLM model about the target
        page.
      example: What is the summary of this page content?
      schema:
        type: string
    format:
      in: query
      name: format
      description: Format of the response (text by default). "json" will return a
        JSON object with the response, "text" will return a plain text/HTML response.
      example: json
      schema:
        type: string
        default: json
        enum:
        - json
        - text
  requestBodies:
    Body:
      description: Request body to pass to the target page
      content:
        application/json:
          schema:
            type: object
            additionalProperties: true
        application/x-www-form-urlencoded:
          schema:
            type: object
            additionalProperties: true
        application/xml:
          schema:
            type: object
            additionalProperties: true
        text/plain:
          schema:
            type: string
  schemas:
    Error:
      title: Generic error
      type: object
      properties:
        message:
          type: string
          description: Error description
        status_code:
          type: integer
          description: Target page response HTTP status code (403, 500, etc)
        status_message:
          type: string
          description: Target page response HTTP status message
        body:
          type: string
          description: Target page response body
    SelectedAreas:
      title: HTML for selected page areas
      type: array
      description: Array of elements matched by selectors
      items:
        type: string
    Account:
      title: Account limits info
      type: object
      properties:
        email:
          type: string
          description: Your account email
        remaining_api_calls:
          type: integer
          description: Remaining API credits quota
        resets_at:
          type: integer
          description: Next billing cycle start time (UNIX timestamp)
        remaining_concurrency:
          type: integer
          description: Remaining concurrent requests
