Help Center

Files

Cloud Pyrus
Cloudless Pyrus

Methods

GET /files/download/{file-id}

This method downloads file from Pyrus.

GET https://api.pyrus.com/v4/files/download/1334

Response headers

Content-Disposition: attachment; filename=test.txt
Content-Length: 12
Content-Type: application/octet-stream

Response body

file content

curl

curl -X GET \
  https://api.pyrus.com/v4/files/download/1334 \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json'

POST /files/upload

This method uploads files for subsequent attachment to tasks. Files that are not referenced by any task or article in the Knowledge Base are removed after a while.

POST https://api.pyrus.com/v4/files/upload

Request headers

Authorization: Bearer gAAA*****
Content-type: multipart/form-data; boundary=8d2f42366b41441
Content-Length: 5222

Request body

--8d2f42366b41441
Content-Disposition: form-data; name="file"; filename="filename.jpg"
Content-Type: application/octet-stream
//file body
--8d2f42366b41441--

Response body

{
  "guid": "08923d83-255b-4f18-b0eb-5c4d3b9bf1d2",
  "md5_hash": "cd4df826e3b9ce6e7895d8a31536d99d"
}

curl

curl -X POST \
  https://api.pyrus.com/v4/files/upload \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -F 'filename.jpg=@C:\Path\To\File\filename.jpg'

You will get the identifier of the uploaded file and its hash calculated by the MD5 algorithm. To attach the uploaded file to a task, use the add comment method and pass the obtained identifier into the attachments field.

In most programming languages or tools for sending REST API requests, such as curl or Postman, the correct request will be formed automatically if you specify the encoding type multipart/form-data when sending data. Thus, for a successful file upload, it is sufficient to specify your authorization key in the Authorization header, and the path to the file in the request body.

Upload exactly one file per request. If you need to upload multiple files, run the request multiple times accordingly. The maximum allowed file size is 2 GB.

Was this article helpful?