Appearance
tenants
7 endpoints.
GET /api/v1/tenants/all
List All Tenants
Platform-admin view: every organization on the instance.
200 — Successful Response
json
{
"items": {
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"slug": {
"type": "string",
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier"
},
"status": {
"type": "string",
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"member_count": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Member Count"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"erp_customer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Erp Customer"
},
"erp_synced_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Erp Synced At"
}
},
"type": "object",
"required": [
"id",
"name",
"slug",
"plan_tier",
"status",
"created_at"
],
"title": "TenantResponse"
},
"type": "array",
"title": "Response List All Tenants Api V1 Tenants All Get"
}POST /api/v1/tenants
Create Tenant
Create a new organization; the caller becomes its owner.
Request body
json
{
"properties": {
"name": {
"type": "string",
"maxLength": 255,
"minLength": 1,
"title": "Name"
},
"slug": {
"type": "string",
"maxLength": 100,
"minLength": 2,
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier",
"default": "starter"
}
},
"type": "object",
"required": [
"name",
"slug"
],
"title": "TenantCreate"
}201 — Successful Response
json
{
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"slug": {
"type": "string",
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier"
},
"status": {
"type": "string",
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"member_count": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Member Count"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"erp_customer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Erp Customer"
},
"erp_synced_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Erp Synced At"
}
},
"type": "object",
"required": [
"id",
"name",
"slug",
"plan_tier",
"status",
"created_at"
],
"title": "TenantResponse"
}422 — Validation Error
json
{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}GET /api/v1/tenants/{tenant_id}
Get Tenant
Read the active organization (must match the X-Tenant-ID header).
200 — Successful Response
json
{
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"slug": {
"type": "string",
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier"
},
"status": {
"type": "string",
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"member_count": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Member Count"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"erp_customer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Erp Customer"
},
"erp_synced_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Erp Synced At"
}
},
"type": "object",
"required": [
"id",
"name",
"slug",
"plan_tier",
"status",
"created_at"
],
"title": "TenantResponse"
}PATCH /api/v1/tenants/{tenant_id}
Update Tenant
Update org name/plan/settings. Admin+ only. status changes (suspend) are reserved for platform superusers.
Request body
json
{
"properties": {
"name": {
"anyOf": [
{
"type": "string",
"maxLength": 255
},
{
"type": "null"
}
],
"title": "Name"
},
"plan_tier": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Plan Tier"
},
"status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"email": {
"anyOf": [
{
"type": "string",
"maxLength": 255
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string",
"maxLength": 64
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string",
"maxLength": 64
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
}
},
"type": "object",
"title": "TenantUpdate"
}200 — Successful Response
json
{
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"slug": {
"type": "string",
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier"
},
"status": {
"type": "string",
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"member_count": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Member Count"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"erp_customer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Erp Customer"
},
"erp_synced_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Erp Synced At"
}
},
"type": "object",
"required": [
"id",
"name",
"slug",
"plan_tier",
"status",
"created_at"
],
"title": "TenantResponse"
}422 — Validation Error
json
{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}DELETE /api/v1/tenants/{tenant_id}
Delete Tenant
Soft-delete an organization. Owner (or platform superuser) only.
200 — Successful Response
json
{
"properties": {
"id": {
"type": "string",
"title": "Id"
},
"name": {
"type": "string",
"title": "Name"
},
"slug": {
"type": "string",
"title": "Slug"
},
"plan_tier": {
"type": "string",
"title": "Plan Tier"
},
"status": {
"type": "string",
"title": "Status"
},
"settings": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"title": "Settings"
},
"icon_url": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Icon Url"
},
"member_count": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Member Count"
},
"created_at": {
"type": "string",
"format": "date-time",
"title": "Created At"
},
"email": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Email"
},
"phone": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Phone"
},
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Account Id"
},
"customer_status": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Customer Status"
},
"notes": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Notes"
},
"erp_customer": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Erp Customer"
},
"erp_synced_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Erp Synced At"
}
},
"type": "object",
"required": [
"id",
"name",
"slug",
"plan_tier",
"status",
"created_at"
],
"title": "TenantResponse"
}POST /api/v1/tenants/{tenant_id}/erp-sync
Sync Tenant Erp
Push this organization to the configured ERPNext as a Customer (create or link an existing one), storing the Customer docname back on the org. Admin+ only. The ERP target is set in customer_erp_sync (Settings → API Keys for the credentials).
200 — Successful Response
json
{}POST /api/v1/tenants/erp-sync/all
Sync All Tenants Erp
Push every organization on the active site to the configured ERPNext now. Platform superuser only; runs regardless of the scheduler's enabled flag.
200 — Successful Response
json
{}