curl --request POST \
--url https://thirdparty.qonto.com/v2/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/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/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/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/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/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/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_body{
"attachment": {
"id": "71c32755-d0c3-4d82-9a78-774caa9d8556"
}
}Upload an attachment
OAuth scope: attachment.write
Uploads a single attachment (JPEG, PNG or PDF).
The result of the upload (attachment_id) can later be used to Create supplier invoices, Create a SEPA Transfer, Create SEPA recurring transfers, …
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.
curl --request POST \
--url https://thirdparty.qonto.com/v2/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/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/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/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/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/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/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_body{
"attachment": {
"id": "71c32755-d0c3-4d82-9a78-774caa9d8556"
}
}Authorizations
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"
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/attachments \
-H "Content-Type: multipart/form-data" \
-H "Authorization: {Auth}" \
-F file="@path/to/a/file.jpg"
Response
Returns the uploaded attachment.
Show child attributes
Show child attributes
Was this page helpful?