curl --request POST \
--url https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"journal_entry_id": "<string>",
"original_name": "<string>",
"mime_type": "<string>",
"size": 123,
"uploaded_by": "<string>",
"uploaded_by_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Attach a document to an entry (organization)
Uploads a supporting document, such as an invoice scan, to a journal entry (organization space). Allowed even when the period is closed.
curl --request POST \
--url https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileimport requests
url = "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/accounting/organization/books/{journalEntry}/journal-entries/{journal_entry}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"journal_entry_id": "<string>",
"original_name": "<string>",
"mime_type": "<string>",
"size": 123,
"uploaded_by": "<string>",
"uploaded_by_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}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.
- 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.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the accounting book (the first path segment; the generated name is misleading). The entry is the second parameter, journal_entry.
Identifier of the journal entry (27-character KSUID).
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource 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.
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
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.
2048Response
Resource (only with response=resource).
Identifier of the document (27-character KSUID).
Identifier of the journal entry the document supports (27-character KSUID).
File name as sent at upload, shortened if it was too long.
Content type of the file, detected from its content (the declared type is used only when detection fails).
Size of the file in bytes.
Identifier of the member or agent account that uploaded the file; null when the actor could not be resolved.
Kind of the uploader (member or agent account); null when the actor could not be resolved.
Date and time the record was created (ISO 8601, UTC).