Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Google Docs Documents API
description: Reads and writes Google Docs documents.
version: v1
contact:
name: Google
url: https://google.com
x-twitter: youtube
license:
name: Creative Commons Attribution 3.0
url: http://creativecommons.org/licenses/by/3.0/
termsOfService: https://developers.google.com/terms/
servers:
- url: https://docs.googleapis.com
description: Google Docs API Server
tags:
- name: Documents
description: Operations related to Documents
paths:
/v1/documents:
post:
tags:
- Documents
summary: Google Post Documents
description: Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document.
operationId: docs.documents.create
security:
- Oauth2:
- https://www.googleapis.com/auth/documents
Oauth2c:
- https://www.googleapis.com/auth/documents
- Oauth2:
- https://www.googleapis.com/auth/drive
Oauth2c:
- https://www.googleapis.com/auth/drive
- Oauth2:
- https://www.googleapis.com/auth/drive.file
Oauth2c:
- https://www.googleapis.com/auth/drive.file
parameters:
- description: V1 error format.
in: query
name: $.xgafv
schema:
enum:
- '1'
- '2'
type: string
- description: OAuth access token.
in: query
name: access_token
schema:
type: string
- description: Data format for response.
in: query
name: alt
schema:
enum:
- json
- media
- proto
type: string
- description: JSONP
in: query
name: callback
schema:
type: string
- description: Selector specifying which fields to include in a partial response.
in: query
name: fields
schema:
type: string
- description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
in: query
name: key
schema:
type: string
- description: OAuth 2.0 token for the current user.
in: query
name: oauth_token
schema:
type: string
- description: Returns response with indentations and line breaks.
in: query
name: prettyPrint
schema:
type: boolean
- description: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
in: query
name: quotaUser
schema:
type: string
- description: Upload protocol for media (e.g. "raw", "multipart").
in: query
name: upload_protocol
schema:
type: string
- description: Legacy upload protocol for media (e.g. "media", "multipart").
in: query
name: uploadType
schema:
type: string
- in: header
name: Authorization
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Document'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Document'
x-api-evangelist-certified: '2025-07-20'
x-api-naftiko-published: '2025-07-20'
x-microcks-operation:
delay: 100
dispatcher: FALLBACK
dispatcherRules: SuccessExample
/v1/documents/{documentId}:
get:
tags:
- Documents
summary: Google Get Documents
description: Gets the latest version of the specified document.
operationId: docs.documents.get
security:
- Oauth2:
- https://www.googleapis.com/auth/documents
Oauth2c:
- https://www.googleapis.com/auth/documents
- Oauth2:
- https://www.googleapis.com/auth/documents.readonly
Oauth2c:
- https://www.googleapis.com/auth/documents.readonly
- Oauth2:
- https://www.googleapis.com/auth/drive
Oauth2c:
- https://www.googleapis.com/auth/drive
- Oauth2:
- https://www.googleapis.com/auth/drive.file
Oauth2c:
- https://www.googleapis.com/auth/drive.file
- Oauth2:
- https://www.googleapis.com/auth/drive.readonly
Oauth2c:
- https://www.googleapis.com/auth/drive.readonly
parameters:
- description: The ID of the document to retrieve.
in: path
name: documentId
required: true
schema:
type: string
- description: The suggestions view mode to apply to the document. This allows viewing the document with all suggestions inline, accepted or rejected. If one is not specified, DEFAULT_FOR_CURRENT_ACCESS is used.
in: query
name: suggestionsViewMode
schema:
enum:
- DEFAULT_FOR_CURRENT_ACCESS
- SUGGESTIONS_INLINE
- PREVIEW_SUGGESTIONS_ACCEPTED
- PREVIEW_WITHOUT_SUGGESTIONS
type: string
- description: V1 error format.
in: query
name: $.xgafv
schema:
enum:
- '1'
- '2'
type: string
- description: OAuth access token.
in: query
name: access_token
schema:
type: string
- description: Data format for response.
in: query
name: alt
schema:
enum:
- json
- media
- proto
type: string
- description: JSONP
in: query
name: callback
schema:
type: string
- description: Selector specifying which fields to include in a partial response.
in: query
name: fields
schema:
type: string
- description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
in: query
name: key
schema:
type: string
- description: OAuth 2.0 token for the current user.
in: query
name: oauth_token
schema:
type: string
- description: Returns response with indentations and line breaks.
in: query
name: prettyPrint
schema:
type: boolean
- description: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
in: query
name: quotaUser
schema:
type: string
- description: Upload protocol for media (e.g. "raw", "multipart").
in: query
name: upload_protocol
schema:
type: string
- description: Legacy upload protocol for media (e.g. "media", "multipart").
in: query
name: uploadType
schema:
type: string
- in: header
name: Authorization
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Document'
x-api-evangelist-certified: '2025-07-20'
x-api-naftiko-published: '2025-07-20'
x-microcks-operation:
delay: 100
dispatcher: FALLBACK
dispatcherRules: SuccessExample
/v1/documents/{documentId}:batchUpdate:
post:
tags:
- Documents
summary: Google Post Documents Batch Update
description: 'Applies one or more updates to the document. Each request is validated before being applied. If any request is not valid, then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. Other requests do not need to return information; these each return an empty reply. The order of replies matches that of the requests. For example, suppose you call batchUpdate with four updates, and only the third one returns information. The response would have two empty replies, the reply to the third request, and another empty reply, in that order. Because other users may be editing the document, the document might not exactly reflect your changes: your changes may be altered with respect to collaborator changes. If there are no collaborators, the document should reflect your changes. In any case, the updates in your request are guaranteed to be applied together atomically.'
operationId: docs.documents.batchUpdate
security:
- Oauth2:
- https://www.googleapis.com/auth/documents
Oauth2c:
- https://www.googleapis.com/auth/documents
- Oauth2:
- https://www.googleapis.com/auth/drive
Oauth2c:
- https://www.googleapis.com/auth/drive
- Oauth2:
- https://www.googleapis.com/auth/drive.file
Oauth2c:
- https://www.googleapis.com/auth/drive.file
parameters:
- description: The ID of the document to update.
in: path
name: documentId
required: true
schema:
type: string
- description: V1 error format.
in: query
name: $.xgafv
schema:
enum:
- '1'
- '2'
type: string
- description: OAuth access token.
in: query
name: access_token
schema:
type: string
- description: Data format for response.
in: query
name: alt
schema:
enum:
- json
- media
- proto
type: string
- description: JSONP
in: query
name: callback
schema:
type: string
- description: Selector specifying which fields to include in a partial response.
in: query
name: fields
schema:
type: string
- description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
in: query
name: key
schema:
type: string
- description: OAuth 2.0 token for the current user.
in: query
name: oauth_token
schema:
type: string
- description: Returns response with indentations and line breaks.
in: query
name: prettyPrint
schema:
type: boolean
- description: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
in: query
name: quotaUser
schema:
type: string
- description: Upload protocol for media (e.g. "raw", "multipart").
in: query
name: upload_protocol
schema:
type: string
- description: Legacy upload protocol for media (e.g. "media", "multipart").
in: query
name: uploadType
schema:
type: string
- in: header
name: Authorization
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/BatchUpdateDocumentRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/BatchUpdateDocumentResponse'
x-microcks-operation:
delay: 100
dispatcher: FALLBACK
dispatcherRules: SuccessExample
components:
schemas:
AutoText:
description: A ParagraphElement representing a spot in the text that's dynamically replaced with content that can change over time, like a page number.
properties:
suggestedDeletionIds:
description: The suggested deletion IDs. If empty, then there are no suggested deletions of this content.
items:
type: string
type: array
suggestedInsertionIds:
description: The suggested insertion IDs. An AutoText may have multiple insertion IDs if it's a nested suggested change. If empty, then this is not a suggested insertion.
items:
type: string
type: array
suggestedTextStyleChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedTextStyle'
description: The suggested text style changes to this AutoText, keyed by suggestion ID.
type: object
textStyle:
$ref: '#/components/schemas/TextStyle'
description: The text style of this AutoText.
type:
description: The type of this auto text.
enum:
- TYPE_UNSPECIFIED
- PAGE_NUMBER
- PAGE_COUNT
type: string
type: object
UpdateTextStyleRequest:
description: Update the styling of text.
properties:
fields:
description: The fields that should be updated. At least one field must be specified. The root `text_style` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example, to update the text style to bold, set `fields` to `"bold"`. To reset a property to its default value, include its field name in the field mask but leave the field itself unset.
format: google-fieldmask
type: string
range:
$ref: '#/components/schemas/Range'
description: The range of text to style. The range may be extended to include adjacent newlines. If the range fully contains a paragraph belonging to a list, the paragraph's bullet is also updated with the matching text style. Ranges cannot be inserted inside a relative UpdateTextStyleRequest.
textStyle:
$ref: '#/components/schemas/TextStyle'
description: The styles to set on the text. If the value for a particular style matches that of the parent, that style will be set to inherit. Certain text style changes may cause other changes in order to to mirror the behavior of the Docs editor. See the documentation of TextStyle for more information.
type: object
InsertSectionBreakRequest:
description: Inserts a section break at the given location. A newline character will be inserted before the section break.
properties:
endOfSegmentLocation:
$ref: '#/components/schemas/EndOfSegmentLocation'
description: Inserts a newline and a section break at the end of the document body. Section breaks cannot be inserted inside a footnote, header or footer. Because section breaks can only be inserted inside the body, the segment ID field must be empty.
location:
$ref: '#/components/schemas/Location'
description: Inserts a newline and a section break at a specific index in the document. The section break must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Section breaks cannot be inserted inside a table, equation, footnote, header, or footer. Since section breaks can only be inserted inside the body, the segment ID field must be empty.
sectionType:
description: The type of section to insert.
enum:
- SECTION_TYPE_UNSPECIFIED
- CONTINUOUS
- NEXT_PAGE
type: string
type: object
Paragraph:
description: A StructuralElement representing a paragraph. A paragraph is a range of content that's terminated with a newline character.
properties:
bullet:
$ref: '#/components/schemas/Bullet'
description: The bullet for this paragraph. If not present, the paragraph does not belong to a list.
elements:
description: The content of the paragraph, broken down into its component parts.
items:
$ref: '#/components/schemas/ParagraphElement'
type: array
paragraphStyle:
$ref: '#/components/schemas/ParagraphStyle'
description: The style of this paragraph.
positionedObjectIds:
description: The IDs of the positioned objects tethered to this paragraph.
items:
type: string
type: array
suggestedBulletChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedBullet'
description: The suggested changes to this paragraph's bullet.
type: object
suggestedParagraphStyleChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedParagraphStyle'
description: The suggested paragraph style changes to this paragraph, keyed by suggestion ID.
type: object
suggestedPositionedObjectIds:
additionalProperties:
$ref: '#/components/schemas/ObjectReferences'
description: The IDs of the positioned objects suggested to be attached to this paragraph, keyed by suggestion ID.
type: object
type: object
NamedStyle:
description: A named style. Paragraphs in the document can inherit their TextStyle and ParagraphStyle from this named style when they have the same named style type.
properties:
namedStyleType:
description: The type of this named style.
enum:
- NAMED_STYLE_TYPE_UNSPECIFIED
- NORMAL_TEXT
- TITLE
- SUBTITLE
- HEADING_1
- HEADING_2
- HEADING_3
- HEADING_4
- HEADING_5
- HEADING_6
type: string
paragraphStyle:
$ref: '#/components/schemas/ParagraphStyle'
description: The paragraph style of this named style.
textStyle:
$ref: '#/components/schemas/TextStyle'
description: The text style of this named style.
type: object
Person:
description: A person or email address mentioned in a document. These mentions behave as a single, immutable element containing the person's name or email address.
properties:
personId:
description: Output only. The unique ID of this link.
readOnly: true
type: string
personProperties:
$ref: '#/components/schemas/PersonProperties'
description: Output only. The properties of this Person. This field is always present.
readOnly: true
suggestedDeletionIds:
description: IDs for suggestions that remove this person link from the document. A Person might have multiple deletion IDs if, for example, multiple users suggest deleting it. If empty, then this person link isn't suggested for deletion.
items:
type: string
type: array
suggestedInsertionIds:
description: IDs for suggestions that insert this person link into the document. A Person might have multiple insertion IDs if it's a nested suggested change (a suggestion within a suggestion made by a different user, for example). If empty, then this person link isn't a suggested insertion.
items:
type: string
type: array
suggestedTextStyleChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedTextStyle'
description: The suggested text style changes to this Person, keyed by suggestion ID.
type: object
textStyle:
$ref: '#/components/schemas/TextStyle'
description: The text style of this Person.
type: object
BatchUpdateDocumentRequest:
description: Request message for BatchUpdateDocument.
properties:
requests:
description: A list of updates to apply to the document.
items:
$ref: '#/components/schemas/Request'
type: array
writeControl:
$ref: '#/components/schemas/WriteControl'
description: Provides control over how write requests are executed.
type: object
DeleteContentRangeRequest:
description: Deletes content from the document.
properties:
range:
$ref: '#/components/schemas/Range'
description: 'The range of content to delete. Deleting text that crosses a paragraph boundary may result in changes to paragraph styles, lists, positioned objects and bookmarks as the two paragraphs are merged. Attempting to delete certain ranges can result in an invalid document structure in which case a 400 bad request error is returned. Some examples of invalid delete requests include: * Deleting one code unit of a surrogate pair. * Deleting the last newline character of a Body, Header, Footer, Footnote, TableCell or TableOfContents. * Deleting the start or end of a Table, TableOfContents or Equation without deleting the entire element. * Deleting the newline character before a Table, TableOfContents or SectionBreak without deleting the element. * Deleting individual rows or cells of a table. Deleting the content within a table cell is allowed.'
type: object
SuggestedListProperties:
description: A suggested change to ListProperties.
properties:
listProperties:
$ref: '#/components/schemas/ListProperties'
description: A ListProperties that only includes the changes made in this suggestion. This can be used along with the list_properties_suggestion_state to see which fields have changed and their new values.
listPropertiesSuggestionState:
$ref: '#/components/schemas/ListPropertiesSuggestionState'
description: A mask that indicates which of the fields on the base ListProperties have been changed in this suggestion.
type: object
InsertTableColumnRequest:
description: Inserts an empty column into a table.
properties:
insertRight:
description: 'Whether to insert new column to the right of the reference cell location. - `True`: insert to the right. - `False`: insert to the left.'
type: boolean
tableCellLocation:
$ref: '#/components/schemas/TableCellLocation'
description: The reference table cell location from which columns will be inserted. A new column will be inserted to the left (or right) of the column where the reference cell is. If the reference cell is a merged cell, a new column will be inserted to the left (or right) of the merged cell.
type: object
List:
description: A List represents the list attributes for a group of paragraphs that all belong to the same list. A paragraph that's part of a list has a reference to the list's ID in its bullet.
properties:
listProperties:
$ref: '#/components/schemas/ListProperties'
description: The properties of the list.
suggestedDeletionIds:
description: The suggested deletion IDs. If empty, then there are no suggested deletions of this list.
items:
type: string
type: array
suggestedInsertionId:
description: The suggested insertion ID. If empty, then this is not a suggested insertion.
type: string
suggestedListPropertiesChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedListProperties'
description: The suggested changes to the list properties, keyed by suggestion ID.
type: object
type: object
CreateHeaderResponse:
description: The result of creating a header.
properties:
headerId:
description: The ID of the created header.
type: string
type: object
DeleteHeaderRequest:
description: Deletes a Header from the document.
properties:
headerId:
description: The id of the header to delete. If this header is defined on DocumentStyle, the reference to this header is removed, resulting in no header of that type for the first section of the document. If this header is defined on a SectionStyle, the reference to this header is removed and the header of that type is now continued from the previous section.
type: string
type: object
FootnoteReference:
description: A ParagraphElement representing a footnote reference. A footnote reference is the inline content rendered with a number and is used to identify the footnote.
properties:
footnoteId:
description: The ID of the footnote that contains the content of this footnote reference.
type: string
footnoteNumber:
description: The rendered number of this footnote.
type: string
suggestedDeletionIds:
description: The suggested deletion IDs. If empty, then there are no suggested deletions of this content.
items:
type: string
type: array
suggestedInsertionIds:
description: The suggested insertion IDs. A FootnoteReference may have multiple insertion IDs if it's a nested suggested change. If empty, then this is not a suggested insertion.
items:
type: string
type: array
suggestedTextStyleChanges:
additionalProperties:
$ref: '#/components/schemas/SuggestedTextStyle'
description: The suggested text style changes to this FootnoteReference, keyed by suggestion ID.
type: object
textStyle:
$ref: '#/components/schemas/TextStyle'
description: The text style of this FootnoteReference.
type: object
Background:
description: Represents the background of a document.
properties:
color:
$ref: '#/components/schemas/OptionalColor'
description: The background color.
type: object
BulletSuggestionState:
description: A mask that indicates which of the fields on the base Bullet have been changed in this suggestion. For any field set to true, there's a new suggested value.
properties:
listIdSuggested:
description: Indicates if there was a suggested change to the list_id.
type: boolean
nestingLevelSuggested:
description: Indicates if there was a suggested change to the nesting_level.
type: boolean
textStyleSuggestionState:
$ref: '#/components/schemas/TextStyleSuggestionState'
description: A mask that indicates which of the fields in text style have been changed in this suggestion.
type: object
Dimension:
description: A magnitude in a single direction in the specified units.
properties:
magnitude:
description: The magnitude.
format: double
type: number
unit:
description: The units for magnitude.
enum:
- UNIT_UNSPECIFIED
- PT
type: string
type: object
CreateFootnoteResponse:
description: The result of creating a footnote.
properties:
footnoteId:
description: The ID of the created footnote.
type: string
type: object
SectionStyle:
description: The styling that applies to a section.
properties:
columnProperties:
description: The section's columns properties. If empty, the section contains one column with the default properties in the Docs editor. A section can be updated to have no more than 3 columns. When updating this property, setting a concrete value is required. Unsetting this property will result in a 400 bad request error.
items:
$ref: '#/components/schemas/SectionColumnProperties'
type: array
columnSeparatorStyle:
description: The style of column separators. This style can be set even when there's one column in the section. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error.
enum:
- COLUMN_SEPARATOR_STYLE_UNSPECIFIED
- NONE
- BETWEEN_EACH_COLUMN
type: string
contentDirection:
description: The content direction of this section. If unset, the value defaults to LEFT_TO_RIGHT. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error.
enum:
- CONTENT_DIRECTION_UNSPECIFIED
- LEFT_TO_RIGHT
- RIGHT_TO_LEFT
type: string
defaultFooterId:
description: The ID of the default footer. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's default_footer_id. This property is read-only.
type: string
defaultHeaderId:
description: The ID of the default header. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's default_header_id. This property is read-only.
type: string
evenPageFooterId:
description: The ID of the footer used only for even pages. If the value of DocumentStyle's use_even_page_header_footer is true, this value is used for the footers on even pages in the section. If it is false, the footers on even pages use the default_footer_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's even_page_footer_id. This property is read-only.
type: string
evenPageHeaderId:
description: The ID of the header used only for even pages. If the value of DocumentStyle's use_even_page_header_footer is true, this value is used for the headers on even pages in the section. If it is false, the headers on even pages use the default_header_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's even_page_header_id. This property is read-only.
type: string
firstPageFooterId:
description: The ID of the footer used only for the first page of the section. If use_first_page_header_footer is true, this value is used for the footer on the first page of the section. If it's false, the footer on the first page of the section uses the default_footer_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's first_page_footer_id. This property is read-only.
type: string
firstPageHeaderId:
description: The ID of the header used only for the first page of the section. If use_first_page_header_footer is true, this value is used for the header on the first page of the section. If it's false, the header on the first page of the section uses the default_header_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's first_page_header_id. This property is read-only.
type: string
marginBottom:
$ref: '#/components/schemas/Dimension'
description: The bottom page margin of the section. If unset, the value defaults to margin_bottom from DocumentStyle. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error.
marginFooter:
$ref: '#/components/schemas/Dimension'
description: The footer margin of the section. If unset, the value defaults to margin_footer from DocumentStyle. If updated, use_custom_header_footer_margins is set to true on DocumentStyle. The value of use_custom_header_footer_margins on DocumentStyle indicates if a footer margin is being respected for this section When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error.
marginHeader:
$ref: '#/components/schemas/Dimension'
description: The header margin of the section. If unset, the value defaults to margin_header from DocumentStyle. If updated, use_custom_header_footer_margins is set to true on
# --- truncated at 32 KB (168 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/google/refs/heads/main/openapi/google-documents-api-openapi.yml