API – Import organizational structure
- To import an organizational structure, you need to send POST request to the following URI /api/v2/orgstructure/import
You can import the organizational structure in two ways:
Import with CSV file
- The request must be accompanied by a file in the CSV format like this:
department code; name of the department; parent department code
a3123910441;department 1;
a2567104662;department 1.2;a3123910441
a2701216083;department 1.2.1;a2567104662
a2206647782;department 1.2.2;a2567104662
a3123410541;department 2;
a1468104662;department 2.1;a3123410541
a1206747582;department 2.1.2;a1468104662
- The request must contain the headings Content-Type: multipart/form-data та X-Cbr-Authorization: Bearer API_TOKEN.
Request example:
curl 'https://your-domain.davintoo.com/api/v2/orgstructure/import' -H 'X-Cbr-Authorization: Bearer API_TOKEN' -H 'Content-Type: multipart/form-data' -F 'file=@/path/to/structure.csv'

Import of organizational structure in JSON format
Instead of a CSV file, you can add information about the organizational structure in JSON format to the body of the request, for example:
[
{
"uid": "structureid1",
"parent_uid": "",
"title": "structure1"
},
{
"uid": "departmentid2",
"parent_uid": "structureid1",
"title": "department2"
},
{
"uid": "departmentid3",
"parent_uid": "structureid1",
"title": "department3"
}
]
- The request must contain the headers Content-Type: application/json and X-Cbr-Authorization: Bearer API_TOKEN
- Body settings: raw, JSON
Request example:
`curl 'https://your-domain.davintoo.com/api/v2/orgstructure/import' -H 'X-Cbr-Authorization: Bearer API_TOKEN' -H 'Content-Type: application/json'

Importing multiple organizational structures
Importing multiple organizational structures is available only if the Allow import multiple organizational structures option is enabled in the orgstructure policies.
You must also select either the By import value or Hybrid orgstructure import mode. If the By attributes settings mode is selected, the request will be rejected and the system will return the following error: Invalid orgstructure mode, setup 'import' or 'hybrid'.

To perform the import, you must provide a prefix used to distinguish between multiple org structures. This can be done in one of two ways:
- in the query parameter
'https://your-domain.davintoo.com/api/v2/orgstructure/import?prefix=part1'

- in the HTTP header
'X-Cbr-Orgstructure-Prefix: part1'

'prefix' parameter or 'X-Cbr-Orgstructure-Prefix' header required for multi orgstructure import.
structure_uidmust be provided in the format:prefix.uid.Example: prefix
part1, UID folder 0001 → "structure_uid": "part1.0001". For more details, see API – Batch import of users.