Sync a Google Drive source

September 29, 2026

Table of contents

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

A source added from Google Drive with the drive parameter of POST /sources is a copy of the file as it was then. When the Google Doc or Drive file changes later, the notebook keeps the old text until the source is synced, just like the sync button in the Gemini Notebook web app.

This endpoint checks whether the Drive file changed since it was added. If it did, Google re-imports it and the response carries the refreshed source with synced: true. If it did not, nothing is re-imported and the response carries the source unchanged with synced: false. GET /sources/source shows the same check as inSync.

For a Google Doc, Google starts the re-import as soon as it notices the change, including during that check. In our tests (September 2026) a Doc that GET /sources/source reported as inSync: false was already refreshed a few seconds later, and a sync right after answered synced: false with the new text already in the source. Read words or content to see what the notebook holds.

Only Google Drive sources can be synced (kind google_docs or drive). Any other source returns 400.

A re-import usually answers within one to two minutes, because Google reads the file again before it answers. If Google takes longer, the API answers 504 after about two minutes, and the sync usually still completes. After a 504 or a timeout on your side, check the source with GET /sources/source before you retry.

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

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
Request Body
{
  "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31"
}
  • source is required, the id of a Google Drive source. The id names its account, so no email is needed.
Responses
  • 200 OK

    The source, with synced: true when it was re-imported, or synced: false when the Drive file had not changed.

    {
      "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31",
      "title": "Apollo 11 landing notes",
      "kind": "google_docs",
      "status": "ready",
      "words": 10,
      "driveFileId": "1Qx7Lm2VtR8pKc4NwE9bYs3HfJ6uGdA0zT5iOv1eWnXk",
      "created": "2026-09-28T02:52:41.000Z",
      "synced": true
    }
    
  • 400 Bad Request

    A missing or malformed source, or a source that did not come from Google Drive.

    {
      "error": "Only a Google Drive source can be synced (this one is text)",
      "code": 400
    }
    
    {
      "error": "Parameter source is not a valid source id",
      "code": 400
    }
    
  • 401 Unauthorized

    Invalid API token.

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

    The source id was issued to a different API token.

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

    The source is no longer in its notebook, the notebook was deleted, or the account named in the id is no longer configured.

    {
      "error": "Source user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31 not found",
      "code": 404
    }
    
  • 504 Gateway Timeout

    Google did not answer the re-import within about two minutes, or the connection dropped. The sync usually still completes, so check the source with GET /sources/source before you retry.

    {
      "error": "Google did not answer the sync (timeout or dropped connection). It may still have completed: check GET /sources/user%3A12345-user%40example.com-source%3Ad02c903b-17f8-4241-a263-2be9e7359d55%3A6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31 before retrying",
      "code": 504
    }
    
  • 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 is temporarily unavailable (FLmJqe grpc 14), please retry",
      "code": 503
    }
    
Model

The source object, as in POST /sources, plus synced.

{ // TypeScript, all fields are optional
  source: string              // user:<id>-<email>-source:<notebook uuid>:<source uuid>
  title: string
  kind: string                // google_docs | drive
  status: string              // preparing | processing | ready | error
  words?: number
  mimeType?: string
  driveFileId?: string        // the Drive file id
  created?: string            // ISO 8601
  synced: boolean             // true = re-imported, false = the Drive file had not changed
  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/sync" \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer …" \
       -d '{ "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31" }'
    
  • const token = "API token";
    const apiUrl = "https://api.useapi.net/v1/gemini-notebook/sources/sync";
    const response = await fetch(apiUrl, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${token}`,
      },
      body: JSON.stringify({
        source: "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31"
      })
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    apiUrl = "https://api.useapi.net/v1/gemini-notebook/sources/sync"
    headers = {
        "Content-Type": "application/json",
        "Authorization" : f"Bearer {token}"
    }
    data = {
        "source": "user:[email protected]:d02c903b-17f8-4241-a263-2be9e7359d55:6b1e0f2a-93c4-4d7e-a1f5-2c8e9b7d4a31"
    }
    response = requests.post(apiUrl, headers=headers, json=data)
    print(response, response.json())
    
Try It