Upload a document

Changed on

Upload a PDF, PNG or JPEG of up to 25 MB as multipart/form-data.

post/v2/documents

Request

  • Base URL
    https://api.slash.com
  • URL
    https://api.slash.com/v2/documents
  • Auth
    API key in header X-API-Key

Request body multipart/form-data

purpose'bill_invoice' | 'accounting_receipt' | 'invoice_logo' required

What the file is for: bill_invoice for bills, accounting_receipt for accounting entries, invoice_logo for invoice settings. Send it before file.

filestring binary

The file to upload. PDF, PNG, or JPEG, and only PNG or JPEG for invoice_logo (HEIC is converted to JPEG). Required; a request without a file part is rejected with file_required.

Response

The uploaded document, with a downloadUrl for the stored file.

idstring required

Document id with the st_ prefix.

filenamestring required

The filename supplied at upload.

purpose'bill_invoice' | 'accounting_receipt' | 'invoice_logo'

What the document was uploaded for. Absent on files Slash generated.

contentTypestring required

MIME type detected from the file's bytes.

sizeBytesinteger required

Size of the stored file in bytes, or 0 for files Slash generated.

downloadUrlstring uri required

Presigned URL for the file. Valid for about 15 minutes; fetch the document again for a fresh one.

createdAtstring date-time required

When the document was uploaded.

Example response

{
  "id": "st_2rj4l7hmrrrcv",
  "filename": "invoice-4471.pdf",
  "purpose": "bill_invoice",
  "contentType": "application/pdf",
  "sizeBytes": 48213
}

Changes