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 except GET /v2/legal-entities, which lists the ids a user API key can send here: those of every 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, invoice_logo for invoice settings. Send it before file.

Available options:
bill_invoice,
accounting_receipt,
invoice_logo
file
file

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.

A file stored on Slash, uploaded through the API or generated by Slash. 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, or 0 for files Slash generated.

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 generated.

Available options:
bill_invoice,
accounting_receipt,
invoice_logo
Example:

"bill_invoice"