Skip to content

UploadDoc

Attaches one file to a record other than a job or a work order: an asset, a bill, a receipt, an invoice, a quotation, a user, a yard move or an activity. The file then appears with the record’s files in TrakIT, for example on a bill’s Files tab. For the documents of a job or a work order, use UploadJobDoc.

How to sign in and read the response: Authentication, Responses.

Send the request as multipart/form-data, with the parts below and the file.

POST /api/v1/UploadDoc
Token: your-token
Content-Type: multipart/form-data; boundary=...
Part Required Meaning
Ref Yes The kind of record, from the table below. Not case-sensitive.
RefID Yes The record’s ID, a whole number.
Title No The file’s title, up to 300 characters. Without it, the title is the file name without its extension.
The file Yes The file itself, in a file part of any name, for example file.

Send one file per request: if the request has several, only the first is saved.

Ref RefID Where the file appears
asset The asset’s ID. The asset’s Asset Files tab
bill The bill’s ID. The bill’s Files tab
receipt The receipt’s ID. The receipt’s Documents tab
invoice The invoice’s ID. The invoice’s Files tab
quotation The quotation’s ID. The quotation’s Documents tab
user The user’s internal number, not the User ID. The user’s User Files tab
yardmove The yard move’s ID. The move’s Files tab
activity The activity’s ID. The activity’s Activity Files tab
Rule Info when it fails
The request has a file. No Files Found
The file is not of a type that TrakIT always refuses, such as a program. Cannot upload this file type
The file is not empty. File size is zero
The file is at most 20 MB. File size cannot exceed 20MB
The file is of a type TrakIT accepts. The list is set for each TrakIT installation; by default it is PNG, JPG, JPEG, PDF, DOCX, XLSX and TIF. File extension not allowed
The file name is at most 300 characters. File name cannot exceed 300 characters
Ref is given. Parameter Ref is missing
RefID is given, as a number. Parameter RefID is missing, Parameter RefID must be a number
Ref is one of the values above. Ref is invalid
The record exists. Reference object doesn't exist
The record has no file of the same name and size yet. A file of the same name and size already exists
The title is at most 300 characters. Unable to add attachment

On success, Code is 1 and Identity is the new file’s ID. RetInfo is null, and RowsAffected and Scalar are not used.

{
"Code": 1,
"Info": "",
"RetInfo": null,
"RowsAffected": 0,
"Scalar": null,
"Identity": 195301
}

With curl:

Terminal window
curl -H "Token: your-token" -F "Ref=bill" -F "RefID=109827" -F "Title=Delivery note" -F "file=@delivery-note.pdf" https://trakit.example.com/api/v1/UploadDoc

Replace https://trakit.example.com with your TrakIT address.

  • The file is for internal users only. On a bill, for example, it is not marked External, so the supplier does not see it in the portal.
  • The API user is shown as the person who uploaded it.
  • PNG and JPG images larger than the installation’s maximum image size (800 pixels on the longer side by default) are scaled down when they are saved.
  • Sending the same file again is refused with A file of the same name and size already exists, so a retry cannot add it twice.