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.

Scopes

You will need authorization for at least one of the following scopes to make a valid call:

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

If unset, the scope for this method defaults to https://www.googleapis.com/auth/documents. You can set the scope for this method like this: docs1 --scope <scope> documents create ...

Required Request Value

The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.

For example, a structure like this:

Document:
  document-id: string
  document-style:
    background:
      color:
        color:
          rgb-color:
            blue: number
            green: number
            red: number
    default-footer-id: string
    default-header-id: string
    even-page-footer-id: string
    even-page-header-id: string
    first-page-footer-id: string
    first-page-header-id: string
    flip-page-orientation: boolean
    margin-bottom:
      magnitude: number
      unit: string
    margin-footer:
      magnitude: number
      unit: string
    margin-header:
      magnitude: number
      unit: string
    margin-left:
      magnitude: number
      unit: string
    margin-right:
      magnitude: number
      unit: string
    margin-top:
      magnitude: number
      unit: string
    page-number-start: integer
    page-size:
      height:
        magnitude: number
        unit: string
      width:
        magnitude: number
        unit: string
    use-custom-header-footer-margins: boolean
    use-even-page-header-footer: boolean
    use-first-page-header-footer: boolean
  revision-id: string
  suggestions-view-mode: string
  title: string

can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.

  • -r . document-id=no
    • Output only. The ID of the document.
  • document-style.background.color.color.rgb-color blue=0.36584835924937553
    • The blue component of the color, from 0.0 to 1.0.
  • green=0.5857873539022715
    • The green component of the color, from 0.0 to 1.0.
  • red=0.16568728368878083

    • The red component of the color, from 0.0 to 1.0.
  • ..... default-footer-id=takimata

    • The ID of the default footer. If not set, there's no default footer. This property is read-only.
  • default-header-id=amet.
    • The ID of the default header. If not set, there's no default header. This property is read-only.
  • even-page-footer-id=duo
    • The ID of the footer used only for even pages. The value of use_even_page_header_footer determines whether to use the default_footer_id or this value for the footer on even pages. If not set, there's no even page footer. This property is read-only.
  • even-page-header-id=ipsum
    • The ID of the header used only for even pages. The value of use_even_page_header_footer determines whether to use the default_header_id or this value for the header on even pages. If not set, there's no even page header. This property is read-only.
  • first-page-footer-id=gubergren
    • The ID of the footer used only for the first page. If not set then a unique footer for the first page does not exist. The value of use_first_page_header_footer determines whether to use the default_footer_id or this value for the footer on the first page. If not set, there's no first page footer. This property is read-only.
  • first-page-header-id=lorem
    • The ID of the header used only for the first page. If not set then a unique header for the first page does not exist. The value of use_first_page_header_footer determines whether to use the default_header_id or this value for the header on the first page. If not set, there's no first page header. This property is read-only.
  • flip-page-orientation=false
    • Optional. Indicates whether to flip the dimensions of the page_size, which allows changing the page orientation between portrait and landscape.
  • margin-bottom magnitude=0.7615363125225725
    • The magnitude.
  • unit=ipsum

    • The units for magnitude.
  • ..margin-footer magnitude=0.1092883976212714

    • The magnitude.
  • unit=duo

    • The units for magnitude.
  • ..margin-header magnitude=0.39873905405496446

    • The magnitude.
  • unit=sed

    • The units for magnitude.
  • ..margin-left magnitude=0.5053930334687853

    • The magnitude.
  • unit=rebum.

    • The units for magnitude.
  • ..margin-right magnitude=0.34810194289930996

    • The magnitude.
  • unit=ipsum

    • The units for magnitude.
  • ..margin-top magnitude=0.4033695817113857

    • The magnitude.
  • unit=est

    • The units for magnitude.
  • .. page-number-start=39

    • The page number from which to start counting the number of pages.
  • page-size.height magnitude=0.6637488828437452
    • The magnitude.
  • unit=lorem

    • The units for magnitude.
  • ..width magnitude=0.5944568076620798

    • The magnitude.
  • unit=sed

    • The units for magnitude.
  • ... use-custom-header-footer-margins=false

    • Indicates whether DocumentStyle margin_header, SectionStyle margin_header and DocumentStyle margin_footer, SectionStyle margin_footer are respected. When false, the default values in the Docs editor for header and footer margin are used. This property is read-only.
  • use-even-page-header-footer=false
    • Indicates whether to use the even page header / footer IDs for the even pages.
  • use-first-page-header-footer=true

    • Indicates whether to use the first page header / footer IDs for the first page.
  • .. revision-id=stet

    • 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.
  • suggestions-view-mode=kasd
    • 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.
  • title=et
    • The title of the document.

About Cursors

The cursor position is key to comfortably set complex nested structures. The following rules apply:

  • The cursor position is always set relative to the current one, unless the field name starts with the . character. Fields can be nested such as in -r f.s.o .
  • The cursor position is set relative to the top-level structure if it starts with ., e.g. -r .s.s
  • You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify -r struct.sub_struct=bar.
  • You can move the cursor one level up by using ... Each additional . moves it up one additional level. E.g. ... would go three levels up.

Optional Output Flags

The method's return value a JSON encoded structure, which will be written to standard output by default.

  • -o out
    • out specifies the destination to which to write the server's result to. It will be a JSON-encoded structure. The destination may be - to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.

Optional General Properties

The following properties can configure any call, and are not specific to this method.

  • -p $-xgafv=string

    • V1 error format.
  • -p access-token=string

    • OAuth access token.
  • -p alt=string

    • Data format for response.
  • -p callback=string

    • JSONP
  • -p fields=string

    • Selector specifying which fields to include in a partial response.
  • -p key=string

    • 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.
  • -p oauth-token=string

    • OAuth 2.0 token for the current user.
  • -p pretty-print=boolean

    • Returns response with indentations and line breaks.
  • -p quota-user=string

    • 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.
  • -p upload-type=string

    • Legacy upload protocol for media (e.g. "media", "multipart").
  • -p upload-protocol=string

    • Upload protocol for media (e.g. "raw", "multipart").