Add a company
Add a company to your account by its CIF, read it, and see what it needs before it can send or receive.
On this page
An account holds the companies you send and receive invoices for. Each company is identified by its CIF and has its own invoices, its own authorisation at the authority, its own synchronisation and its own event endpoint. The id of a company is the companyId of every request about its invoices and the legalCompanyId of its events.
Add the company
Send the CIF, digits only, and the rights the gateway needs for the company: send, receive or both. The answer is an operation result, and aggregateId is the id of the new company.
curl
curl -X POST "$RDC_BASE_URL/efactura/v1/companies" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "7add495a-6ec4-4f64-b25e-5961d8d75e00",
"cif": "4017226",
"scope": [
"send",
"receive"
]
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/efactura/v1/companies`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "7add495a-6ec4-4f64-b25e-5961d8d75e00",
"cif": "4017226",
"scope": [
"send",
"receive"
]
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/efactura/v1/companies',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '7add495a-6ec4-4f64-b25e-5961d8d75e00',
'cif': '4017226',
'scope': [
'send',
'receive',
],
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "7add495a-6ec4-4f64-b25e-5961d8d75e00",
"cif": "4017226",
"scope": [
"send",
"receive"
]
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/efactura/v1/companies');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/efactura/v1/companies");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "7add495a-6ec4-4f64-b25e-5961d8d75e00",
"cif": "4017226",
"scope": [
"send",
"receive"
]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "7add495a-6ec4-4f64-b25e-5961d8d75e00",
"status": "accepted",
"aggregateId": "61d24c9f-10f4-40c8-97bc-1b55b0d8839a",
"aggregateRevision": 1
} Adding the same CIF twice is refused with company_exists.
Read the company
A company carries everything the Companies view of the product shows.
| Field | Meaning |
|---|---|
authorisation | What the company allowed the gateway to do at the authority: its status, its end date, who gave it and the rights. null until the representative of the company has confirmed access. See Authorise access at the authority. |
sync | Whether synchronisation is paused and when the gateway last synchronised the company. See Sync received invoices. |
endpoint | The host of the event endpoint, and whether it answers. See Subscriptions. |
curl
curl "$RDC_BASE_URL/efactura/v1/companies/c6a26b8c-3323-4e7a-8611-f5a92f5e1a42" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/efactura/v1/companies/c6a26b8c-3323-4e7a-8611-f5a92f5e1a42`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/efactura/v1/companies/c6a26b8c-3323-4e7a-8611-f5a92f5e1a42',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/efactura/v1/companies/c6a26b8c-3323-4e7a-8611-f5a92f5e1a42');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/efactura/v1/companies/c6a26b8c-3323-4e7a-8611-f5a92f5e1a42");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"id": "c6a26b8c-3323-4e7a-8611-f5a92f5e1a42",
"name": "Brumar Distribuție SRL",
"cif": "48290619",
"vatId": "RO48290619",
"authorisation": {
"status": "active",
"expires": "2027-03-12",
"authorisedBy": {
"name": "Ana Rusu",
"role": "Finance director"
},
"scope": [
"send",
"receive"
],
"renewal": null
},
"sync": {
"paused": false,
"lastAt": "2026-11-23T05:00:00Z"
},
"endpoint": {
"host": "erp.brumar.example",
"status": "healthy",
"http": 200
},
"revision": 1
}