Quip Automation API Reference

This document provides sample calls for some common use cases for the Edit a Document API method. In the examples below, we use the HTML format for the document content. You can mix and match the examples based on your business needs. See the Edit a Document reference documentation for more details including a sample response and information about the section_id, location, data-live-app-id, and document_range fields.

Note: If you're a Virtual Private Cloud (VPC) customer, see the Access Rules for more information about URIs to use for your API calls.

Add an Item at the End of a List

In this example, the section_id belongs to an item at the end (location 2) of a bulleted or numbered list or checklist.

POST https://platform.quip.com/1/threads/edit-document
Content-Type: application/json
Authorization: Bearer ABCSampleAccessToken

{
    "thread_id": "vTYlBwL8UT85",
    "format": "html",
    "content": "<li>Expert recommendations</li>",
    "section_id": "HcDACAX1iOK",
    "location": 2
}

Here's how the list looks before and after the API call:

Before the call After the call
  • Customer feedback
  • Usage metrics
  • Customer feedback
  • Usage metrics
  • Expert recommendations
  • Add a Paragraph before Other Content

    In this example, the section_id belongs to a paragraph before (location 3) which another paragraph is added.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "XerkArZUfekP",
        "format": "html",
        "content": "<p>Here's the account information for Acme Company:</p>",
        "section_id": "HcDACAwByNQ",
        "location": 3
    }
    

    Here's how the paragraph looks before and after the API call:

    Before the call After the call

    This customer is on the west coast.

    Here's the account information for Acme Company:

    This customer is on the west coast.

    Add Multiple Paragraphs after Other Content

    In this example, the section_id belongs to a paragraph after (location 2) which multiple paragraphs are added.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "<p>Customers like Acme want more options.</p><p>They like personalized service.</p>",
        "section_id": "HcDACAJZEQf",
        "location": 2
    }
    

    Here's how the content looks before and after the API call:

    Before the call After the call

    Here's the account information for Acme Company:

    This customer is on the west coast.

    Here's the account information for Acme Company:

    This customer is on the west coast.

    Customers like Acme want more options.

    They like personalized service.

    Edit a Paragraph/Replace Content

    In this example, the section_id belongs to the paragraph that's edited/replaced (location 4). You can edit/replace a document range instead, by passing 8 into the location field. See the Edit a Document reference documentation for more information about the document_range field.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "<p>Customers like Acme want more choices. They want a buffet experience.</p>",
        "section_id": "HcDABAJZEQf",
        "location": 4
    }
    

    Here's how the paragraph looks before and after the API call:

    Before the call After the call

    Customers like Acme want more options.

    Customers like Acme want more choices. They want a buffet experience.

    Delete a Document Range

    In this example, the document_range belongs to the content (heading title Topic 2 - Prerequisites and content under that heading and its subheadings) that's deleted (location 9).

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "location": 9,
        "document_range": "Topic 2  - Prerequisites"
    }
    

    Here's how the content looks before and after the API call:

    Before the call After the call

    Topic 1 - Introduction

    Content under Topic 1.

    Topic 2 - Prerequisites

    Content under Topic 2.

    Subtopic 2.1

    Content under Subtopic 2.1.

    Subtopic 2.1.1

    Content under Subtopic 2.1.1.

    Topic 3 - Acceptance Criteria

    Content under Topic 3.

    Topic 1 - Introduction

    Content under Topic 1.

    Topic 3 - Acceptance Criteria

    Content under Topic 3.

    Add, Edit, or Replace Content in or Around a Document Range

    In this example, the document_range belongs to the content (heading title Topic 4 - Important Notes and content under that heading and its subheadings) that's edited/replaced (location 8). You can add content before or after a document range by passing 7 (before) or 6 (after) into the location field. See the Edit a Document reference documentation for more information about the document_range field.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "content": "<h2>Topic 4 - Considerations</h2><p>Our beta launch requires training users who speak multiple languages.</p>",
        "location": 8,
        "document_range": "Topic 4 - Important Notes"
    }
    

    Here's how the content looks before and after the API call:

    Before the call After the call

    Topic 4 - Important Notes

    Our beta launch requires user training.

    Topic 4 - Considerations

    Our beta launch requires training users who speak multiple languages.

    Add a Row to a Spreadsheet

    In this example, the section_id belongs to the row after (location 2) which another row is added.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "<tr><td>7</td><td>4,581</td><td>570</td></tr>",
        "section_id": "temp:C:dabc38cb2d6f789b426a14f31946",
        "location": 2
    }
    

    Here's how the spreadsheet looks before and after the API call:

    Before the call After the call
    Social media page likes in the past 3 months.
    83 75,914 35608
    94 2560 32569
    10 93387 9358
    Social media page likes in the past 3 months.
    83 75,914 35608
    94 2560 32569
    7 4,581 570
    10 93387 9358

    Edit a Cell in a Spreadsheet

    In this example, the section_id belongs to the cell that's edited/replaced (location 4).

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "98",
        "section_id": "temp:s:HcDACAFj25V_temp:C:HcD5aa735cfd0dd58e3eee0e5ef0",
        "location": 4
    }
    

    The table below shows how the spreadsheet looks before and after the API call. In this example, the first cell in the spreadsheet is edited:

    Before the call After the call
    Social media page likes in the past 3 months.
    83 75,914 35608
    94 2560 32569
    7 4,581 570
    10 93387 9358
    Social media page likes in the past 3 months.
    98 75,914 35608
    94 2560 32569
    7 4,581 570
    10 93387 9358

    Add a Live App after Other Content

    The data-live-app-id mentioned in the content field applies to the type of live app that's added. In this example, the live app is a calendar and the section_id belongs to a paragraph after (location 2) which the calendar is added. This scenario adds a calendar containing two events scheduled for 4 October 2021 and 18 October 2021.

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "<div data-live-app-id='AbNBjAC13no' \
                      data-live-app-payload='{\
                        \"events\":[\
                          {\
                            \"color\":\"GREEN\",\
                            \"dateRange\":{\"start\":\"2021-10-04\",\"end\":\"2021-10-04\"},\
                            \"content\":\"Kickoff Meeting\"\
                          },\
                          {\
                            \"color\":\"RED\",\
                            \"dateRange\":{\"start\":\"2021-10-18\",\"end\":\"2021-10-18\"},\
                            \"content\":\"Project Status\"\
                          }],\
                       \"displayMonth\":\"2021-10\"\
                      }'>\
                    </div>",
        "section_id": "HcDACAxeuYo",
        "location": 2
    }
    

    Here's how the content looks before and after the API call:

    Before the call After the call

    Let's start a customer satisfaction project.

    Edit Content in a Live App

    In this example, the section_id belongs to the cell in the live app that's edited/replaced (location 4). This scenario replaces the name of the calendar event "Kickoff Meeting" with "Project Kickoff".

    POST https://platform.quip.com/1/threads/edit-document
    Content-Type: application/json
    Authorization: Bearer ABCSampleAccessToken
    
    {
        "thread_id": "vTYlBwL8UT85",
        "format": "html",
        "content": "Project Kickoff",
        "section_id": "temp:C:HcDe5a29801dd43ce5b7d68c43f3",
        "location": 4
    }
    

    Here's how the content looks before and after the API call:

    Before the call After the call

    Summary of Additional Use Cases for Adding Live Apps

    Live App Type Summary of Use Case Sample HTML for Content Field
    Salesforce Record Add a Salesforce record
      <div data-live-app-id='XdJAjAN5Jbi' data-live-app-payload='{
        "record_id": "0013h00000C9tHJAAZ",
        "org_id": "00D3h000004XoQgEAK" }'>
      </div>
    
    Salesforce List Add a Salesforce record list
      <div data-live-app-id='QYUAjAGNxIo' data-live-app-payload='{
        "list_id": "00B3h000005lR7jEAE",
        "object_type": "Account",
        "org_id": "00D3h000004XoQgEAK" }'>
      </div>
    
    Salesforce List Add a Salesforce related list
      <div data-live-app-id='QYUAjAGNxIo' data-live-app-payload='{
        "record_id": "0013h00000Db6YAAAZ",
        "related_list_type": "Contact",
        "org_id": "00D3h000004XoQgEAK" }'>
      </div>
    
    Kanban Board Add a Kanban board with three columns:
    • To Do
    • In Progress
    • Completed
      <div data-live-app-id='KORAjAYHE50' data-live-app-payload='{
        "columns": [
            {
              "color": "RED",
              "headerContent": "To Do",
              "cards": [
                  {
                    "color": "RED",
                    "content": "First Card"
                  }
              ]
            },
            {
              "color": "YELLOW",
              "headerContent": "In Progress",
              "cards": [
                  {
                    "color": "YELLOW",
                    "content": "Second Card"
                  },
                  {
                    "color": "YELLOW",
                    "content": "New Card"
                  }
              ]
            },
            {
              "color": "BLUE",
              "headerContent": "Title",
              "cards": [
                  {
                    "color": "BLUE",
                    "content": ""
                  },
                  {
                    "color": "BLUE",
                    "content": "Third Card"
                  },
                  {
                    "color": "BLUE",
                    "content": "New Card"
                  }
              ]
            }
        ] }'>
      </div>
    
    Project Tracker Add a project tracker with five columns::
    • Project
    • Owner
    • Status
    • Deadline
    • Attachment
    <div data-live-app-id='JdGAjAc35Es' data-live-app-payload='{
      "columns": [
          {
            "content": "Project\\n",
            "type": "TEXT",
            "id": "0"
          },
          {
            "content": "Owner\\n",
            "type": "PERSON",
            "id": "1"
          },
          {
            "content": "Status\\n",
            "type": "STATUS",
            "id": "2",
            "options": [
                {
                  "label": "Upcoming",
                  "devName": "upcoming",
                  "color": "BLUE"
                },
                {
                  "label": "In Progress",
                  "devName": "in_progress",
                  "color": "YELLOW"
                },
                {
                  "label": "Complete",
                  "devName": "complete",
                  "color": "GREEN"
                }
            ]
          },
          {
            "content": "Deadline\\n",
            "type": "DATE",
            "id": "3"
          },
          {
            "content": "Attachment\\n",
            "type": "FILE",
            "id": "4"
          }
      ],
      "rows": [
          {
            "0": "Test\\n",
            "1": [
                "dFdAEAoma2c"
            ],
            "2": "upcoming",
            "3": 1605686400000,
            "4": null
          },
          {
            "0": "New Project\\n",
            "1": [],
            "2": null,
            "3": null,
            "4": null
          },
          {
            "0": "New Project\\n",
            "1": [],
            "2": null,
            "3": null,
            "4": null
          }
      ] }'>
    </div>
    

    See also

    Edit a Document reference documentation

    How Does Live Data Work in Quip?

    Live Apps Developer Guide