Method: documents.create

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.

HTTP request

POST https://docs.googleapis.com/v1/documents

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "documentId": string,
  "title": string,
  "body": {
    object (Body)
  },
  "headers": {
    string: {
      object (Header)
    },
    ...
  },
  "footers": {
    string: {
      object (Footer)
    },
    ...
  },
  "footnotes": {
    string: {
      object (Footnote)
    },
    ...
  },
  "documentStyle": {
    object (DocumentStyle)
  },
  "suggestedDocumentStyleChanges": {
    string: {
      object (SuggestedDocumentStyle)
    },
    ...
  },
  "namedStyles": {
    object (NamedStyles)
  },
  "suggestedNamedStylesChanges": {
    string: {
      object (SuggestedNamedStyles)
    },
    ...
  },
  "lists": {
    string: {
      object (List)
    },
    ...
  },
  "namedRanges": {
    string: {
      object (NamedRanges)
    },
    ...
  },
  "revisionId": string,
  "suggestionsViewMode": enum (SuggestionsViewMode),
  "inlineObjects": {
    string: {
      object (InlineObject)
    },
    ...
  },
  "positionedObjects": {
    string: {
      object (PositionedObject)
    },
    ...
  }
}
Fields
documentId

string

Output only. The ID of the document.

title

string

The title of the document.

body

object (Body)

Output only. The main body of the document.

headers

map (key: string, value: object (Header))

Output only. The headers in the document, keyed by header ID.

footers

map (key: string, value: object (Footer))

Output only. The footers in the document, keyed by footer ID.

footnotes

map (key: string, value: object (Footnote))

Output only. The footnotes in the document, keyed by footnote ID.

documentStyle

object (DocumentStyle)

Output only. The style of the document.

suggestedDocumentStyleChanges

map (key: string, value: object (SuggestedDocumentStyle))

Output only. The suggested changes to the style of the document, keyed by suggestion ID.

namedStyles

object (NamedStyles)

Output only. The named styles of the document.

suggestedNamedStylesChanges

map (key: string, value: object (SuggestedNamedStyles))

Output only. The suggested changes to the named styles of the document, keyed by suggestion ID.

lists

map (key: string, value: object (List))

Output only. The lists in the document, keyed by list ID.

namedRanges

map (key: string, value: object (NamedRanges))

Output only. The named ranges in the document, keyed by name.

revisionId

string

Output only. The revision ID of the document. Can be used in update requests to specify which revision of a document to apply updates to and how the request should behave if the document has been edited since that revision. Only populated if the user has edit access to the document.

The revision ID is not a sequential number but an opaque string. The format of the revision ID might change over time. A returned revision ID is only guaranteed to be valid for 24 hours after it has been returned and cannot be shared across users. If the revision ID is unchanged between calls, then the document has not changed. Conversely, a changed ID (for the same document and user) usually means the document has been updated. However, a changed ID can also be due to internal factors such as ID format changes.

suggestionsViewMode

enum (SuggestionsViewMode)

Output only. The suggestions view mode applied to the document.

Note: When editing a document, changes must be based on a document with SUGGESTIONS_INLINE.

inlineObjects

map (key: string, value: object (InlineObject))

Output only. The inline objects in the document, keyed by object ID.

positionedObjects

map (key: string, value: object (PositionedObject))

Output only. The positioned objects in the document, keyed by object ID.

Response body

If successful, the response body contains a newly created instance of Document.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/documents
  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.file

For more information, see the Authorization guide.