Portant Portant Docs

Document

A Document represents a template configuration on a workflow. It points to a Google Drive file that gets copied to produce each output.

Fields

FieldTypeDescription
idStringThe ID of the document.
documentTypeStringThe template type. Either "GOOGLE_DOCS" or "GOOGLE_SLIDES", depending on the file selected.
fileGoogle FileThe Google Drive file used as the template. This file is copied to create the output document.
outputNameStringA templated string used to name each output created from this template.
createPDFCopyBooleanWhen true, Portant also creates a PDF copy of the output document.
removeOutputBooleanWhen true, the original output document (Google Docs or Slides) is removed after the PDF copy is created.
enablePdfPasswordBooleanWhen true, the generated PDF is encrypted with a password.
pdfPasswordStringA templated string used to generate the PDF password. Only used when enablePdfPassword is true.
PdfPasswordPreventCopyBooleanWhen true, content can't be copied from the password-protected PDF.
previewUrlStringA URL to the embedded editor used by non-Portant users to make changes to this document via source fields. Assumes the user can already access the underlying Google File.

Note: this feature is not yet implemented and may change.

Example

{
    "id": "doc_5LGGqC5S78RNS0",
    "documentType": "GOOGLE_DOCS",
    "file": {
        "id": "1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4",
        "name": "Complete Workflow Please - [Template]",
        "url": "https://docs.google.com/document/d/1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4/edit?usp=drivesdk",
        "mimeType": "application/vnd.google-apps.document"
    },
    "outputName": "Document for {{First Name}}",
    "createPdfCopy": true,
    "removeOutput": false,
    "enablePdfPassword": false,
    "pdfPassword": "Password-{{Secret Number}}",
    "pdfPasswordPreventCopy": false,
    "previewUrl": "https://preview.portant.co/doc_5LGGqC5S78RNS0"
}

Endpoints

List all documents for a workflow

GET /workflows/<wkf_id>/documents/

List all documents for a specific workflow.

Responses

Status Body
200 OK Array<Document>
403 Unauthorised Error

Create a document for a workflow

POST /workflows/<wkf_id>/documents/

Create a new document for the workflow.

Request

A create Document object as JSON.

The payload may include an optional file_id for a Google Drive file the requesting user has access to.

{
    file_id?: "1uNfBHAKhcgRsiftb7xRpTJRS0k9LY1iX1gUnTOE0zU4"
}

If you omit file_id, a new document is created from scratch.

Responses

Status Body
201 Created Document
400 Bad Request Error
403 Unauthorised Error

Get a document

GET /workflows/<wkf_id>/documents/<doc_id>/

Retrieve a specific document on a specific workflow.

Responses

Status Body
200 OK Document
403 Unauthorised Error

Update a document

PATCH /workflows/<wkf_id>/documents/<doc_id>/

Update a specific document by ID.

Request

A partial Document object as JSON. The payload may include any of the document's editable fields. The selected file can't be changed once a document is created.

{
    "outputName"?: "New outputName for {{First Name}}",
    "pdfPassword"?: "NewPassword-{{Secret Number}}",
    "enablePdfPassword"?: true,
    "enablePdfPreventCopy"?: true,
}

Responses

Status Body
200 OK Document
400 Bad Request Error
403 Unauthorised Error