curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/counterparts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"is_customer": true,
"is_vendor": true,
"organization": {
"legal_name": "Acme Inc.",
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"postal_code": "10001",
"line2": "<string>",
"state": "<string>"
},
"email": "acme@example.com",
"phone": "5551231234",
"tag_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"type": "organization",
"external_reference": "123456789",
"language": "en",
"reminders_enabled": true,
"tax_id": "<string>"
}
'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/counterparts"
payload = {
"is_customer": True,
"is_vendor": True,
"organization": {
"legal_name": "Acme Inc.",
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"postal_code": "10001",
"line2": "<string>",
"state": "<string>"
},
"email": "acme@example.com",
"phone": "5551231234",
"tag_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
},
"type": "organization",
"external_reference": "123456789",
"language": "en",
"reminders_enabled": True,
"tax_id": "<string>"
}
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
is_customer: true,
is_vendor: true,
organization: {
legal_name: 'Acme Inc.',
address: {
city: 'New York',
country: 'US',
line1: '456 Fifth Avenue',
postal_code: '10001',
line2: '<string>',
state: '<string>'
},
email: 'acme@example.com',
phone: '5551231234',
tag_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
},
type: 'organization',
external_reference: '123456789',
language: 'en',
reminders_enabled: true,
tax_id: '<string>'
})
};
fetch('https://api.sandbox.tesouro.com/finops/v1/counterparts', 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/counterparts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'is_customer' => true,
'is_vendor' => true,
'organization' => [
'legal_name' => 'Acme Inc.',
'address' => [
'city' => 'New York',
'country' => 'US',
'line1' => '456 Fifth Avenue',
'postal_code' => '10001',
'line2' => '<string>',
'state' => '<string>'
],
'email' => 'acme@example.com',
'phone' => '5551231234',
'tag_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'type' => 'organization',
'external_reference' => '123456789',
'language' => 'en',
'reminders_enabled' => true,
'tax_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"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/counterparts"
payload := strings.NewReader("{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}")
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>")
req.Header.Add("Content-Type", "application/json")
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/counterparts")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.tesouro.com/finops/v1/counterparts")
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["Content-Type"] = 'application/json'
request.body = "{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"individual": {
"first_name": "Adnan",
"last_name": "Singh",
"email": "asingh@example.net",
"phone": "5553211234",
"tags": [
{
"id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
"created_at": "2022-09-07T16:35:18.484507+00:00",
"updated_at": "2022-09-07T16:35:18.484507+00:00",
"name": "Marketing",
"category": "department",
"created_by_entity_user_id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
"description": "Tag for the Marketing Department"
}
],
"title": "Mr."
},
"is_customer": true,
"is_vendor": true,
"type": "individual",
"created_automatically": false,
"created_by_entity_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_billing_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_shipping_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_reference": "123456789",
"language": "ab",
"reminders_enabled": true,
"tax_id": "<string>"
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"error": {
"message": "<string>"
}
}Create counterpart
curl --request POST \
--url https://api.sandbox.tesouro.com/finops/v1/counterparts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-finops-version: <x-finops-version>' \
--header 'x-organization-id: <x-organization-id>' \
--data '
{
"is_customer": true,
"is_vendor": true,
"organization": {
"legal_name": "Acme Inc.",
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"postal_code": "10001",
"line2": "<string>",
"state": "<string>"
},
"email": "acme@example.com",
"phone": "5551231234",
"tag_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
},
"type": "organization",
"external_reference": "123456789",
"language": "en",
"reminders_enabled": true,
"tax_id": "<string>"
}
'import requests
url = "https://api.sandbox.tesouro.com/finops/v1/counterparts"
payload = {
"is_customer": True,
"is_vendor": True,
"organization": {
"legal_name": "Acme Inc.",
"address": {
"city": "New York",
"country": "US",
"line1": "456 Fifth Avenue",
"postal_code": "10001",
"line2": "<string>",
"state": "<string>"
},
"email": "acme@example.com",
"phone": "5551231234",
"tag_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"]
},
"type": "organization",
"external_reference": "123456789",
"language": "en",
"reminders_enabled": True,
"tax_id": "<string>"
}
headers = {
"x-finops-version": "<x-finops-version>",
"x-organization-id": "<x-organization-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-finops-version': '<x-finops-version>',
'x-organization-id': '<x-organization-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
is_customer: true,
is_vendor: true,
organization: {
legal_name: 'Acme Inc.',
address: {
city: 'New York',
country: 'US',
line1: '456 Fifth Avenue',
postal_code: '10001',
line2: '<string>',
state: '<string>'
},
email: 'acme@example.com',
phone: '5551231234',
tag_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']
},
type: 'organization',
external_reference: '123456789',
language: 'en',
reminders_enabled: true,
tax_id: '<string>'
})
};
fetch('https://api.sandbox.tesouro.com/finops/v1/counterparts', 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/counterparts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'is_customer' => true,
'is_vendor' => true,
'organization' => [
'legal_name' => 'Acme Inc.',
'address' => [
'city' => 'New York',
'country' => 'US',
'line1' => '456 Fifth Avenue',
'postal_code' => '10001',
'line2' => '<string>',
'state' => '<string>'
],
'email' => 'acme@example.com',
'phone' => '5551231234',
'tag_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'type' => 'organization',
'external_reference' => '123456789',
'language' => 'en',
'reminders_enabled' => true,
'tax_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"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/counterparts"
payload := strings.NewReader("{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}")
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>")
req.Header.Add("Content-Type", "application/json")
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/counterparts")
.header("x-finops-version", "<x-finops-version>")
.header("x-organization-id", "<x-organization-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.tesouro.com/finops/v1/counterparts")
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["Content-Type"] = 'application/json'
request.body = "{\n \"is_customer\": true,\n \"is_vendor\": true,\n \"organization\": {\n \"legal_name\": \"Acme Inc.\",\n \"address\": {\n \"city\": \"New York\",\n \"country\": \"US\",\n \"line1\": \"456 Fifth Avenue\",\n \"postal_code\": \"10001\",\n \"line2\": \"<string>\",\n \"state\": \"<string>\"\n },\n \"email\": \"acme@example.com\",\n \"phone\": \"5551231234\",\n \"tag_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"type\": \"organization\",\n \"external_reference\": \"123456789\",\n \"language\": \"en\",\n \"reminders_enabled\": true,\n \"tax_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"individual": {
"first_name": "Adnan",
"last_name": "Singh",
"email": "asingh@example.net",
"phone": "5553211234",
"tags": [
{
"id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
"created_at": "2022-09-07T16:35:18.484507+00:00",
"updated_at": "2022-09-07T16:35:18.484507+00:00",
"name": "Marketing",
"category": "department",
"created_by_entity_user_id": "ea837e28-509b-4b6a-a600-d54b6aa0b1f5",
"description": "Tag for the Marketing Department"
}
],
"title": "Mr."
},
"is_customer": true,
"is_vendor": true,
"type": "individual",
"created_automatically": false,
"created_by_entity_user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_billing_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"default_shipping_address_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_reference": "123456789",
"language": "ab",
"reminders_enabled": true,
"tax_id": "<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
- Option 1
- Option 2
This schema is used to create new counterparts (either organizations or individuals).
The counterpart type is specified by the type property. Depending on the type,
you need to provide the data for either the individual or organization property.
Indicates if the counterpart is a customer.
Indicates if the counterpart is a vendor.
Show child attributes
Show child attributes
Must be "organization".
"organization""organization"
A user-defined identifier of the counterpart. For example, the customer or vendor reference number in the entity's CRM system. If specified, it will be displayed in PDF invoices and other accounts receivable documents created by the entity.
1 - 255"123456789"
The language used to generate PDF documents for this counterpart.
ab, aa, af, ak, sq, am, ar, an, hy, av, ae, ay, az, bm, ba, eu, be, bn, bi, bs, br, bg, my, ca, ch, ce, ny, zh, cu, cv, kw, co, cr, hr, cs, da, dv, nl, dz, en, eo, et, ee, fo, fj, fi, fr, fy, ff, gd, gl, lg, ka, de, el, kl, gn, gu, ht, ha, he, hz, hi, ho, hu, io, ig, id, ia, ie, iu, ik, ga, it, ja, jv, kn, kr, ks, kk, km, ki, rw, ky, kv, kg, ko, kj, ku, lo, la, lv, li, ln, lt, lu, lb, mk, mg, ms, ml, mt, gv, mi, mr, mh, mn, na, nv, nd, nr, ng, ne, no, nb, nn, ii, oc, oj, om, os, pi, ps, fa, pl, pt, pa, qu, ro, rm, rn, ru, se, sm, sg, sa, sc, sr, sn, sd, si, sk, sl, so, st, es, su, sw, ss, sv, tl, ty, tg, ta, tt, te, th, bo, ti, to, ts, tn, tr, tk, tw, ug, uk, ur, uz, ve, vi, vo, wa, cy, wo, xh, yi, yo, za, zu The counterpart's taxpayer identification number or tax ID. For identification purposes, this field may be required for counterparts that are not VAT-registered.
30Response
Successful Response
- Option 1
- Option 2
A Counterpart object contains information about an organization (juridical person) or individual (natural person) that provides goods and services to or buys them from an SME.
Unique ID of the counterpart.
Show child attributes
Show child attributes
Indicates if the counterpart is a customer.
Indicates if the counterpart is a vendor.
The counterpart type: organization (juridical person) or individual (natural person).
individual, organization true if the counterpart was created automatically by Monite when processing incoming invoices with OCR. false if the counterpart was created by the API client.
Entity user ID of counterpart creator.
ID of the counterpart's billing address. If the counterpart is US-based and needs to accept ACH payments, this address must have all fields filled in. If default_billing_address_id is not defined, the default address is instead used as the billing address for ACH payments.
ID of the shipping address.
A user-defined identifier of the counterpart. For example, the customer or vendor reference number in the entity's CRM system. If specified, it will be displayed in PDF invoices and other accounts receivable documents created by the entity.
1 - 255"123456789"
The language used to generate PDF documents for this counterpart.
ab, aa, af, ak, sq, am, ar, an, hy, av, ae, ay, az, bm, ba, eu, be, bn, bi, bs, br, bg, my, ca, ch, ce, ny, zh, cu, cv, kw, co, cr, hr, cs, da, dv, nl, dz, en, eo, et, ee, fo, fj, fi, fr, fy, ff, gd, gl, lg, ka, de, el, kl, gn, gu, ht, ha, he, hz, hi, ho, hu, io, ig, id, ia, ie, iu, ik, ga, it, ja, jv, kn, kr, ks, kk, km, ki, rw, ky, kv, kg, ko, kj, ku, lo, la, lv, li, ln, lt, lu, lb, mk, mg, ms, ml, mt, gv, mi, mr, mh, mn, na, nv, nd, nr, ng, ne, no, nb, nn, ii, oc, oj, om, os, pi, ps, fa, pl, pt, pa, qu, ro, rm, rn, ru, se, sm, sg, sa, sc, sr, sn, sd, si, sk, sl, so, st, es, su, sw, ss, sv, tl, ty, tg, ta, tt, te, th, bo, ti, to, ts, tn, tr, tk, tw, ug, uk, ur, uz, ve, vi, vo, wa, cy, wo, xh, yi, yo, za, zu The counterpart's taxpayer identification number or tax ID.
30Was this page helpful?