Skip to content

Search

Shows how to perform a Google web search.

This example assumes using Serper; is in scope and apiKey contains your Serper API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using var client = new SerperClient(apiKey);

// Perform a Google web search using the Serper API.
var response = await client.SearchAsync(new BaseSearchRequest
{
    Q = "artificial intelligence latest news",
    Num = 5,
});

// The response includes organic results, knowledge graph, and more.

foreach (var result in response.Organic)
{
    Console.WriteLine($"[{result.Position}] {result.Title}");
    Console.WriteLine($"    {result.Link}");
}