Exporting Folders to PDF

Export large folders to PDF asynchronously with the bulk operation endpoints.

This guide shows you how to export folders to PDF asynchronously: retrieve a folder ID, start the export job, poll its status, and download the PDF from the provided URL.

📘

When to use the async flow

This flow is for large folders that might time out when exported synchronously. To synchronously download a smaller folder, use the Get folder as PDF endpoint.

Step 1: Get the folder ID

Retrieve folder information with the folders endpoint. The optional search query parameter filters by folder name.

curl -u $GURU_USER:$GURU_TOKEN "https://api.getguru.com/api/v1/folders?search={folderName}"

The id in the response is what you need for the next step:

[
  {
    "id": "beb2e3af-41b8-4fc4-a832-26fa5f37a7ba",
    "name": "Example Folder",
    ...
  }
]

Step 2: Initiate the export job

Start the export with the bulk operation endpoint:

curl -X POST https://api.getguru.com/api/v1/folders/bulkop \
  -u $GURU_USER:$GURU_TOKEN \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
        "type": "export-folder-pdf"
    },
    "items": {
        "type": "id",
        "itemIds": [
            "beb2e3af-41b8-4fc4-a832-26fa5f37a7ba"
        ]
    }
  }'
FieldDescription
action.typeMust be export-folder-pdf.
items.typeid, to indicate you are passing folder IDs.
items.itemIdsAn array of the folder IDs you want to export.

Response

{
  "id": "3e9ffec6-fafd-4a00-8f59-fcba167d625d"
}

The id is the bulk operation ID you poll in the next step.

Step 3: Poll the status of the export job

curl -u $GURU_USER:$GURU_TOKEN https://api.getguru.com/api/v1/folders/bulkop/{bulkOperationId}

If you receive a 204 (No Content) HTTP status code, the operation has not yet completed; keep polling until the HTTP status is 200. When the operation succeeds, the statusCode in the response body is also 200. If the operation failed, the HTTP status is 200 but the body's statusCode contains an error code.

Response

{
  "id": "3e9ffec6-fafd-4a00-8f59-fcba167d625d",
  "items": [
    {
      "url": "https://content.api.getguru.com/files/dn/ca378610-68c6-4e7a-a7f1-7e42d2322fea",
      "statusCode": 200,
      "boardId": "beb2e3af-41b8-4fc4-a832-26fa5f37a7ba"
    }
  ]
}
FieldDescription
urlThe URL to download the exported PDF.
statusCodeThe status of the export operation (200 for success).
boardIdThe ID of the folder for this export. The field retains its legacy board naming.

Step 4: Download the exported PDF

Make a GET request to the url from the response, authenticating as usual:

curl -u $GURU_USER:$GURU_TOKEN -O https://content.api.getguru.com/files/dn/ca378610-68c6-4e7a-a7f1-7e42d2322fea