Prerequisites

Before you can upload a file to Petal, you will need:

  1. Your bearer token and desired Workspace ID. They can be obtained as described here.
  2. Software that can use APIs, such as cURL or Python.

Upload a Document

The API endpoint for creating a Document is https://cite.petal.org/api/document/create. You will need to send a POST request to the endpoint with a multipart/form-data body containing three fields:

organization_id
integer

The ID of your Workspace/Organization

doctype
string

The extension of your document, e.g. pdf, docx, ppt

file
binary

The file you wish to upload

Below is an example of a Document creation POST request.

Remember to replace <token> with your own bearer token.
curl --location --request POST 'https://cite.petal.org/api/document/create' \
--header 'Authorization: Bearer <token>' \
--form 'doctype="xls"' \
--form 'organization_id="1"' \
--form 'file=@"/your/filepath/here/sample.xls"'