Attachments API

The Attachments API facilitates uploading, downloading, and deleting files associated with specific entities, providing a seamless file management solution for your site.

Upload Attachment

  • To upload an attachment, send a POST request to the designated endpoint with necessary authentication Authorization and site identification X-SITE-ID headers.
  • Include the file to be uploaded in the form data, along with details of the related entity and site.
Endpoint

POST https://api.subsbase.io/attachments/upload

Headers
Authorization: Bearer <access_token>
Content-Type: multipart/form-data
X-SITE-ID: {your site Id}
Request Body
  • relatedEntity (form data): The related entity type to which the attachment is associated.
  • relatedEntityId (form data): The Id of the related entity to which the attachment is associated.
  • siteId (form data): The Id of the site.
Form Data
  • file: The file to be uploaded. Ensure the file path is correctly provided.

Download File

  • Download files associated with specific parameters by sending a GET request to the provided endpoint.
  • Include the necessary authentication Authorization and site identification X-SITE-ID headers along with the required parameters in the URL path.
Endpoint

GET https://api.subsbase.io/attachments/download/:siteId/:relatedEntity/:relatedEntityId/:filename

Headers
Authorization: Bearer <access_token>
X-SITE-ID: {your site id}
Request Parameters
  • siteId (path): The Id of the site.
  • relatedEntity (path): The related entity type associated with the fil (e.g., Invoice, PaymentSchedule).
  • relatedEntityId (path): The Id of the related entity associated with the file.
  • filename (path): The name of the file to download.

Delete File

  • Delete files associated with specific parameters by sending a DELETE request to the designated endpoint.
  • Include the required authentication Authorization and site identification X-SITE-ID header, along with the parameters specifying the file to delete.
Endpoint

DELETE https://api.subsbase.io/attachments/:siteId/:relatedEntity/:relatedEntityId/:filename

Headers
Authorization: Bearer <access_token>
X-SITE-ID: {your site id}
Request Parameters
  • siteId (path): The ID of the site.
  • relatedEntity (path): The related entity type associated with the file.
  • relatedEntityId (path): The Id of the related entity associated with the file.
  • filename (path): The UUID of the file to delete.