canonical: https://jentic.com/apis/googleapis.com/docs

# Google Docs API

The Google Docs API lets applications read and write Google Docs documents programmatically. Three endpoints - create, get, and batchUpdate - cover document creation, structural retrieval, and a rich batchUpdate language for inserting text, applying styles, embedding images, managing tables, and moving content. Used for templated document generation (contracts, reports, briefs), AI-assisted authoring, and content pipelines that produce shareable Docs at scale.

## For AI agents

Create Google Docs and apply rich content edits - text, styles, images, tables - via batched structural updates.

## Scope

Does not handle file sharing, folder placement, or commenting - use for content authoring inside a Google Doc only; use Drive for file management.

## Capabilities

- Create a new Google Docs document with a starting title
- Retrieve the full structural representation of a document
- Insert and replace text at specific document indices
- Apply paragraph and character styles to ranges (headings, bold, links)
- Insert images, tables, and named ranges via batchUpdate
- Move and merge content while preserving styles

## Use cases

### Templated Document Generation

Operations teams generate contracts, reports, and briefs by creating a fresh Google Doc, then sending a single batchUpdate with insertText and replaceAllText requests to populate the template. The whole document - including styles, tables, and images - is built in one round-trip, so a 20-page customer report renders in seconds.

Example prompt: Create a Google Doc titled 'Q2 Customer Report - Acme Corp', then send a batchUpdate with insertText for the title heading, three section bodies, and an inline image at the top.

### Token Substitution in Existing Docs

Marketing and legal teams maintain master Docs with placeholders like {{ClientName}} or {{Date}}. The replaceAllText request in batchUpdate swaps every occurrence in one call without touching surrounding styles. The same Doc can be cloned (via Drive) and personalised in a few hundred milliseconds per recipient.

Example prompt: Send a batchUpdate to document 1abcXYZ with replaceAllText requests mapping {{ClientName}} to 'Acme Corp' and {{Date}} to '2026-06-10'.

### Programmatic Style Application

Pair documents.get with batchUpdate to read the structure, identify ranges (paragraphs, runs, tables), and apply consistent styling - heading levels, font choices, bold/italic, hyperlinks. Agencies use this to enforce brand styles across hundreds of imported Docs in one pipeline run.

Example prompt: Get document 1abcXYZ, find every paragraph whose text starts with 'Section', and send a batchUpdate that applies HEADING_2 paragraph style to those ranges.

### Agent-Authored Briefs and Memos

Through Jentic, an AI agent can take a structured brief (a JSON payload of headings, paragraphs, and bullets) and emit a finished Google Doc by calling documents.create followed by a single batchUpdate. Credentials are scoped per agent run by your Jentic One instance - Drive sharing happens separately via the Drive API.

Example prompt: Use Jentic to search 'create a Google Doc and add content', load the schemas for documents.create and documents.batchUpdate, then build a Doc with a title, three headings, and three body paragraphs from a JSON brief.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/documents | Create a new Google Doc |
| GET | /v1/documents/{documentId} | Get the full structure of a Google Doc |
| POST | /v1/documents/{documentId}:batchUpdate | Apply a batched set of structural edits |

## Key resources

- **documents** — Create, get, and apply batched structural updates to Google Docs documents

## Why Jentic

- **Setup:** Wiring the Google Docs API by hand means standing up Google OAuth2 with the right scopes, targeting docs.googleapis.com, and building the batchUpdate request bodies yourself for content authoring. Through Jentic you install once, import the Google Docs API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Google Docs puts the document id in the URL path (/v1/documents/{documentId}), so a rule can pin your agent to one document: it can read that document and apply batch updates to it and nothing else. You choose the operations it may call, so creating new documents is not included unless you add it.
- **Credential handling:** Your Google OAuth credential for Google Docs is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'insert text into a Google Doc' or 'read a document's content', and Jentic returns the matching Google Docs operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Drive API** — Manages file placement, sharing, and permissions for Docs
- **Google Sheets API** — Spreadsheet equivalent of Docs for tabular data
- **Google Slides API** — Presentation equivalent - same batchUpdate model applied to slides

## FAQ

### What authentication does the Google Docs API use?

OAuth 2.0 with the documents or documents.readonly scope (and drive scopes for sharing). Through Jentic, OAuth tokens are scoped per agent run and stored encrypted in your Jentic One instance, so service-account JSON keys never enter the agent runtime.

### Can I insert text and images into an existing Doc?

Yes. Send a batchUpdate to /v1/documents/{documentId}:batchUpdate with a list of requests including insertText, insertInlineImage, insertTable, and updateParagraphStyle. The whole edit applies in one transaction.

### What are the rate limits for the Google Docs API?

Google Docs enforces a default of 300 read requests and 60 write requests per minute per user, plus daily project quotas. Heavy batchUpdate calls count once toward write quota even if they include many sub-requests.

### How do I create a new Google Doc through Jentic?

Search 'create a Google Doc', load the schema for /v1/documents (POST), then execute it with a title in the request body. Jentic returns the new document ID, which you then use in subsequent batchUpdate calls.

### Does the Google Docs API let me share or move documents?

No. Sharing, folder placement, and ownership transfers are managed through the Google Drive API, not the Docs API. Use Drive's permissions and files endpoints for those actions.

### Is the Google Docs API free?

Yes. The Docs API has no per-call charge for standard usage within quota - you pay only if you have a Google Workspace subscription for the underlying account, and there is no separate API metering.

### Can I limit what my agent is allowed to do with the Google Docs API?

Yes. Because you run Jentic One yourself, your own rules decide which Google Docs operations and credentials the agent may use. Since the Google Docs API carries the document id in the URL path (/v1/documents/{documentId}), a rule can pin the agent to a single document so it can only read that document and apply batchUpdate edits to it and nothing else. Creating new documents is opt-in, so documents.create stays off unless you explicitly allow it.
