Skip to main content
POST
Upload a document

Authorizations

X-API-Key
string
header
required

User API key authentication. Create a key under Settings → API keys in the Slash dashboard (https://app.slash.com/global-settings/api-keys) and send the x-legal-entity header naming the legal entity to act on with every request. Keys scoped to a legal entity are rejected with 403 user_api_key_required.

Headers

The legal entity to act on. Required on every request; a user API key can act on any legal entity its user has access to.

Pattern: ^le_[a-zA-Z0-9]+$

Body

multipart/form-data
purpose
enum<string>
required

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

Available options:
bill_invoice,
accounting_receipt
file
file

The file to upload. PDF, PNG, or JPEG (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.

A file uploaded to Slash, owned by the user whose API key uploaded it. Until it's attached, only that user can read it; once attached to a bill or accounting entry, anyone who can see that bill or entry can. Attach it by id where its purpose is accepted; the file itself is fetched through downloadUrl.

id
string
required

Document id with the st_ prefix.

Example:

"st_2rj4l7hmrrrcv"

filename
string
required

The filename supplied at upload.

Example:

"invoice-4471.pdf"

contentType
string
required

MIME type detected from the file's bytes.

Example:

"application/pdf"

sizeBytes
integer
required

Size of the stored file in bytes.

Example:

48213

downloadUrl
string<uri>
required

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

createdAt
string<date-time>
required

When the document was uploaded.

purpose
enum<string>

What the document was uploaded for. Absent on files Slash stored for something else.

Available options:
bill_invoice,
accounting_receipt
Example:

"bill_invoice"