> For the complete documentation index, see [llms.txt](https://docs.workfx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.workfx.ai/workfx-companion-agent-knowledge/developer-docs/api-reference/tenant-units.md).

# Tenant Units

Manage tenant units, including listing all units, creating a new one, retrieving a specific unit, and getting the default tenant unit.

## GET /admin/api/v1/tenantUnits

> List Tenant Units

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/tenantUnits":{"get":{"summary":"List Tenant Units","deprecated":false,"description":"","tags":[],"parameters":[{"name":"page","in":"query","description":"default to 1 if not passing this query","schema":{"type":"integer"}},{"name":"pageSize","in":"query","description":"default to 10 if not passing this query","schema":{"type":"integer"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"tenantUnits":{"type":"array","items":{"$ref":"#/components/schemas/tenantUnit"}},"pagination":{"$ref":"#/components/schemas/paginationResponse"}},"required":["tenantUnits"]}}},"headers":{}}}}}},"components":{"schemas":{"tenantUnit":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"parentId":{"type":"string"},"level":{"type":"integer","default":0},"default":{"type":"boolean"}},"required":["name"]},"paginationResponse":{"type":"object","properties":{"totalCount":{"type":"integer"},"currentPage":{"type":"integer"},"pageSize":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["totalCount","totalPages","pageSize","currentPage"]}}}}
```

## POST /admin/api/v1/tenantUnits

> Create a Tenant Unit

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/tenantUnits":{"post":{"summary":"Create a Tenant Unit","deprecated":false,"description":"","tags":[],"parameters":[{"name":"createDefaultAgent","in":"query","description":"","required":false,"schema":{"type":"boolean"}},{"name":"createDefaultDataset","in":"query","description":"","required":false,"schema":{"type":"boolean"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"parentId":{"type":"string"},"default":{"type":"boolean"}},"required":["name"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"parentId":{"type":"string"},"level":{"type":"integer","default":0},"default":{"type":"boolean"}},"required":["name"]}}},"headers":{}}}}}}}
```

## GET /admin/api/v1/tenantUnits/{tenantUnitId}

> Get a Tenant Unit

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/tenantUnits/{tenantUnitId}":{"get":{"summary":"Get a Tenant Unit","deprecated":false,"description":"","tags":[],"parameters":[{"name":"tenantUnitId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/tenantUnit"}}},"headers":{}}}}}},"components":{"schemas":{"tenantUnit":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["active","inactive"]},"parentId":{"type":"string"},"level":{"type":"integer","default":0},"default":{"type":"boolean"}},"required":["name"]}}}}
```

## GET /admin/api/v1/tenantUnits/default

> Default tenant unit

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/tenantUnits/default":{"get":{"summary":"Default tenant unit","deprecated":false,"description":"","tags":[],"parameters":[{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.workfx.ai/workfx-companion-agent-knowledge/developer-docs/api-reference/tenant-units.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
