Documentation

Gemini API

Select a language:

Overview

Here is the list of the different parameters you can use with ScrapingBee's Gemini API.

You can also discover this API using our Postman collection covering every ScrapingBee's features.

Our Gemini API allows you to send prompts to a Gemini model and receive AI-generated responses in realtime.

We provide one endpoint:

  • Gemini endpoint (/api/v1/gemini) - Send prompts to Gemini and receive AI-generated responses

Quick start

To use the Gemini API, you only need two things:

Then, simply do this.

Copy
curl "https://app.scrapingbee.com/api/v1/gemini?prompt=Best+programming+languages+for+data+science" \
     -H "Authorization: Bearer YOUR-API-KEY"
#  Install the Python Requests library:
# pip install requests
import requests

def send_request():
    response = requests.get(
        url='https://app.scrapingbee.com/api/v1/gemini',
        headers={
            'Authorization': 'Bearer YOUR-API-KEY',
        },
        params={
            'prompt': 'Best programming languages for data science',
        },

    )
    print('Response HTTP Status Code: ', response.status_code)
    print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/gemini', {
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY',
    },
    params: {
        'url': 'YOUR-URL',
        'prompt': Best programming languages for data science,
    }
}).then(function (response) {
    // handle success
    console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }

  private static void sendRequest() {

    // Classic (GET )
    try {

      // Create request
      
      Content content = Request.Get("https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science")

      // Authenticate with your API key
      .addHeader("Authorization", "Bearer YOUR-API-KEY")

      // Fetch request and return content
      .execute().returnContent();

      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
require 'net/http'
require 'net/https'

# Classic (GET )
def send_request 
    uri = URI('https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science')

    # Create client
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER

    # Create Request
    req =  Net::HTTP::Get.new(uri)
    # Authenticate with your API key
    req['Authorization'] = 'Bearer YOUR-API-KEY'

    # Fetch Request
    res = http.request(req)
    puts "Response HTTP Status Code: #{ res.code }"
    puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
    puts "HTTP Request failed (#{ e.message })"
end

send_request()
<?php

// get cURL resource
$ch = curl_init();

// set url 
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science');

// authenticate with your API key
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR-API-KEY',
]);

// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);



// send the request and save response to $response
$response = curl_exec($ch);

// stop if fails
if (!$response) {
    die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

// close curl resource to free up system resources
curl_close($ch);
>
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sendClassic() {
	// Create client
	client := &http.Client{}

	// Create request 
	req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science", nil)

	// Authenticate with your API key
	req.Header.Set("Authorization", "Bearer YOUR-API-KEY")

	parseFormErr := req.ParseForm()
	if parseFormErr != nil {
		fmt.Println(parseFormErr)
	}

	// Fetch Request
	resp, err := client.Do(req)

	if err != nil {
		fmt.Println("Failure : ", err)
	}

	// Read Response Body
	respBody, _ := ioutil.ReadAll(resp.Body)

	// Display Results
	fmt.Println("response Status : ", resp.Status)
	fmt.Println("response Headers : ", resp.Header)
	fmt.Println("response Body : ", string(respBody))
}

func main() {
    sendClassic()
}
# Install the ScrapingBee CLI:
# pip install scrapingbee-cli

scrapingbee gemini "Best programming languages for data science"

Here is a breakdown of all the parameters you can use with the Gemini API:

name [type] (default)
Description
api_key [string] required
Your api key
prompt [string] required
The prompt you want to send to the Gemini model
add_html [boolean] (false)
Adding the full HTML of the page in the results
country_code [string] ("")
Country code from which you would like the request to come from
tag [string] ("")
A custom identifier to label requests, returned with the response headers.

Response Example

The API will then respond with formatted JSON data:

{
    "full_html": "" # Full HTML response, including all formatting, included if add_html=true
    "prompt": "Best programming languages for data science",
    # The result in Markdown format
    "results_markdown": "When it comes to data science, you don\u2019t need to learn every programming language out there. The industry is highly consolidated around a few heavy hitters, though the \"best\" language ultimately depends on whether you are building machine learning models, running statistical research, or engineering massive data pipelines.\n\nThe top programming languages for data science are broken down below, ranked by relevance and use case.\n\n1. The Heavy Hitters (The Non-Negotiables)\n------------------------------------------\n\nIf you are just getting started, focus your energy here. These two languages form the backbone of the vast majority of data science jobs.\n\n### **Python**\n\n* **The Verdict:** The undisputed king of data science.\n* **Why it\u2019s great:** Python is a general-purpose language with an English-like syntax that is incredibly beginner-friendly. Its real power lies in its massive, mature ecosystem of libraries. Whether you want to clean data, build deep learning models, or deploy an API, Python has a tool for it.\n* \n\n### **SQL (Structured Query Language)**\n\n* **The Verdict:** Absolutely non-negotiable.\n* **Why it\u2019s great:** SQL isn't for building machine learning models, but it is how you talk to databases. Before you can analyze data or train a model, you have to extract the data. Data scientists frequently use SQL to pull, filter, and aggregate millions of rows of data before passing it into Python or R.\n* **Best for:** Data extraction, querying, and database management.\n\n",
    # The result in plain text format
    "results_text": "When it comes to data science, you don\u2019t need to learn every programming language out there. The industry is highly consolidated around a few heavy hitters, though the \"best\" language ultimately depends on whether you are building machine learning models, running statistical research, or engineering massive data pipelines. The top programming languages for data science are broken down below, ranked by relevance and use case. 1. The Heavy Hitters (The Non-Negotiables) If you are just getting started, focus your energy here. These two languages form the backbone of the vast majority of data science jobs. Python The Verdict: The undisputed king of data science. Why it\u2019s great: Python is a general-purpose language with an English-like syntax that is incredibly beginner-friendly. Its real power lies in its massive, mature ecosystem of libraries. Whether you want to clean data, build deep learning models, or deploy an API, Python has a tool for it. SQL (Structured Query Language) The Verdict: Absolutely non-negotiable. Why it\u2019s great: SQL isn't for building machine learning models, but it is how you talk to databases. Before you can analyze data or train a model, you have to extract the data. Data scientists frequently use SQL to pull, filter, and aggregate millions of rows of data before passing it into Python or R. Best for: Data extraction, querying, and database management.",
    # Source citations referenced in the response
    "citations": [
        {
            "description": "The 10 Best Programming Languages for Data Science - Python is the dominant \nprogramming language for data science, and for good reason. - R is the \ngo-to ...",
            "text": "The industry is highly consolidated around a few heavy hitters, though the \"best\" language ultimately depends on whether you are building machine learning models, running statistical research, or engineering massive data pipelines.",
            "title": "The 10 Best Programming Languages for Data Science | Intuit Blog",
            "url": "https://www.intuit.com/blog/innovative-thinking/best-programming-languages-for-data-science/"
        },
        {
            "description": "# 10. C++ | Primary use case --- | --- Julia | Numerical computing \nScientific research Deep learning Interactive computing Scala | Big data \nprocessing Data ...",
            "text": "The top programming languages for data science are broken down below, ranked by relevance and use case.",
            "title": "The 10 Best Programming Languages for Data Science | Intuit Blog",
            "url": "https://www.intuit.com/blog/innovative-thinking/best-programming-languages-for-data-science/"
        },
        {
            "description": "1. Python. Python is the dominant programming language for data science, \nand for good reason. It's an open-source and general-purpose language, \nmaking it ...",
            "text": "* The undisputed king of data science.",
            "title": "The 10 Best Programming Languages for Data Science | Intuit Blog",
            "url": "https://www.intuit.com/blog/innovative-thinking/best-programming-languages-for-data-science/#:~:text=1.,for%20many%20data%20science%20jobs."
        }
    ],
}

Keep in mind that each successful API call will cost you 15 api credits.

Every request that failed will be tried as many times as possible for 30 seconds.

So please be aware of this maximum timeout when writing your own code.



API key

api_key
[
string
]
(
""
)
required

All requests are authenticated by using your private API key.

To get access to your API key, just create an account here and confirm your email.



Prompt

prompt
[
string
]
(
""
)
required

The prompt parameter is the text you want to send to the Gemini model for processing. This is required for the Gemini endpoint.

The prompt should be clear and specific to get the best results from the AI model. You can ask questions, request content generation, or seek analysis on various topics.

Prompt Best Practices

Here are some tips for writing effective prompts:

  • Be specific: Clear, detailed prompts yield better results
  • Provide context: Include relevant background information when needed
  • Set expectations: Specify the format or style of response you want
  • Use examples: Show the model what kind of output you're looking for

Example prompts:

  • "Summarize the following text in 3 bullet points: [your text]"
  • "Write a professional email response to a customer complaint about delayed shipping"
  • "Explain quantum computing in simple terms suitable for a high school student"
  • "Generate 5 creative product names for an eco-friendly water bottle"
Copy
curl "https://app.scrapingbee.com/api/v1/gemini?prompt=Best+programming+languages+for+data+science" \
     -H "Authorization: Bearer YOUR-API-KEY"
#  Install the Python Requests library:
# pip install requests
import requests

def send_request():
    response = requests.get(
        url='https://app.scrapingbee.com/api/v1/gemini',
        headers={
            'Authorization': 'Bearer YOUR-API-KEY',
        },
        params={
            'prompt': 'Best programming languages for data science',
        },

    )
    print('Response HTTP Status Code: ', response.status_code)
    print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/gemini', {
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY',
    },
    params: {
        'url': 'YOUR-URL',
        'prompt': Best programming languages for data science,
    }
}).then(function (response) {
    // handle success
    console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }

  private static void sendRequest() {

    // Classic (GET )
    try {

      // Create request
      
      Content content = Request.Get("https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science")

      // Authenticate with your API key
      .addHeader("Authorization", "Bearer YOUR-API-KEY")

      // Fetch request and return content
      .execute().returnContent();

      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
require 'net/http'
require 'net/https'

# Classic (GET )
def send_request 
    uri = URI('https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science')

    # Create client
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER

    # Create Request
    req =  Net::HTTP::Get.new(uri)
    # Authenticate with your API key
    req['Authorization'] = 'Bearer YOUR-API-KEY'

    # Fetch Request
    res = http.request(req)
    puts "Response HTTP Status Code: #{ res.code }"
    puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
    puts "HTTP Request failed (#{ e.message })"
end

send_request()
<?php

// get cURL resource
$ch = curl_init();

// set url 
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science');

// authenticate with your API key
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR-API-KEY',
]);

// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);



// send the request and save response to $response
$response = curl_exec($ch);

// stop if fails
if (!$response) {
    die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

// close curl resource to free up system resources
curl_close($ch);
>
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sendClassic() {
	// Create client
	client := &http.Client{}

	// Create request 
	req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=Best+programming+languages+for+data+science", nil)

	// Authenticate with your API key
	req.Header.Set("Authorization", "Bearer YOUR-API-KEY")

	parseFormErr := req.ParseForm()
	if parseFormErr != nil {
		fmt.Println(parseFormErr)
	}

	// Fetch Request
	resp, err := client.Do(req)

	if err != nil {
		fmt.Println("Failure : ", err)
	}

	// Read Response Body
	respBody, _ := ioutil.ReadAll(resp.Body)

	// Display Results
	fmt.Println("response Status : ", resp.Status)
	fmt.Println("response Headers : ", resp.Header)
	fmt.Println("response Body : ", string(respBody))
}

func main() {
    sendClassic()
}
# Install the ScrapingBee CLI:
# pip install scrapingbee-cli

scrapingbee gemini "Best programming languages for data science"


Add HTML

add_html
[
boolean
]
(
false
)

The add_html parameter controls whether the full HTML is included in the response alongside the text answer. When set to true, the response will contain a full_html field with the complete HTML content.

Set add_html=true to include the full HTML, or add_html=false (the default) to omit it.

Copy
curl "https://app.scrapingbee.com/api/v1/gemini?add_html=true&prompt=Explain+the+benefits+of+renewable+energy+in+100+words" \
     -H "Authorization: Bearer YOUR-API-KEY"
#  Install the Python Requests library:
# pip install requests
import requests

def send_request():
    response = requests.get(
        url='https://app.scrapingbee.com/api/v1/gemini',
        headers={
            'Authorization': 'Bearer YOUR-API-KEY',
        },
        params={
            'add_html': 'true',
            'prompt': 'Explain the benefits of renewable energy in 100 words',
        },

    )
    print('Response HTTP Status Code: ', response.status_code)
    print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/gemini', {
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY',
    },
    params: {
        'url': 'YOUR-URL',
        'add_html': true,
        'prompt': Explain the benefits of renewable energy in 100 words,
    }
}).then(function (response) {
    // handle success
    console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }

  private static void sendRequest() {

    // Classic (GET )
    try {

      // Create request
      
      Content content = Request.Get("https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&add_html=true&prompt=Explain+the+benefits+of+renewable+energy+in+100+words")

      // Authenticate with your API key
      .addHeader("Authorization", "Bearer YOUR-API-KEY")

      // Fetch request and return content
      .execute().returnContent();

      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
require 'net/http'
require 'net/https'

# Classic (GET )
def send_request 
    uri = URI('https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&add_html=true&prompt=Explain+the+benefits+of+renewable+energy+in+100+words')

    # Create client
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER

    # Create Request
    req =  Net::HTTP::Get.new(uri)
    # Authenticate with your API key
    req['Authorization'] = 'Bearer YOUR-API-KEY'

    # Fetch Request
    res = http.request(req)
    puts "Response HTTP Status Code: #{ res.code }"
    puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
    puts "HTTP Request failed (#{ e.message })"
end

send_request()
<?php

// get cURL resource
$ch = curl_init();

// set url 
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&add_html=true&prompt=Explain+the+benefits+of+renewable+energy+in+100+words');

// authenticate with your API key
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR-API-KEY',
]);

// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);



// send the request and save response to $response
$response = curl_exec($ch);

// stop if fails
if (!$response) {
    die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

// close curl resource to free up system resources
curl_close($ch);
>
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sendClassic() {
	// Create client
	client := &http.Client{}

	// Create request 
	req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&add_html=true&prompt=Explain+the+benefits+of+renewable+energy+in+100+words", nil)

	// Authenticate with your API key
	req.Header.Set("Authorization", "Bearer YOUR-API-KEY")

	parseFormErr := req.ParseForm()
	if parseFormErr != nil {
		fmt.Println(parseFormErr)
	}

	// Fetch Request
	resp, err := client.Do(req)

	if err != nil {
		fmt.Println("Failure : ", err)
	}

	// Read Response Body
	respBody, _ := ioutil.ReadAll(resp.Body)

	// Display Results
	fmt.Println("response Status : ", resp.Status)
	fmt.Println("response Headers : ", resp.Header)
	fmt.Println("response Body : ", string(respBody))
}

func main() {
    sendClassic()
}
# Install the ScrapingBee CLI:
# pip install scrapingbee-cli

scrapingbee gemini "Explain the benefits of renewable energy in 100 words" --add-html true


Country Code

country_code
[
string
]
(
""
)

The country_code parameter sets the geolocation for the request using an ISO country code (e.g., us, gb, fr).

Copy
curl "https://app.scrapingbee.com/api/v1/gemini?country_code=us&prompt=What+are+the+top+news+stories+today%3F" \
     -H "Authorization: Bearer YOUR-API-KEY"
#  Install the Python Requests library:
# pip install requests
import requests

def send_request():
    response = requests.get(
        url='https://app.scrapingbee.com/api/v1/gemini',
        headers={
            'Authorization': 'Bearer YOUR-API-KEY',
        },
        params={
            'country_code': 'us',
            'prompt': 'What are the top news stories today?',
        },

    )
    print('Response HTTP Status Code: ', response.status_code)
    print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/gemini', {
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY',
    },
    params: {
        'url': 'YOUR-URL',
        'country_code': us,
        'prompt': What are the top news stories today?,
    }
}).then(function (response) {
    // handle success
    console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }

  private static void sendRequest() {

    // Classic (GET )
    try {

      // Create request
      
      Content content = Request.Get("https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&country_code=us&prompt=What+are+the+top+news+stories+today%3F")

      // Authenticate with your API key
      .addHeader("Authorization", "Bearer YOUR-API-KEY")

      // Fetch request and return content
      .execute().returnContent();

      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
require 'net/http'
require 'net/https'

# Classic (GET )
def send_request 
    uri = URI('https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&country_code=us&prompt=What+are+the+top+news+stories+today%3F')

    # Create client
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER

    # Create Request
    req =  Net::HTTP::Get.new(uri)
    # Authenticate with your API key
    req['Authorization'] = 'Bearer YOUR-API-KEY'

    # Fetch Request
    res = http.request(req)
    puts "Response HTTP Status Code: #{ res.code }"
    puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
    puts "HTTP Request failed (#{ e.message })"
end

send_request()
<?php

// get cURL resource
$ch = curl_init();

// set url 
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&country_code=us&prompt=What+are+the+top+news+stories+today%3F');

// authenticate with your API key
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR-API-KEY',
]);

// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);



// send the request and save response to $response
$response = curl_exec($ch);

// stop if fails
if (!$response) {
    die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

// close curl resource to free up system resources
curl_close($ch);
>
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sendClassic() {
	// Create client
	client := &http.Client{}

	// Create request 
	req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&country_code=us&prompt=What+are+the+top+news+stories+today%3F", nil)

	// Authenticate with your API key
	req.Header.Set("Authorization", "Bearer YOUR-API-KEY")

	parseFormErr := req.ParseForm()
	if parseFormErr != nil {
		fmt.Println(parseFormErr)
	}

	// Fetch Request
	resp, err := client.Do(req)

	if err != nil {
		fmt.Println("Failure : ", err)
	}

	// Read Response Body
	respBody, _ := ioutil.ReadAll(resp.Body)

	// Display Results
	fmt.Println("response Status : ", resp.Status)
	fmt.Println("response Headers : ", resp.Header)
	fmt.Println("response Body : ", string(respBody))
}

func main() {
    sendClassic()
}
# Install the ScrapingBee CLI:
# pip install scrapingbee-cli

scrapingbee gemini "What are the top news stories today?" --country-code us


Tag

tag
[
string
]
(
""
)

Attach a custom string identifier to any request using the tag parameter. The value will be returned with the response headers. This parameter is optional and has no effect on the scraping behavior.

Copy
curl "https://app.scrapingbee.com/api/v1/gemini?prompt=What+is+the+weather+today%3F&tag=your+text" \
     -H "Authorization: Bearer YOUR-API-KEY"
#  Install the Python Requests library:
# pip install requests
import requests

def send_request():
    response = requests.get(
        url='https://app.scrapingbee.com/api/v1/gemini',
        headers={
            'Authorization': 'Bearer YOUR-API-KEY',
        },
        params={
            'prompt': 'What is the weather today?',
            'tag': 'your text',
        },

    )
    print('Response HTTP Status Code: ', response.status_code)
    print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');

axios.get('https://app.scrapingbee.com/api/v1/gemini', {
    headers: {
        'Authorization': 'Bearer YOUR-API-KEY',
    },
    params: {
        'url': 'YOUR-URL',
        'prompt': What is the weather today?,
        'tag': your text,
    }
}).then(function (response) {
    // handle success
    console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;

public class SendRequest
{
  public static void main(String[] args) {
    sendRequest();
  }

  private static void sendRequest() {

    // Classic (GET )
    try {

      // Create request
      
      Content content = Request.Get("https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=What+is+the+weather+today%3F&tag=your+text")

      // Authenticate with your API key
      .addHeader("Authorization", "Bearer YOUR-API-KEY")

      // Fetch request and return content
      .execute().returnContent();

      // Print content
      System.out.println(content);
    }
    catch (IOException e) { System.out.println(e); }
  }
}
require 'net/http'
require 'net/https'

# Classic (GET )
def send_request 
    uri = URI('https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=What+is+the+weather+today%3F&tag=your+text')

    # Create client
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER

    # Create Request
    req =  Net::HTTP::Get.new(uri)
    # Authenticate with your API key
    req['Authorization'] = 'Bearer YOUR-API-KEY'

    # Fetch Request
    res = http.request(req)
    puts "Response HTTP Status Code: #{ res.code }"
    puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
    puts "HTTP Request failed (#{ e.message })"
end

send_request()
<?php

// get cURL resource
$ch = curl_init();

// set url 
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=What+is+the+weather+today%3F&tag=your+text');

// authenticate with your API key
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR-API-KEY',
]);

// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');

// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);



// send the request and save response to $response
$response = curl_exec($ch);

// stop if fails
if (!$response) {
    die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}

echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;

// close curl resource to free up system resources
curl_close($ch);
>
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sendClassic() {
	// Create client
	client := &http.Client{}

	// Create request 
	req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/gemini?url=YOUR-URL&prompt=What+is+the+weather+today%3F&tag=your+text", nil)

	// Authenticate with your API key
	req.Header.Set("Authorization", "Bearer YOUR-API-KEY")

	parseFormErr := req.ParseForm()
	if parseFormErr != nil {
		fmt.Println(parseFormErr)
	}

	// Fetch Request
	resp, err := client.Do(req)

	if err != nil {
		fmt.Println("Failure : ", err)
	}

	// Read Response Body
	respBody, _ := ioutil.ReadAll(resp.Body)

	// Display Results
	fmt.Println("response Status : ", resp.Status)
	fmt.Println("response Headers : ", resp.Header)
	fmt.Println("response Body : ", string(respBody))
}

func main() {
    sendClassic()
}
# Install the ScrapingBee CLI:
# pip install scrapingbee-cli

scrapingbee gemini "What is the weather today?" --tag "your text"

Credit cost for your requests

Each ScrapingBee plan provides a certain amount of API credits per month.

It costs 15 credits per Gemini API request.

Citations

Currently, the ScrapingBee Gemini API is not able to return citations 100% of the time. Citations with the Gemini scraper also depend on the prompt used; it usually appears when the answer is web-grounded and not general-knowledge request.