Skip to content
FacilydevelopersDashboard
Build with Facily
DocsREST APIsBatch Delete Unit Groups
Search the full API reference Esc to close

Batch Delete Unit Groups

Unit groups · REST API reference

Get support
POST/v1/unit-groups/batch-delete
Delete the empty groups among several, in one request and one transaction.

Authentication

Bearer API key or Facily session, subject to permissions and facility scope.

Authentication and scope

Request example

Replace bracketed path values with real IDs from your environment. The body, where shown, is generated from the schema and uses illustrative values.

cURL
curl --request POST \
  --url 'https://api.staging.facily.ai/v1/unit-groups/batch-delete' \
  --header "Authorization: Bearer $FACILY_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "unit_group_ids": [
    "00000000-0000-4000-8000-000000000001"
  ],
  "dry_run": false
}'
An example for building your request, not an executed call. Check required fields, allowed values, and environment configuration before sending.

Request body

application/json · Required

dry_runboolean

Default: false

unit_group_idsstring[]required

Min items: 1 · Max items: 100

Show unit_group_ids schema
string

Responses

Expand a status to inspect its schema. Generated examples show structure and synthetic values.

200Successful Response
JSON · generated example
{
  "data": {
    "count": 0,
    "deleted_ids": [
      "00000000-0000-4000-8000-000000000001"
    ],
    "dry_run": false,
    "skipped": [
      {
        "id": "00000000-0000-4000-8000-000000000001",
        "unit_count": 0
      }
    ]
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

dataUnitGroupBatchDeleteResponserequired
Show data schema
countintegerrequired
deleted_idsstring[]required

Groups deleted (or, on a dry run, that would be).

Show deleted_ids schema
string
dry_runbooleanrequired
skippedSkippedUnitGroup[]required

Groups kept because they still have units.

Show skipped schema
idstringrequired

Format: uuid

unit_countintegerrequired

Units still in the group, which is why it was kept.

metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
400Validation error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
401Unauthenticated
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
403Permission denied
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
404Not found
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
409Business logic error
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
503Temporary failure
JSON · generated example
{
  "error": {
    "code": "string",
    "message": "string",
    "details": {}
  },
  "meta": {
    "request_id": "string"
  }
}

application/json

errorErrorBodyrequired

The shape of error.* in an error response.

Show error schema
codestringrequired
detailsobject | null
Show details schema
object | null
Variant 1: object
object
Variant 2: null
null
messagestringrequired
metaMetarequired

Envelope metadata. Every response carries one.

Show meta schema
request_idstringrequired
Continue exploringAll unit groups operations
Build something that works beautifully.

Facily API · Contract v1.200 · Reviewed October 29, 2026

Batch Delete Unit Groups | Facily Developers