Group Companies
Read and replace the workspace's own group companies and their structure, so the platform never creates them as parties on a contract, through /v1/parties.
A contract names the workspace's own companies as well as its counterparties, and the app must not mistake the first for the second. The group companies list is the workspace's own companies and their structure. Entries on it are never created as parties, so a subsidiary named in a contract does not appear in the register as a counterparty.
GET /v1/parties/group-companies returns the list, ordered by name. Each entry has an id, a name, a parent_id (the id of the entry it belongs under, or null) and a relation (subsidiary, sister or parent, or null). The list is stored as the whole: there is no route that adds or removes a single entry.
/v1/parties/group-companiesPUT /v1/parties/group-companies replaces the whole list. Names are trimmed to 300 characters and duplicate names are dropped. parent names another entry of the same request, so the structure is described by names and the platform resolves them to ids; a parent that does not name an entry of the request is refused with 422. Send the complete list every time, because an entry you leave out is removed. The response is 200 with the stored companies.
/v1/parties/group-companiesBody fields
cURL: Replace the group structure
curl -X PUT "https://api.talonic.com/v1/parties/group-companies" \
-H "Authorization: Bearer $TALONIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"companies": [
{ "name": "Nord Energie Holding AG" },
{ "name": "Nord Energie Vertrieb GmbH", "parent": "Nord Energie Holding AG", "relation": "subsidiary" },
{ "name": "Nord Energie Netz GmbH", "parent": "Nord Energie Holding AG", "relation": "subsidiary" }
]
}'Response: Stored companies
{
"data": [
{ "id": "a7c19e30-5d82-4b64-9f0a-2e8d6b4c1a73", "name": "Nord Energie Holding AG", "parent_id": null, "relation": null },
{ "id": "0e5b83d2-71f9-4a16-b4c8-6d2a9f7e3b15", "name": "Nord Energie Netz GmbH", "parent_id": "a7c19e30-5d82-4b64-9f0a-2e8d6b4c1a73", "relation": "subsidiary" },
{ "id": "b84d2f61-3a07-4e9c-85b1-c1f6a0d9e247", "name": "Nord Energie Vertrieb GmbH", "parent_id": "a7c19e30-5d82-4b64-9f0a-2e8d6b4c1a73", "relation": "subsidiary" }
]
}PUT replaces the list, read it with GET first and send the full list back with your change. A request that lists only the new company removes every other entry.