Search sources

October 15, 2026

Table of contents

  1. Request Headers
  2. Request Body
  3. Responses
  4. Model
  5. Examples
  6. Try It

Find the passages of a notebook’s sources that best match a query. The results are the passages themselves, best match first, each with the id of its source and its place in that source’s text. Google writes no answer, and the search does not count as a chat question. To get a written answer with citations use POST /chat.

start and end are character offsets in the source’s text, which GET /sources/source returns with content=true.

A query that matches nothing returns "results": [].

https://api.useapi.net/v1/gemini-notebook/sources/search

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
  "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
  "query": "oxygen tank explosion",
  "limit": 5
}
  • notebook is required, the notebook id. The id names its account, so no email is needed.
  • query is required, what to look for, up to 2,000 characters.
  • sources is optional, an array of 1 to 300 source ids of this notebook to search in.
    Default: every source in the notebook.
  • limit is optional, the most passages to return.
    Range: 1 to 100. Default: 20.
Responses
  • 200 OK

    Best match first (passages shortened with ...):

    {
      "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
      "results": [
        {
          "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:2744eb7c-399a-4573-bd32-126143ba9514",
          "text": "April 11, 1970, 22:32:08 UTC\nUndocking date\nApril 17, 1970, 16:43:00 UTC\n...**Apollo 13**  (April 11– 17, 1970) was the seventh crewed mission in the [Apollo space program](https://en.wikipedia.org/wiki/Apollo_program) and would have been the third [Moon landing](https://en.wikipedia.org/wiki/Moon_landing). ...the landing was aborted after an oxygen tank in the [service module](https://en.wikipedia.org/wiki/Apollo_command_and_service_module#Service_module_(SM)) (SM) exploded two days into the mission...\n",
          "start": 14276,
          "end": 15189
        },
        {
          "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:2744eb7c-399a-4573-bd32-126143ba9514",
          "text": "A routine stir of an oxygen tank ignited damaged wire insulation inside it, causing an explosion that vented the contents of both of the SM's oxygen tanks to space. ...With the lunar landing canceled, mission controllers worked to bring the crew home alive.\n",
          "start": 15189,
          "end": 15729
        },
        "..."
      ]
    }
    
  • 400 Bad Request

    A missing or invalid parameter, or a source from another notebook.

    {
      "error": "Parameter query is required",
      "code": 400
    }
    
    {
      "error": "source user:[email protected]:5b7e2a41-9c0d-4e8f-a1b3-6d2c8f0e7a95:b3cffe4a-130b-42eb-b6d0-1edf33675051 is not in notebook user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
      "code": 400
    }
    
  • 401 Unauthorized

    Invalid API token.

    {
      "error": "useapi.net ⁝ Unauthorized",
      "code": 401
    }
    
  • 403 Forbidden

    The id was issued to a different API token.

    {
      "error": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55 does not belong to this API token",
      "code": 403
    }
    
  • 404 Not Found

    The account the notebook names is not configured, or the notebook was deleted.

    {
      "error": "Account [email protected] of user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55 is not configured",
      "code": 404
    }
    
  • 596 Account Error

    Google reported the account as signed out. While we re-check it, the answer is the first message below. Retry in about a minute. If it stays signed out, the account is paused, you receive an email, and the answer becomes the second message until you re-add it via Setup Gemini Notebook.

    {
      "error": "Google reported this account as signed out. We are re-checking it — please retry in about a minute. If it stays signed out, you will receive a re-add email.",
      "code": 596
    }
    
    {
      "error": "Account [email protected]: Google signed this account out. Re-add it at https://useapi.net/docs/start-here/setup-gemini-notebook",
      "code": 596
    }
    
  • 503 Service Unavailable

    Google is temporarily unavailable or is challenging our network. Retry in a few minutes. A 502 means Google answered with an unexpected error.

    {
      "error": "GOOGLE_BOT_CHECK: Google is challenging our network right now, please retry in a few minutes",
      "code": 503
    }
    
Model
{ // TypeScript, all fields are optional
  notebook: string
  results: {                   // best match first
    source: string             // user:<id>-<email>-source:<notebook uuid>:<source uuid>
    text: string               // the matching passage
    start?: number             // character offset in the source's text where the passage starts
    end?: number               // character offset where it ends
  }[]
  error: string                // error responses only
  code: number                 // error responses only, the HTTP status
}
Examples
  • curl -X POST "https://api.useapi.net/v1/gemini-notebook/sources/search" \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer …" \
       -d '{
         "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
         "query": "oxygen tank explosion",
         "limit": 5
       }'
    
  • const token = "API token";
    const response = await fetch("https://api.useapi.net/v1/gemini-notebook/sources/search", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${token}`
      },
      body: JSON.stringify({
        notebook: "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
        query: "oxygen tank",
        sources: ["user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:2744eb7c-399a-4573-bd32-126143ba9514"]
      })
    });
    const result = await response.json();
    console.log("response", response.status, result);
    
  • import requests
    
    token = "API token"
    response = requests.post(
        "https://api.useapi.net/v1/gemini-notebook/sources/search",
        headers={"Content-Type": "application/json", "Authorization": f"Bearer {token}"},
        json={
            "notebook": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55",
            "query": "oxygen tank explosion",
            "limit": 5
        }
    )
    for r in response.json().get("results", []):
        print(r["source"], r.get("start"), r["text"][:100])
    
Try It