🚧 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
email 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.
name string No Name of the organization/tenant. Maximum 255 characters. If not provided, a name will be automatically generated.
subdomain string No Custom subdomain name for the tenant. Must be 3-63 characters long, contain only lowercase letters, numbers, and hyphens. Must start and end with a letter or number. Cannot contain consecutive hyphens or dots. Example: my-page (not my-page.qrweb.mn). If not provided, a random subdomain will be generated.

Request Body Example:

{
	"email": "[email protected]",
	"name": "My Organization",
	"subdomain": "my-organization"
}

All fields are optional. You can provide any combination or none at all.

Validation Rules:

subdomain field requirements:

  • Minimum 3 characters, maximum 63 characters
  • Only lowercase letters (a-z), numbers (0-9), and hyphens (-) are allowed
  • Must start with a letter or number
  • Must end with a letter or number
  • Cannot contain consecutive hyphens (--)
  • Cannot contain dots (.) - provide only the subdomain part, not the full domain
  • Valid examples: my-page, page123, test-site-1
  • Invalid examples: my page (spaces), My-Page (uppercase), -mypage (starts with hyphen), page.qrweb.mn (contains dot), my--page (consecutive hyphens)

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 2 more errors)",
	"errors": {
		"email": ["The email field must be a valid email address.", "The selected email is invalid."],
		"subdomain": ["The subdomain field must be at least 3 characters.", "The subdomain field format is invalid."]
	}
}

Usage Examples

cURL

Example:

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]", "name": "My Organization", "subdomain": "my-organization"}'

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

  1. Create a new request

    • Method: POST
    • URL: {{base_url}}/api/tenants
  2. Headers Tab

    Key Value
    Content-Type application/json
    Accept application/json
    Authorization Bearer {{api_token}}
  3. Body Tab

    • Select: raw
    • Type: JSON
    • Example:
      {
      	"email": "[email protected]",
      	"name": "Facebook Page Name",
      	"subdomain": "my-organization"
      }
      

Get Tenant Website Status

Overview

The Get Tenant Website Status endpoint allows you to check the building progress and status of a tenant's website. This is useful for tracking AI-powered website generation progress.

Endpoint Details

Endpoint: GET /api/tenants/{tenantUuid}/website-status

Authentication: Required (Bearer Token)

Path Parameters:

Parameter Type Required Description
tenantUuid string Yes UUID of the tenant

Request Headers:

Content-Type: application/json
Accept: application/json
Authorization: Bearer YOUR_API_TOKEN

Success Response (200 OK):

{
	"tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1",
	"success": true,
	"building_progress": 100,
	"error_message": null,
	"prompt": {
		"process_status": "completed"
	}
}

Response Fields:

Field Type Description
tenant_id string UUID of the tenant
success boolean True if building completed successfully (building_progress = 100)
building_progress integer Current building progress (0-100, 101-103 = failed)
error_message string|null Error message if failed
prompt.process_status string Status of the prompt process (pending/completed/failed)

building_progress values:

  • 5 - Started
  • 10 - Prompted
  • 20 - Image Requested
  • 30 - Image Generated
  • 40 - Text Requested
  • 50 - Text Generated
  • 60 - Content Synced
  • 100 - Completed (success)
  • 101 - Failed with Prompt Response
  • 102 - Failed with Empty Content
  • 103 - Failed (workflow error)

process_status values:

  • pending - Processing
  • completed - Successfully completed
  • failed - Failed

Error Responses:

401 Unauthorized:

{
	"message": "Unauthorized"
}

404 Not Found (Tenant or Website not found):

{
	"message": "No query results"
}

Usage Examples

cURL

curl -X GET https://webfluss.com/api/tenants/860f5708-21eb-44bf-bb4f-ce1dbed2ede1/website-status \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"