POST
Attach a document to an entry (organization)
Organization space Accounting module For: Accountant · Permission: entry_attachments.create Conditions
  • The accounting module must be included in the plan of the organization.
  • In the organization space the caller needs an accounting access grant on the book named in the URL.
  • The book must be set up for accounting (it must have at least one journal).
  • The journal entry must belong to the selected book.
  • The file field is required and must be one uploaded file of at most 2 MB (2048 KB).
  • The file content must be a PDF, PNG, JPEG, WebP, CSV, text or XLSX file, and its name must end in pdf, png, jpg, jpeg, webp, csv or xlsx (a .txt name is refused).
  • The entry status and its fiscal period do not restrict the upload: a document can be attached to a reversed entry or to an entry of a closed period.
What else happens
  • Stores the file on the private attachments disk under accounting/attachments/<entry id>.
  • Creates a document record with the original file name (shortened if too long), the detected MIME type, the size in bytes and the uploader (member or agent account) when known.
  • The attachments_count shown on the journal entry, counted when the entry is read, includes the new document; the entry itself and the books are not changed.
Part of Record and correct entries.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

journalEntry
string
required

Identifier of the accounting book (the first path segment; the generated name is misleading). The entry is the second parameter, journal_entry.

journal_entry
string
required

Identifier of the journal entry (27-character KSUID).

Query Parameters

response
enum<string>
default:none

Response mode. Default none; none answers 204 No Content.

Available options:
none,
resource
fields
string

Comma-separated JSON keys of the root resource (id is always rendered). Available: id, journal_entry_id, original_name, mime_type, size, uploaded_by, uploaded_by_type, created_at.

include
string

Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: .

Body

multipart/form-data
file
file
required

File to attach to the entry. Required. At most 2 MB, in pdf, png, jpg, jpeg, webp, csv or xlsx format; the file name must end with one of these extensions.

Maximum string length: 2048

Response

Resource (only with response=resource).

id

Identifier of the document (27-character KSUID).

journal_entry_id

Identifier of the journal entry the document supports (27-character KSUID).

original_name

File name as sent at upload, shortened if it was too long.

mime_type

Content type of the file, detected from its content (the declared type is used only when detection fails).

size
integer

Size of the file in bytes.

uploaded_by

Identifier of the member or agent account that uploaded the file; null when the actor could not be resolved.

uploaded_by_type

Kind of the uploader (member or agent account); null when the actor could not be resolved.

created_at

Date and time the record was created (ISO 8601, UTC).