Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to SerpApi

Scalekit connector
Open markdown

The SerpApi connector lets your AI agent act in each user's SerpApi account. Each user connects their own SerpApi API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 19 tools.

Tools
19
What they doRead · write · destructive
19 · 0 · 019 read0 write0 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the SerpApi connection

    In AgentKit > Connections, create a SerpApi connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'serpapi'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize SerpApi:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'serpapi_account_get',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their SerpApi credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • serpapi_account_getGet the SerpApi account's plan, remaining searches and usage.Read-only

    Get Account

    Get the SerpApi account's plan, remaining searches and usage. This call is free. Returns account_email, account_status, plan_name, searches_per_month, plan_searches_left, extra_credits, total_searches_left, this_month_usage, this_hour_searches, last_hour_searches and account_rate_limit_per_hour. Use this before a large batch of searches to check the remaining balance and hourly limit.

    Inputs

    This tool takes no inputs.

  • serpapi_google_autocompleteGet Google's autocomplete suggestions for a partial query through SerpApi.Read-only

    Google Autocomplete

    Get Google's autocomplete suggestions for a partial query through SerpApi. Returns suggestions with value (the suggested query), relevance and type, plus verbatim_relevance. Use this to expand keywords or see how people phrase a search. Use serpapi_google_trends_search for popularity over time.

    Inputs

    qstringrequired
    The partial query to complete. Example: how to make cold br
    asyncboolean
    Set true to submit the search and return at once with only search_metadata (id and status Processing); fetch the results later with serpapi_search_archive_get using search_metadata.id. Do not combine with no_cache. Example: false
    cpinteger
    Cursor position in the query, starting at 0; suggestions complete the text at this position. Defaults to the end of the query. Example: 10
    glstring
    Two-letter country code (Google's gl parameter, lowercase) that sets which country's results to return. Example: us
    hlstring
    Language code for the results (Google's hl parameter): a two-letter language code, optionally with a region, such as en, fr, en-gb or es-419. Example: en
    json_restrictorstring
    Limit the response to the listed fields to keep it small, using SerpApi's JSON Restrictor syntax: comma-separated top-level keys, with dots, brackets and braces for nested fields. Example: organic_results[0:5].{title,link,snippet}
    no_cacheboolean
    Set true to force a fresh search instead of a cached result. SerpApi serves an identical search run in the last hour from its cache for free; a fresh search spends one search credit. Do not combine with async. Example: false