curl --request POST \
--url https://thirdparty.qonto.com/v2/transactions/{id}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Qonto-Idempotency-Key: <x-qonto-idempotency-key>' \
--form file='@example-file'import requests
url = "https://thirdparty.qonto.com/v2/transactions/{id}/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Qonto-Idempotency-Key": "<x-qonto-idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<% multipart/form-data file data %>');
const options = {
method: 'POST',
headers: {
'X-Qonto-Idempotency-Key': '<x-qonto-idempotency-key>',
Authorization: 'Bearer <token>'
}
};
options.body = form;
fetch('https://thirdparty.qonto.com/v2/transactions/{id}/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://thirdparty.qonto.com/v2/transactions/{id}/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<% multipart/form-data file data %>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Qonto-Idempotency-Key: <x-qonto-idempotency-key>"
],
]);
$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://thirdparty.qonto.com/v2/transactions/{id}/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<% multipart/form-data file data %>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Qonto-Idempotency-Key", "<x-qonto-idempotency-key>")
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://thirdparty.qonto.com/v2/transactions/{id}/attachments")
.header("X-Qonto-Idempotency-Key", "<x-qonto-idempotency-key>")
.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<% multipart/form-data file data %>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://thirdparty.qonto.com/v2/transactions/{id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Qonto-Idempotency-Key"] = '<x-qonto-idempotency-key>'
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<% multipart/form-data file data %>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyUpload an attachment to a transaction
OAuth scope: attachment.write
Uploads a single attachment (JPEG, PNG or PDF) to the transaction identified by the id path parameter.
In the Qonto app, attachments are files uploaded onto transactions by users. Attachments typically correspond to the invoice or receipt, and are used to justify the transactions from a bookkeeping standpoint.
The uploaded file will be processed in the background. This means that the created attachment will not be visible immediately.
curl --request POST \
--url https://thirdparty.qonto.com/v2/transactions/{id}/attachments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'X-Qonto-Idempotency-Key: <x-qonto-idempotency-key>' \
--form file='@example-file'import requests
url = "https://thirdparty.qonto.com/v2/transactions/{id}/attachments"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-Qonto-Idempotency-Key": "<x-qonto-idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<% multipart/form-data file data %>');
const options = {
method: 'POST',
headers: {
'X-Qonto-Idempotency-Key': '<x-qonto-idempotency-key>',
Authorization: 'Bearer <token>'
}
};
options.body = form;
fetch('https://thirdparty.qonto.com/v2/transactions/{id}/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://thirdparty.qonto.com/v2/transactions/{id}/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<% multipart/form-data file data %>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"X-Qonto-Idempotency-Key: <x-qonto-idempotency-key>"
],
]);
$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://thirdparty.qonto.com/v2/transactions/{id}/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<% multipart/form-data file data %>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Qonto-Idempotency-Key", "<x-qonto-idempotency-key>")
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://thirdparty.qonto.com/v2/transactions/{id}/attachments")
.header("X-Qonto-Idempotency-Key", "<x-qonto-idempotency-key>")
.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<% multipart/form-data file data %>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://thirdparty.qonto.com/v2/transactions/{id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Qonto-Idempotency-Key"] = '<x-qonto-idempotency-key>'
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<% multipart/form-data file data %>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authorization header: Bearer <token>, where <token> is the access token received from the authorization server at the end of the OAuth 2.0 flow.
Headers
Required only for Sandbox API requests; to get one, please sign up to the Developer Portal.
Learn more in Idempotent Requests.
"123e4567-e89b-12d3-a456-426614174000"
Path Parameters
"2751a41c-c17f-43f7-bd18-04efa6cd8e30"
Body
You have to specify multipart form data in order to attach the file to the request. When using curl it will look like that:
curl --request POST \
--url https://thirdparty.qonto.com/v2/transactions/{id}/attachments \
-H "Content-Type: multipart/form-data" \
-H "Authorization: {Auth}" \
-F file="@path/to/a/file.jpg"
Response
Accepts the file and returns a success status code.
Was this page helpful?