Skip to main content
POST
/
units
Create unit
curl --request POST \
  --url https://api.example.com/units \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "reference": "<string>",
  "parent_id": 123,
  "description": "<string>"
}
'
{
  "content_type": "unit",
  "id": 1,
  "reference": "<string>",
  "name": "HQ",
  "description": "<string>",
  "level": 123,
  "path": "<string>",
  "unit_type": "unit",
  "falldown": true,
  "features": [
    {}
  ],
  "departments": [
    {}
  ],
  "parent": {},
  "image": {},
  "children": [
    {}
  ],
  "addresses": {},
  "contact": {},
  "opening_hours": {},
  "geo": {
    "lat": 123,
    "lng": 123
  },
  "stats": {
    "users": 123,
    "children": 123,
    "children_total": 123
  },
  "permissions": {},
  "url": "api/units/1"
}

Body

application/json
name
string
required

Unit name

reference
string | null

External reference identifier

parent_id
integer | null

Parent unit ID

description
string | null

Response

Unit created

content_type
string
Example:

"unit"

id
integer
Example:

1

reference
string | null
name
string
Example:

"HQ"

description
string | null
level
integer

Depth in unit tree

path
string

Materialized path

unit_type
string
Example:

"unit"

falldown
boolean | null

From pivot when in context

features
object[] | null
departments
object[] | null
parent
object

Parent unit when loaded

image
object

Unit image when loaded

children
object[] | null
addresses
object

Company, delivery, invoicing addresses

contact
object

Contact name and phone

opening_hours
object

Office hours and closed days

geo
object
stats
object
permissions
object

Permission flags for current user

url
string
Example:

"api/units/1"