2. Create a business unit
Observed — createBusinessUnit from /admin/company/business-units/create.
Why
In Ublo, the Business Unit owns the asset / accounting scope (subsidiary, agency, management entity). End-user docs (settings) emphasize multi-organization setups to filter collaborator access.
Prerequisites
financialAccountId(workflow 1)- Optional:
getNextBuCustomReferenceto fetch the next reference (O00000x)
Step A — Next reference (optional)
query {
nextBuCustomReference
}
Step B — Create the BU and link the account
- GraphQL
- Node.js
- curl
mutation createBusinessUnit($businessUnitInput: BusinessUnitInput!) {
createBusinessUnit(businessUnitInput: $businessUnitInput) {
id
name
customReference
type
businessUnitFinancialAccounts {
financialAccountId
isPrimaryAccount
}
}
}
{
"businessUnitInput": {
"name": "Example Agency",
"type": "agency",
"externalId": "BU-EXT-001",
"description": "Demo organization",
"customReference": "O000002",
"housingAddress": {
"number": "16",
"street": "Quai Henri IV",
"city": "Paris",
"zip": "75004",
"country": "FR",
"coordinates": { "latitude": 48.848251, "longitude": 2.363691 }
},
"businessUnitFinancialAccounts": [
{
"financialAccountId": "00000000-0000-4000-8000-000000000001",
"isPrimaryAccount": true
}
]
}
}
import { ublo } from '../ubloClient.mjs';
const data = await ublo(
`mutation createBusinessUnit($businessUnitInput: BusinessUnitInput!) {
createBusinessUnit(businessUnitInput: $businessUnitInput) {
id
name
customReference
}
}`,
{
businessUnitInput: {
name: 'Example Agency',
type: 'agency',
externalId: 'BU-EXT-001',
description: 'Demo organization',
customReference: 'O000002',
housingAddress: {
number: '16',
street: 'Quai Henri IV',
city: 'Paris',
zip: '75004',
country: 'FR',
coordinates: { latitude: 48.848251, longitude: 2.363691 },
},
businessUnitFinancialAccounts: [
{
financialAccountId: process.env.FINANCIAL_ACCOUNT_ID,
isPrimaryAccount: true,
},
],
},
},
);
console.log(data.createBusinessUnit.id);
- Bearer
- Cookie session
# Replace FINANCIAL_ACCOUNT_ID in the JSON
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H "Authorization: Bearer $UBLO_API_TOKEN" \
-H 'Content-Type: application/json' \
-d @payload-create-bu.json
# Replace FINANCIAL_ACCOUNT_ID in the JSON
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H 'Content-Type: application/json' \
-b cookies.txt \
-d @payload-create-bu.json
Watch-outs
type: "agency"was observed; other values exist in the schema depending on your setup.- Link at least one primary financial account for banking / invoicing flows.
- API permissions follow the collaborator’s BU attachments (see auth docs).
Next
- Create a unit
- Then configure accounting before completing the unit (rents)