🚧 We’re still putting the finishing touches on our platform
Create Tenant
Overview
The Create Tenant endpoint allows you to programmatically create new tenants (organizations/websites) in the system. Each tenant represents an isolated instance with its own database and domain configuration, enabling multi-tenancy architecture.
Endpoint Details
Create a new tenant in the system.
Endpoint: POST /api/tenants
Authentication: Required (Bearer Token)
Request Headers:
Content-Type: application/json
Accept: application/json
Authorization: Bearer YOUR_API_TOKEN
Request Body:
Field | Type | Required | Description |
---|---|---|---|
string | No | Email address of the user who will own the tenant. Must exist in the system. If not provided, a default user will be assigned. |
Request Body Example (with email):
{
"email": "[email protected]"
}
Request Body Example (without email):
{}
Success Response (200 OK):
{
"tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1"
}
Error Responses:
401 Unauthorized:
{
"message": "Unauthorized"
}
404 Not Found (User not found):
{
"message": "User not found"
}
422 Unprocessable Entity (Validation failed):
{
"message": "The email field must be a valid email address. (and 1 more error)",
"errors": {
"email": [
"The email field must be a valid email address.",
"The selected email is invalid."
]
}
}
Usage Examples
cURL
Example 1: With specific user email
curl -X POST https://webfluss.com/api/tenants \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"email": "[email protected]"}'
Example 2: Without email (uses default user)
curl -X POST https://webfluss.com/api/tenants \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Example Response:
{
"tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1"
}
Postman
Environment Setup
Create a Postman environment with these variables:
base_url
:https://webfluss.com
api_token
:YOUR_API_TOKEN
1. Create Tenant Request
-
Create a new request
- Method:
POST
- URL:
{{base_url}}/api/tenants
- Method:
-
Headers Tab
Key Value Content-Type application/json Accept application/json Authorization Bearer {{api_token}} -
Body Tab
- Select:
raw
- Type:
JSON
- Option 1 - With email:
{ "email": "[email protected]" }
- Option 2 - Without email (uses default):
or leave empty{}
- Select: