Multi-tenant client management with billing, agent assignment, and revenue tracking
The Organizations page (OrganizationsPage) provides full CRUD management for client organizations in a multi-tenant AgenticMail deployment. Organizations act as logical boundaries for agent assignment, knowledge base isolation, billing, and access control. Each organization has a unique slug, contact information, billing configuration, and a set of assigned agents.
A URL-safe identifier auto-generated from the organization name (e.g., "AgenticMail" → agenticmail). Slugs are immutable after creation and used throughout the system for routing and identification. You can manually edit the slug during creation.
Organizations can be toggled active/inactive. Deactivating an organization effectively suspends all linked agents. The toggle endpoint is POST /api/organizations/{id}/toggle.
Agents are assigned to organizations via POST /api/agents/{id}/assign-org. An agent can belong to only one organization at a time. Assigning an agent that's currently in another org will move it. Unassigning returns the agent to the default (internal) org.
| Field | Required | Description |
|---|---|---|
| Name | Yes | Display name of the organization |
| Slug | Yes | URL-safe identifier, auto-generated from name |
| Contact Name | No | Primary contact person |
| Contact Email | No | Primary contact email address |
| Description | No | Brief description of the organization |
| Billing Rate | No | Monthly rate per agent (default: 0.00) |
| Currency | No | USD, EUR, GBP, NGN, CAD, or AUD (default: USD) |
POST /api/organizations
Content-Type: application/json
{
"name": "AgenticMail",
"slug": "agenticmail",
"contact_name": "Ope Olatunji",
"contact_email": "ope@agenticmail.com",
"description": "Enterprise client — Q1 2026 onboarding",
"billing_rate_per_agent": 99.00,
"currency": "USD"
}
Clicking an organization card opens a detail modal with two tabs:
Billing data is loaded from two endpoints:
GET /api/organizations/{id}/billing-summary — Monthly aggregated revenue, cost, and token countsGET /api/organizations/{id}/billing — Individual billing records per agent per monthCustom per-agent rates are saved via PATCH /api/agents/{id} with a billingRate field. The effective rate for an agent is: custom rate if set, otherwise the org's default rate.
| Endpoint | Method | Description |
|---|---|---|
/api/organizations | GET | List all organizations |
/api/organizations | POST | Create a new organization |
/api/organizations/{id} | GET | Get organization detail with linked agents |
/api/organizations/{id} | PATCH | Update organization fields |
/api/organizations/{id} | DELETE | Delete organization (must have 0 agents) |
/api/organizations/{id}/toggle | POST | Toggle active/inactive status |
/api/organizations/{id}/billing-summary | GET | Monthly billing aggregation |
/api/organizations/{id}/billing | GET | Per-agent billing records |
/api/agents/{id}/assign-org | POST | Assign agent to org |
/api/agents/{id}/unassign-org | POST | Remove agent from org |
/api/agents/{id} | PATCH | Update agent billing rate |
Organizations can only be deleted when they have zero assigned agents. Unassign all agents first, then delete.
The agent is currently assigned to a different organization. Assigning it to this org will remove it from the previous one.
Billing records are created as agents process tasks and accumulate token costs. New organizations will have empty billing until agents start working.