Skip to content
Scalekit Docs
Talk to an EngineerDashboard

Google Docs connector

OAuth 2.0Files & Documents

Connect to Google Docs. Create, edit, and collaborate on documents

Google Docs connector

  1. Terminal window
    npm install @scalekit-sdk/node

    Full SDK reference: Node.js | Python

  2. 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. Register your Google Docs credentials with Scalekit so it handles the token lifecycle. You do this once per environment.

    Dashboard setup steps

    Register your Scalekit environment with the Google Docs connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Google Docs and click Create. Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Navigate to Google Cloud ConsoleAPIs & ServicesCredentials. Select + Create Credentials, then OAuth client ID. Choose Web application from the Application type menu.

        Select Web Application in Google OAuth settings

      • Under Authorized redirect URIs, click + Add URI, paste the redirect URI, and click Create.

        Add authorized redirect URI in Google Cloud Console

    2. Enable the Google Docs API

      • In Google Cloud Console, go to APIs & ServicesLibrary. Search for “Google Docs API” and click Enable.
    3. Get client credentials

      • Google provides your Client ID and Client Secret after you create the OAuth client ID in step 1.
    4. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      • Enter your credentials:

        Add credentials in Scalekit dashboard

      • Click Save.

  4. quickstart.ts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENV_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'googledocs'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Google Docs:', link)
    process.stdout.write('Press Enter after authorizing...')
    await new Promise(r => process.stdin.once('data', r))
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'googledocs_list_documents',
    toolInput: {},
    })
    console.log(result)

Connect this agent connector to let your agent:

  • Style apply text — Apply character formatting (bold, italic, underline, strikethrough, font size) to a range of text in a Google Doc
  • Document copy, export — Duplicate a Google Doc
  • Create comment, document, named range — Add a comment to a Google Doc
  • Delete comment, content range, named range — Permanently delete a comment from a Google Doc
  • Image insert inline — Insert an inline image from a publicly accessible URL into a Google Doc
  • Break insert page — Insert a page break into a Google Doc
Proxy API call
const result = await actions.request({
connectionName: 'googledocs',
identifier: 'user_123',
path: '/v1/documents/<DOCUMENT_ID>',
method: 'GET',
});
console.log(result);
googledocs_create_document

Create a new blank Google Doc with an optional title. Returns the new document’s ID and metadata.

NameTypeRequiredDescription
schema_versionstringNoOptional schema version to use for tool execution
titlestringNoTitle of the new document
tool_versionstringNoOptional tool version to use for execution
googledocs_read_document

Read the complete content and structure of a Google Doc including text, formatting, tables, and metadata.

NameTypeRequiredDescription
document_idstringYesThe ID of the Google Doc to read
schema_versionstringNoOptional schema version to use for tool execution
suggestions_view_modestringNoHow suggestions are rendered in the response
tool_versionstringNoOptional tool version to use for execution
googledocs_update_document

Update the content of an existing Google Doc using batch update requests. Supports inserting and deleting text, formatting, tables, and other document elements.

NameTypeRequiredDescription
document_idstringYesThe ID of the Google Doc to update
requestsarray<object>YesArray of update requests to apply to the document
schema_versionstringNoOptional schema version to use for tool execution
tool_versionstringNoOptional tool version to use for execution
write_controlobjectNoOptional write control for revision management
Execute a tool
const result = await actions.executeTool({
connector: 'googledocs',
identifier: 'user_123',
toolName: 'googledocs_create_document',
toolInput: {},
});
console.log(result);
Google OAuth consent screen verification

Before you use your own Google OAuth credentials in production, understand what end users see on Google’s consent screen when they authorize a connected account.

Audience typeConsent screen behaviorWhen to use
InternalShows your App Name and logo from Branding settingsOnly users in your Google Workspace or Cloud Identity organization can authorize the connector
ExternalShows {env_name}.scalekit.dev until Google verifies your appAny user with a Google account can authorize the connector

Why External is required for most AgentKit connectors:

  • Internal restricts authorization to users in your Google Workspace or Cloud Identity organization. Users with @gmail.com or other Google accounts outside your organization cannot complete OAuth.
  • External is required when end users outside your organization authorize tool access through connected accounts.
  • Organization-managed OAuth clients follow the same rules as personal or developer OAuth clients. Switching to an org-owned client does not bypass Google verification.
  • Until Google completes verification of your External app, users see scalekit.dev on the consent screen. After verification, your App Name and logo appear.

During development:

  • Add Test users under APIs & Services → OAuth consent screen while publishing status is Testing.
  • On unverified apps, users can click Advanced → Go to app (unsafe) to proceed during testing.
  • Google Workspace admins may need to allowlist your OAuth client.

For Google’s verification requirements and timeline, refer to Google’s OAuth consent screen verification guide.

Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.

googledocs_apply_text_style#Apply character formatting (bold, italic, underline, strikethrough, font size) to a range of text in a Google Doc. Only the attributes you set are changed.10 params

Apply character formatting (bold, italic, underline, strikethrough, font size) to a range of text in a Google Doc. Only the attributes you set are changed.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the range to format (exclusive)
start_indexintegerrequiredZero-based start index of the range to format (inclusive)
boldbooleanoptionalSet text to bold (true) or non-bold (false)
font_size_ptnumberoptionalFont size in points
italicbooleanoptionalSet text to italic (true) or non-italic (false)
schema_versionstringoptionalOptional schema version to use for tool execution
strikethroughbooleanoptionalSet text to struck through (true) or not (false)
tool_versionstringoptionalOptional tool version to use for execution
underlinebooleanoptionalSet text to underlined (true) or not (false)
googledocs_copy_document#Duplicate a Google Doc. Optionally rename the copy or place it in a specific Drive folder. Uses the Drive API and returns the new document's metadata.5 params

Duplicate a Google Doc. Optionally rename the copy or place it in a specific Drive folder. Uses the Drive API and returns the new document's metadata.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to copy
namestringoptionalName for the copied document. If omitted, the copy is named 'Copy of <original name>'.
parent_folder_idstringoptionalID of the destination folder for the copy. If omitted, the copy is placed in the same folder as the original.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_create_comment#Add a comment to a Google Doc. Comments are managed through the Drive API. Optionally anchor the comment to a quoted section of the document.4 params

Add a comment to a Google Doc. Comments are managed through the Drive API. Optionally anchor the comment to a quoted section of the document.

NameTypeRequiredDescription
contentstringrequiredThe plain-text content of the comment
document_idstringrequiredThe ID of the Google Doc to comment on
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_create_document#Create a new blank Google Doc with an optional title. Returns the new document's ID and metadata.3 params

Create a new blank Google Doc with an optional title. Returns the new document's ID and metadata.

NameTypeRequiredDescription
schema_versionstringoptionalOptional schema version to use for tool execution
titlestringoptionalTitle of the new document
tool_versionstringoptionalOptional tool version to use for execution
googledocs_create_named_range#Create a named range over a span of content in a Google Doc. Named ranges let you reference and update a region of the document later by name.6 params

Create a named range over a span of content in a Google Doc. Named ranges let you reference and update a region of the document later by name.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the range (exclusive)
namestringrequiredName for the range. Multiple ranges can share the same name.
start_indexintegerrequiredZero-based start index of the range (inclusive)
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_create_paragraph_bullets#Turn the paragraphs in a range into a bulleted or numbered list using a preset glyph pattern.6 params

Turn the paragraphs in a range into a bulleted or numbered list using a preset glyph pattern.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the paragraph range (exclusive)
start_indexintegerrequiredZero-based start index of the paragraph range (inclusive)
bullet_presetstringoptionalThe bullet glyph preset. Use a BULLET_* preset for unordered lists or a NUMBERED_* preset for ordered lists.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_delete_comment#Permanently delete a comment from a Google Doc. Comments are managed through the Drive API. This cannot be undone.4 params

Permanently delete a comment from a Google Doc. Comments are managed through the Drive API. This cannot be undone.

NameTypeRequiredDescription
comment_idstringrequiredThe ID of the comment to delete
document_idstringrequiredThe ID of the Google Doc that holds the comment
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_delete_content_range#Delete content between two character indexes in a Google Doc. The start index is inclusive and the end index is exclusive.5 params

Delete content between two character indexes in a Google Doc. The start index is inclusive and the end index is exclusive.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the range to delete (exclusive)
start_indexintegerrequiredZero-based start index of the range to delete (inclusive)
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_delete_named_range#Delete named ranges from a Google Doc. Provide a named range ID to remove one specific range, or a name to remove all ranges sharing that name. The underlying document content is not deleted.5 params

Delete named ranges from a Google Doc. Provide a named range ID to remove one specific range, or a name to remove all ranges sharing that name. The underlying document content is not deleted.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
namestringoptionalThe name of the range(s) to delete. All named ranges with this name are removed.
named_range_idstringoptionalThe ID of a specific named range to delete. Takes precedence over name when both are provided.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_delete_paragraph_bullets#Remove list bullets or numbering from the paragraphs in a range, converting them back to normal paragraphs.5 params

Remove list bullets or numbering from the paragraphs in a range, converting them back to normal paragraphs.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the paragraph range (exclusive)
start_indexintegerrequiredZero-based start index of the paragraph range (inclusive)
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_export_document#Export a Google Doc to another format such as PDF, plain text, HTML, Word (.docx), RTF, or EPUB. Uses the Drive API export endpoint. Exported files are limited to 10 MB.4 params

Export a Google Doc to another format such as PDF, plain text, HTML, Word (.docx), RTF, or EPUB. Uses the Drive API export endpoint. Exported files are limited to 10 MB.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to export
mime_typestringrequiredThe MIME type of the target export format
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_insert_inline_image#Insert an inline image from a publicly accessible URL into a Google Doc. Optionally set the image width and height in points. Provide an index to insert at that position, or omit it to append at the end of the document body.7 params

Insert an inline image from a publicly accessible URL into a Google Doc. Optionally set the image width and height in points. Provide an index to insert at that position, or omit it to append at the end of the document body.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
image_uristringrequiredPublicly accessible URL of the image to insert (PNG, JPEG, or GIF, max 50 MB / 25 megapixels)
height_ptnumberoptionalImage height in points
indexintegeroptionalZero-based character index at which to insert the image. Omit to append at the end of the document body.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
width_ptnumberoptionalImage width in points
googledocs_insert_page_break#Insert a page break into a Google Doc. Provide an index to insert at that position, or omit it to append at the end of the document body.4 params

Insert a page break into a Google Doc. Provide an index to insert at that position, or omit it to append at the end of the document body.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
indexintegeroptionalZero-based character index at which to insert the page break. Omit to append at the end of the document body.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_insert_table#Insert an empty table with the given number of rows and columns into a Google Doc. Provide an index to insert at that position, or omit it to append at the end of the document body.6 params

Insert an empty table with the given number of rows and columns into a Google Doc. Provide an index to insert at that position, or omit it to append at the end of the document body.

NameTypeRequiredDescription
columnsintegerrequiredNumber of columns in the table
document_idstringrequiredThe ID of the Google Doc to edit
rowsintegerrequiredNumber of rows in the table
indexintegeroptionalZero-based character index at which to insert the table. Omit to append at the end of the document body.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_insert_text#Insert text into a Google Doc at a specific location. Provide an index to insert at that position, or omit it to append at the end of the document body.5 params

Insert text into a Google Doc at a specific location. Provide an index to insert at that position, or omit it to append at the end of the document body.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
textstringrequiredThe text to insert
indexintegeroptionalZero-based character index at which to insert the text. Omit to append at the end of the document body.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_list_comments#List the comments on a Google Doc, including their replies and resolved status. Comments are managed through the Drive API. Supports pagination.7 params

List the comments on a Google Doc, including their replies and resolved status. Comments are managed through the Drive API. Supports pagination.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc whose comments to list
include_deletedbooleanoptionalWhether to include deleted comments. Deleted comments have their content and author stripped. Defaults to false.
page_sizeintegeroptionalMaximum number of comments to return per page (1-100, default 20)
page_tokenstringoptionalToken for retrieving the next page of results. Use the nextPageToken from a previous response.
schema_versionstringoptionalOptional schema version to use for tool execution
start_modified_timestringoptionalOnly return comments modified after this RFC 3339 timestamp
tool_versionstringoptionalOptional tool version to use for execution
googledocs_list_documents#List all Google Docs documents in the user's Drive. Optionally search by document name. Returns document IDs, names, and metadata with pagination support.4 params

List all Google Docs documents in the user's Drive. Optionally search by document name. Returns document IDs, names, and metadata with pagination support.

NameTypeRequiredDescription
order_bystringoptionalSort order for results. Examples: modifiedTime desc, name asc, createdTime desc
page_sizeintegeroptionalNumber of documents to return per page (max 1000, default 100)
page_tokenstringoptionalToken for retrieving the next page of results. Use the nextPageToken from a previous response.
querystringoptionalDrive search query to filter documents. Defaults to all Google Docs. To search by name, use: mimeType = 'application/vnd.google-apps.document' and trashed = false and name contains 'report'
googledocs_read_document#Read the complete content and structure of a Google Doc including text, formatting, tables, and metadata.4 params

Read the complete content and structure of a Google Doc including text, formatting, tables, and metadata.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to read
schema_versionstringoptionalOptional schema version to use for tool execution
suggestions_view_modestringoptionalHow suggestions are rendered in the response
tool_versionstringoptionalOptional tool version to use for execution
googledocs_replace_all_text#Find every occurrence of a text string in a Google Doc and replace it with new text. Useful for templating and bulk edits.6 params

Find every occurrence of a text string in a Google Doc and replace it with new text. Useful for templating and bulk edits.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
find_textstringrequiredThe exact text to search for
replace_textstringrequiredThe text to substitute for each match
match_casebooleanoptionalWhether the search is case-sensitive. Defaults to false.
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_reply_to_comment#Post a reply to an existing comment on a Google Doc. Comments and replies are managed through the Drive API.5 params

Post a reply to an existing comment on a Google Doc. Comments and replies are managed through the Drive API.

NameTypeRequiredDescription
comment_idstringrequiredThe ID of the comment to reply to
contentstringrequiredThe plain-text content of the reply
document_idstringrequiredThe ID of the Google Doc that holds the comment
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_resolve_comment#Resolve an open comment on a Google Doc by posting a resolving reply. Comments are managed through the Drive API. Optionally include reply text alongside the resolution.5 params

Resolve an open comment on a Google Doc by posting a resolving reply. Comments are managed through the Drive API. Optionally include reply text alongside the resolution.

NameTypeRequiredDescription
comment_idstringrequiredThe ID of the comment to resolve
document_idstringrequiredThe ID of the Google Doc that holds the comment
contentstringoptionalOptional reply text to post along with the resolution
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
googledocs_update_document#Update the content of an existing Google Doc using batch update requests. Supports inserting and deleting text, formatting, tables, and other document elements.5 params

Update the content of an existing Google Doc using batch update requests. Supports inserting and deleting text, formatting, tables, and other document elements.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to update
requestsarrayrequiredArray of update requests to apply to the document
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution
write_controlobjectoptionalOptional write control for revision management
googledocs_update_paragraph_style#Apply paragraph-level formatting to a range: set a named style such as a heading or title, and/or set text alignment. Use this to turn text into a heading.7 params

Apply paragraph-level formatting to a range: set a named style such as a heading or title, and/or set text alignment. Use this to turn text into a heading.

NameTypeRequiredDescription
document_idstringrequiredThe ID of the Google Doc to edit
end_indexintegerrequiredEnd index of the paragraph range (exclusive)
start_indexintegerrequiredZero-based start index of the paragraph range (inclusive)
alignmentstringoptionalParagraph alignment
named_style_typestringoptionalNamed paragraph style to apply (e.g. a heading level, title, or normal text)
schema_versionstringoptionalOptional schema version to use for tool execution
tool_versionstringoptionalOptional tool version to use for execution