curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>' \
--form file='@example-file'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"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: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>'
}
};
options.body = form;
fetch('https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file', 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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file",
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",
"x-finops-version: <x-finops-version>",
"x-organization-id: <x-organization-id>"
],
]);
$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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file"
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("x-finops-version", "<x-finops-version>")
req.Header.Add("x-organization-id", "<x-organization-id>")
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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-finops-version"] = '<x-finops-version>'
request["x-organization-id"] = '<x-organization-id>'
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": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T14:30:00Z",
"updated_at": "2024-01-15T14:30:00Z",
"entity_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "SAP",
"source_of_data": "user_specified",
"status": "submitted_for_approval",
"based_on": "123e4567-e89b-12d3-a456-426614174000",
"based_on_document_id": "INV-2287",
"counterpart": {
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"line2": "<string>",
"postal_code": "10001",
"state": "<string>"
},
"bank_account": {
"account_holder_name": "<string>",
"account_number": "123456789012",
"bic": "CHASUS33XXX",
"iban": "<string>",
"routing_number": "<string>",
"sort_code": "<string>"
},
"email": "acme@example.com",
"name": "Acme Inc.",
"phone": "5551231234",
"tax_id": "123456789",
"vat_id": {
"country": "AF",
"type": "<string>",
"value": "<string>"
}
},
"counterpart_address_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_bank_account_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_raw": {
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"line2": "<string>",
"postal_code": "10001",
"state": "<string>"
},
"bank_account": {
"account_holder_name": "<string>",
"account_number": "123456789012",
"bic": "CHASUS33XXX",
"iban": "<string>",
"routing_number": "<string>",
"sort_code": "<string>"
},
"email": "acme@example.com",
"name": "Acme Inc.",
"phone": "5551231234",
"tax_id": "123456789",
"vat_id": {
"country": "AF",
"type": "<string>",
"value": "<string>"
}
},
"counterpart_vat_id_id": "123e4567-e89b-12d3-a456-426614174000",
"created_by_external_user_id": "ext_user_123",
"created_by_external_user_name": "John Doe",
"created_by_user_id": "123e4567-e89b-12d3-a456-426614174000",
"currency": "USD",
"currency_exchange": {
"default_currency_code": "<string>",
"rate": 123,
"total": 123
},
"description": "Credit note for returned items from invoice INV-2287",
"document_id": "CN-2287",
"file_id": "123e4567-e89b-12d3-a456-426614174000",
"file_url": "<string>",
"issued_at": "2024-01-15",
"ocr_request_id": "123e4567-e89b-12d3-a456-426614174000",
"ocr_status": "completed",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"sender": "supplier@example.com",
"subtotal": 1000,
"tags": [
{
"category": "department",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Department A"
}
],
"tax": 20,
"tax_amount": 200,
"total_amount": 1200
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"error": {
"message": "<string>"
}
}Upload credit note from file
Upload an incoming credit note (payable) in PDF, PNG, or JPEG format and scan its contents. The maximum file size is 20MB.
curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>' \
--form file='@example-file'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"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: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>'
}
};
options.body = form;
fetch('https://api.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file', 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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file",
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",
"x-finops-version: <x-finops-version>",
"x-organization-id: <x-organization-id>"
],
]);
$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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file"
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("x-finops-version", "<x-finops-version>")
req.Header.Add("x-organization-id", "<x-organization-id>")
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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.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.sandbox.tesouro.com/finops/v1/payable-credit-notes/upload-from-file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-finops-version"] = '<x-finops-version>'
request["x-organization-id"] = '<x-organization-id>'
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": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T14:30:00Z",
"updated_at": "2024-01-15T14:30:00Z",
"entity_id": "123e4567-e89b-12d3-a456-426614174000",
"origin": "SAP",
"source_of_data": "user_specified",
"status": "submitted_for_approval",
"based_on": "123e4567-e89b-12d3-a456-426614174000",
"based_on_document_id": "INV-2287",
"counterpart": {
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"line2": "<string>",
"postal_code": "10001",
"state": "<string>"
},
"bank_account": {
"account_holder_name": "<string>",
"account_number": "123456789012",
"bic": "CHASUS33XXX",
"iban": "<string>",
"routing_number": "<string>",
"sort_code": "<string>"
},
"email": "acme@example.com",
"name": "Acme Inc.",
"phone": "5551231234",
"tax_id": "123456789",
"vat_id": {
"country": "AF",
"type": "<string>",
"value": "<string>"
}
},
"counterpart_address_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_bank_account_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_id": "123e4567-e89b-12d3-a456-426614174000",
"counterpart_raw": {
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"line2": "<string>",
"postal_code": "10001",
"state": "<string>"
},
"bank_account": {
"account_holder_name": "<string>",
"account_number": "123456789012",
"bic": "CHASUS33XXX",
"iban": "<string>",
"routing_number": "<string>",
"sort_code": "<string>"
},
"email": "acme@example.com",
"name": "Acme Inc.",
"phone": "5551231234",
"tax_id": "123456789",
"vat_id": {
"country": "AF",
"type": "<string>",
"value": "<string>"
}
},
"counterpart_vat_id_id": "123e4567-e89b-12d3-a456-426614174000",
"created_by_external_user_id": "ext_user_123",
"created_by_external_user_name": "John Doe",
"created_by_user_id": "123e4567-e89b-12d3-a456-426614174000",
"currency": "USD",
"currency_exchange": {
"default_currency_code": "<string>",
"rate": 123,
"total": 123
},
"description": "Credit note for returned items from invoice INV-2287",
"document_id": "CN-2287",
"file_id": "123e4567-e89b-12d3-a456-426614174000",
"file_url": "<string>",
"issued_at": "2024-01-15",
"ocr_request_id": "123e4567-e89b-12d3-a456-426614174000",
"ocr_status": "completed",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"sender": "supplier@example.com",
"subtotal": 1000,
"tags": [
{
"category": "department",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Department A"
}
],
"tax": 20,
"tax_amount": 200,
"total_amount": 1200
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
The ID of the entity that owns the requested resource.
"9d2b4c8f-2087-4738-ba91-7359683c49a4"
Body
Response
Successful Response
Schema for credit note response. Includes all fields that can be returned from the API.
The unique identifier of the credit note
"123e4567-e89b-12d3-a456-426614174000"
Date and time when the credit note was created in the system
"2024-01-15T14:30:00Z"
Date and time of the last update to the credit note
"2024-01-15T14:30:00Z"
The ID of the entity to which the credit note belongs
"123e4567-e89b-12d3-a456-426614174000"
The origin or source system of the credit note
128"SAP"
How the data was input (ocr/user_specified)
128"user_specified"
The current status of the credit note in its lifecycle
30"submitted_for_approval"
ID of the payable this credit note is based on
"123e4567-e89b-12d3-a456-426614174000"
The document ID of the original payable that this credit note refers to
255"INV-2287"
Object representing de-normalized counterpart data
Show child attributes
Show child attributes
ID of the counterpart's address
"123e4567-e89b-12d3-a456-426614174000"
ID of the counterpart's bank account
"123e4567-e89b-12d3-a456-426614174000"
ID of the counterpart
"123e4567-e89b-12d3-a456-426614174000"
Object representing counterpart data which was extracted by OCR. Used for informational purposes.
Show child attributes
Show child attributes
ID of the counterpart's VAT registration
"123e4567-e89b-12d3-a456-426614174000"
External system's user ID for the creator
255"ext_user_123"
Name of the external user who created the credit note
255"John Doe"
ID of the user who created the credit note
"123e4567-e89b-12d3-a456-426614174000"
The currency code
5"USD"
Show child attributes
Show child attributes
Description of the credit note
255"Credit note for returned items from invoice INV-2287"
The credit note's unique document number
255"CN-2287"
The id of the stored credit note file.
"123e4567-e89b-12d3-a456-426614174000"
The URL of the stored credit note file.
Date when the credit note was issued
"2024-01-15"
ID of the OCR processing request
"123e4567-e89b-12d3-a456-426614174000"
Status of OCR processing
10"completed"
ID of the associated project
"123e4567-e89b-12d3-a456-426614174000"
Email address of the sender
255"supplier@example.com"
The subtotal amount before taxes
1000
List of tags associated with this credit note
Show child attributes
Show child attributes
[
{
"category": "department",
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Department A"
}
]
The tax percentage
20
The calculated tax amount
200
The total amount including taxes
1200
Was this page helpful?