Skip to main content

Upload file

Creates a signed URL to upload a file to Cogfy's bucket.

info

You should use the signedUrl result to upload the file later and then call the complete upload file endpoint on Cogfy's API

POST https://api.cogfy.com/collections/:collectionId/files

Path params

  • collectionId: The ID of the collection that the file will be uploaded to.

Request body

  • fieldId: The ID of the field that the file will be uploaded to.
  • recordId: The ID of the record that the file will be uploaded to.
  • file: Contains file information to be uploaded.
    • type: The type of the file.
    • name: The name of the file.
    • size: The file size in bytes.

Example JSON request

{
"fieldId": "eb070e5e-8dce-42a4-89d1-200bab77a97d",
"recordId": "1cd13c46-c053-4bc6-94ee-28327fff5886",
"file": {
"type": "pdf",
"name": "example.pdf",
"size": 234131
}
}

Response body

  • id: The unique identifier of the created file.
  • recordId: The ID of the record that the file will be uploaded to.
  • signedUrl: The created URL for the file in the bucket.
  • fields: The file metadata.