Operations (sample payloads)
Main operationsCopy
Copy
Create empty documentCopy
Copy
Creates an empty google document with a given title
Sample Input
1{2"access_token": "ya29.a0AWY7CkmhU8j_kJq2xT1jH3yc5jRmTxZ9Oj2L3QX6ZvY1tG_Hs8Jk2I9X...",3"title": "Project Proposal 2023"4}
Sample Output
1{2"title": "Project Proposal 2023",3"body": {4"content": [5{6"endIndex": 1,7"sectionBreak": {8"sectionStyle": {9"columnSeparatorStyle": "NONE",10"contentDirection": "LEFT_TO_RIGHT"11}12},13"startIndex": 0,14"paragraph": {15"elements": [16{17"startIndex": 0,18"endIndex": 1,19"textRun": {20"content": "\n",21"textStyle": {}22}23}24],25"paragraphStyle": {26"namedStyleType": "NORMAL_TEXT",27"direction": "LEFT_TO_RIGHT"28}29}30}31]32},33"documentStyle": {34"background": {35"color": {}36},37"pageNumberStart": 1,38"marginTop": {39"magnitude": 72,40"unit": "PT"41},42"marginBottom": {43"magnitude": 72,44"unit": "PT"45},46"marginRight": {47"magnitude": 72,48"unit": "PT"49},50"marginLeft": {51"magnitude": 72,52"unit": "PT"53},54"pageSize": {55"height": {56"magnitude": 792,57"unit": "PT"58},59"width": {60"magnitude": 612,61"unit": "PT"62}63}64},65"namedStyles": {66"styles": [67{68"namedStyleType": "NORMAL_TEXT",69"textStyle": {70"foregroundColor": {71"color": {72"rgbColor": {73"red": 0,74"green": 0,75"blue": 076}77}78},79"bold": false,80"smallCaps": false,81"weightedFontFamily": {82"fontFamily": "Arial",83"weight": 40084},85"underline": false,86"fontSize": {87"magnitude": 11,88"unit": "PT"89},90"italic": false,91"strikethrough": false,92"backgroundColor": {},93"baselineOffset": "NONE"94},95"paragraphStyle": {96"alignment": "START",97"spacingMode": "COLLAPSE",98"lineSpacing": 115,99"direction": "LEFT_TO_RIGHT"100}101}102]103},104"revisionId": "ALm37BVKLhYqODXwQWEwjVIzMDc3NDU5Nzg4OTM6MTY4NTY0MDAwMDAwMA",105"suggestionsViewMode": "SUGGESTIONS_INLINE",106"documentId": "1AbCdEfGhIjKlMnOpQrStUvWxYz12345678"107}
Find and replaceCopy
Copy
Replaces all instances of text matching a given criteria.
Sample Input
1{2"access_token": "ya29.a0AfH6SMBgQjGkLxH1V...",3"document_id": "1Ax7vSD3jH2kLm9xY0pZfT...",4"requests": [5{6"replace_all_text": {7"replace_text": "Tray.io",8"contains_text": {9"text": "Zapier",10"match_case": true11}12}13}14]15}
Sample Output
1{2"replies": [3{4"replaceAllText": {5"occurrencesChanged": 56}7}8],9"writeControl": {10"requiredRevisionId": "ALm37BUeK..."11},12"documentId": "1Ax7vSD3jH2kLm9xY0pZfT..."13}
Get documentCopy
Copy
Retrieves a document with a given ID
Sample Input
1{2"access_token": "ya29.a0AWY7CkmhU8j_kJq6vHDYQWOHBzxxxxxxxxxxx",3"document_id": "1A2B3C4D5E6F7G8H9I0J1K2L3M4N5O6P7Q8R9S0T"4}
Sample Output
1{2"title": "Project Proposal",3"body": {4"content": [5{6"endIndex": 1,7"sectionBreak": {8"sectionStyle": {9"columnSeparatorStyle": "NONE",10"contentDirection": "LEFT_TO_RIGHT"11}12},13"startIndex": 014},15{16"endIndex": 15,17"paragraph": {18"elements": [19{20"endIndex": 15,21"startIndex": 0,22"textRun": {23"content": "Project Proposal",24"textStyle": {25"bold": true,26"fontSize": {27"magnitude": 18,28"unit": "PT"29}30}31}32}33],34"paragraphStyle": {35"namedStyleType": "HEADING_1",36"direction": "LEFT_TO_RIGHT"37}38},39"startIndex": 140}41]42},43"documentStyle": {44"background": {45"color": {}46},47"pageNumberStart": 1,48"marginTop": {49"magnitude": 72,50"unit": "PT"51},52"marginBottom": {53"magnitude": 72,54"unit": "PT"55},56"marginRight": {57"magnitude": 72,58"unit": "PT"59},60"marginLeft": {61"magnitude": 72,62"unit": "PT"63},64"pageSize": {65"height": {66"magnitude": 792,67"unit": "PT"68},69"width": {70"magnitude": 612,71"unit": "PT"72}73}74},75"namedStyles": {76"styles": [77{78"namedStyleType": "NORMAL_TEXT",79"textStyle": {80"foregroundColor": {81"color": {82"rgbColor": {83"red": 0,84"green": 0,85"blue": 086}87}88},89"fontSize": {90"magnitude": 11,91"unit": "PT"92},93"weightedFontFamily": {94"fontFamily": "Arial",95"weight": 40096}97},98"paragraphStyle": {99"namedStyleType": "NORMAL_TEXT",100"alignment": "LEFT",101"lineSpacing": 1.15,102"direction": "LEFT_TO_RIGHT"103}104}105]106},107"revisionId": "ALm37BVxxxxxxxx",108"suggestionsViewMode": "SUGGESTIONS_INLINE",109"documentId": "1A2B3C4D5E6F7G8H9I0J1K2L3M4N5O6P7Q8R9S0T"110}
Update documentCopy
Copy
Updates a google document with given fields
Sample Input
1{2"access_token": "ya29.a0AWY7CklhO1J3M2...",3"document_id": "1Ax7kj2xhJ3nGf5Y...",4"requests": [5{6"insert_text": {7"text": "Hello, this is a new paragraph.",8"location": {9"index": 110}11}12}13]14}
Sample Output
1{2"replies": [3{4"insertText": {5"insertedTextLength": 326}7}8],9"writeControl": {10"requiredRevisionId": "ALm37BVgT..."11},12"documentId": "1Ax7kj2xhJ3nGf5Y..."13}