Assets

Uploads a file and creates an asset. An asset is a stored file that you can reference by ID elsewhere in the API.

For example, to attach a file to an invoice, upload it using this endpoint and pass the returned id in attachmentAssetIds when calling Create an invoice or Patch an invoice.

Sending the file

Send a multipart/form-data request containing one part named file.

The filename must use a supported extension, and the file part must have a supported Content-Type. We derive the asset's format and type from the file part's Content-Type, not from its filename extension.

The request must include a Content-Length header indicating the size of the multipart request body, in bytes. It must not exceed 10 MiB (10,485,760 bytes).

Images

  • jpg or jpeg with a Content-Type of image/jpeg
  • png with a Content-Type of image/png

Image files may be re-encoded to remove metadata.

Documents

  • pdf with a Content-Type of application/pdf

Binary files

  • csv with a Content-Type of text/csv
  • txt with a Content-Type of text/plain
  • md with a Content-Type of text/markdown
  • rtf with a Content-Type of application/rtf
  • doc with a Content-Type of application/msword
  • docx with a Content-Type of application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • xls with a Content-Type of application/vnd.ms-excel
  • xlsx with a Content-Type of application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • xlsm with a Content-Type of application/vnd.ms-excel.sheet.macroEnabled.12
  • odt with a Content-Type of application/vnd.oasis.opendocument.text
  • ods with a Content-Type of application/vnd.oasis.opendocument.spreadsheet
  • zip with a Content-Type of application/zip
post/assets

Request

  • Base URL
    https://sandbox.sequencehq.com/api
  • URL
    https://sandbox.sequencehq.com/api/assets
  • Auth
    none declared. Required headers: Authorization, Content-Length

Headers

Authorizationstring required

Your API credentials. Eg. Basic {credentials}.

Content-Lengthinteger required
Sequence-Version'2024-07-30'

Use this header to select an API version

Request body multipart/form-data

filestring binary required

Response

Created

idstring required

Unique ID for this asset.

createdBystring required

The ID of the asset creator. A Sequence user id or API key id, as identified by createdByType.

createdByType'SEQUENCE_USER' | 'API_CLIENT' required
type'IMAGE' | 'DOCUMENT' | 'BINARY' required
format'JPEG' | 'JPG' | 'PNG' | 'PDF' | 'CSV' | 'TXT' | 'RTF' | 'MD' | 'XLS' | 'XLSX' | 'XLSM' | 'DOC' | 'DOCX' | 'ZIP' | 'ODT' | 'ODS' required
fileNamestring required

Original filename provided when the asset was uploaded.

fileSizeBytesinteger required

Size of the stored file, in bytes. This may differ from the size of the uploaded file.

urlstring required

Signed URL for downloading the file. The URL expires one week after it is generated. Call Get an asset when you need a new URL.

createdAtstring required

The time at which this asset was created. Formatted as an ISO 8601 timestamp.

Example response

{
  "id": "e007e884-5100-4183-8355-4771865cb4dd",
  "createdBy": "94703530-1293-479b-bd37-ccad42fd9c8b",
  "createdByType": "SEQUENCE_USER",
  "type": "IMAGE",
  "format": "PNG",
  "fileName": "my-image.png",
  "fileSizeBytes": 12345,
  "url": "https://assets.sequencehq.com/1986c663-9ee9-4811-bfbf-57d2ad666096/images/e007e884-5100-4183-8355-4771865cb4dd.png?token=grhc3VtaoNLAifDBFXWYLHcNnK3XJHzFjZ4iMf78Ozg&expires=604800",
  "createdAt": "2023-11-27T12:00:00Z"
}

Changes