Enable ChatGPT to Read/Write in Coda: Solving the 404 Export Status Error

Dear Coda Support Team and Community Experts,

I am seeking assistance with an issue I’m facing while using the Coda API for exporting page content. I’m working on a Custom GPT using GPT Actions and OpenAPI schema to fully integrate any document into its custom GPT. I successfully listed pages and updated their content through an update action, using only the chat. However, when using the export action (for instance, when asking the chat to read a page’s content), I consistently encounter a 404 “Not Found” error when checking the export status, despite the .md file being available when manually downloading from the provided href. Could this be a robots.txt issue? Below, I’ve outlined the detailed process and the specific problem I’m facing.

Issue Summary:

We are experiencing a 404 “Not Found” error when checking the export status via the Coda API through chatGPT. We were able to list pages, update them, and export. However, we are having problems reading the contents of a page. Although the export initiation is successful, the status check fails to recognize the export ID.

The doc: Updated-First-Page

Steps to Reproduce:

  1. List Pages:

    • Successfully listed pages in the document.
    • Doc ID: pB_XX_QiAv
    • Page ID: canvas-y9wBS-aw7Q
    • Page Name: “Sub first”
  2. Initiate Export:

    • Endpoint: POST /docs/{docId}/pages/{pageIdOrName}/export
    • Request:
      {
        "docId": "pB_XX_QiAv",
        "pageIdOrName": "canvas-y9wBS-aw7Q",
        "outputFormat": "html"
      }
      
    • Response:
      {
        "id": "bd5635a2-4bfa-4bdc-9f21-37bd872e4502",
        "status": "inProgress",
        "href": "https://coda.io/apis/v1/docs/pB_XX_QiAv/pages/canvas-y9wBS-aw7Q/export/bd5635a2-4bfa-4bdc-9f21-37bd872e4502"
      }
      
  3. Check Export Status:

    • Endpoint: GET /exports/{exportId}
    • Request:
      {
        "exportId": "bd5635a2-4bfa-4bdc-9f21-37bd872e4502"
      }
      
    • Response:
      {
        "statusCode": 404,
        "statusMessage": "Not Found",
        "message": "Not Found"
      }
      

Issue Details:

  • The export process initiates correctly, returning an export ID.
  • When polling the export status using the provided export ID, the response is consistently a 404 error indicating the export ID is not found.
  • (Important) Manual download from the provided link in the export initiation response works successfully, confirming that the export itself completes but the status check via the API fails.

Additional Context:

I wish to provide my partners with a seamless experience without leaving the chat, for some specific types of activities, so I want to make sure it is possible to read/write a coda doc with a customGPT through actions.

Attempts to Resolve:

  • Repeated the export initiation and status check multiple times.
  • Verified the correctness of the docId, pageIdOrName, and exportId.
  • Ensured adequate delay between initiating the export and polling the status.

API Schema:

Below is the relevant part of the API schema being used:

openapi: 3.1.0
info:
  title: Coda API
  description: API for interacting with Coda documents, including listing pages, exporting page content, and updating page content.
  version: 1.0.0
servers:
  - url: https://coda.io/apis/v1
    description: Coda API Server
paths:
  /docs/{docId}/pages:
    get:
      operationId: listPages
      summary: List pages in a document
      parameters:
        - name: docId
          in: path
          required: true
          schema:
            type: string
            example: "yourDocId"
      responses:
        '200':
          description: List of pages in the document
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        type:
                          type: string
                        parentPageId:
                          type: string
  /docs/{docId}/pages/{pageIdOrName}/export:
    post:
      operationId: exportPage
      summary: Export page content
      parameters:
        - name: docId
          in: path
          required: true
          schema:
            type: string
            example: "yourDocId"
        - name: pageIdOrName
          in: path
          required: true
          schema:
            type: string
            example: "yourPageIdOrName"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                outputFormat:
                  type: string
                  enum:
                    - html
                    - markdown
                  example: "html"
      responses:
        '202':
          description: Export request accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  exportId:
                    type: string
                  href:
                    type: string
  /exports/{exportId}:
    get:
      operationId: getExportStatus
      summary: Get export status
      parameters:
        - name: exportId
          in: path
          required: true
          schema:
            type: string
            example: "yourExportId"
      responses:
        '200':
          description: Export status information
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  downloadLink:
                    type: string
        '404':
          description: Export not found or not ready yet
  /docs/{docId}/pages/{pageIdOrName}:
    put:
      operationId: updatePage
      summary: Update page content
      parameters:
        - name: docId
          in: path
          required: true
          schema:
            type: string
            example: "yourDocId"
        - name: pageIdOrName
          in: path
          required: true
          schema:
            type: string
            example: "yourPageIdOrName"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                contentUpdate:
                  type: object
                  properties:
                    insertionMode:
                      type: string
                      enum:
                        - replace
                        - append
                    canvasContent:
                      type: object
                      properties:
                        format:
                          type: string
                          enum:
                            - html
                            - markdown
                        content:
                          type: string
      responses:
        '200':
          description: Page updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  parentPageId:
                    type: string

Any insights or further steps to troubleshoot this issue would be greatly appreciated. Given that manual download from the provided link works, it seems the issue is specific togetExportStatus endpoint or something preventing the robot from accessing the href.

Thank you very much for your assistance.

Hey @Felipe_Griebel, we checked these same API calls from Postman by following the instructions on API documentation and everything seemed to be working fine.
First, we used POST to Begin content export and returned a 202 Accepted status.
Then, using the ID from the previous step we made a GET to check Content export status and returned a status 200 OK as shown here: Screen Recording on 2024-06-21 at 03-39-22.gif - Droplr

From what our team could tell, it’s looks like you’re doing this via ChatGPT, but we are unable to test in this way.

1 Like

Hi @Felipe_Griebel - There is a known issue with page content exports, where the export IDs aren’t immediately replicated to all of our servers, resulting in a 404 error if you request the status right after the export has started. Unfortunately the best solution at the moment is to introduce a small delay and/or add a retry with some backoff.

1 Like