🚧 We’re still putting the finishing touches on our platform

Tenant API Documentation

This document describes the tenant management API endpoints. All endpoints are protected with bearer token authentication.

Overview

The Tenant API allows you to programmatically create and retrieve tenant (organization/website) information in the system. Each tenant has its own isolated database and domain configuration.

Authentication

All API requests must include a bearer token in the Authorization header.

Required Header

Authorization: Bearer YOUR_API_TOKEN

Security Notes:

  • The API token is configured in the .env file as API_TOKEN
  • Keep your token secure and never commit it to version control
  • Contact your system administrator to obtain the token

Endpoints

1. Create Tenant

Create a new tenant in the system.

Endpoint: POST /api/tenant

Authentication: Required (Bearer Token)

Request Headers:

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

Request Body: Currently no parameters required

Success Response (200 OK):

{
  "tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1"
}

Error Response (401 Unauthorized):

{
  "message": "Unauthorized"
}

2. Get Tenant Details

Retrieve detailed information about a specific tenant.

Endpoint: GET /api/tenant/{tenantUuid}

Authentication: Required (Bearer Token)

URL Parameters:

  • tenantUuid (string, UUID): The unique identifier 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",
  "organization_name": "Agile Harbor",
  "domains": {
    "base": "dmz-tey-k83.webfluss.com",
    "custom": null,
    "subdomain": null
  }
}

Response Fields:

  • tenant_id (string, UUID): The unique identifier for the tenant
  • organization_name (string): The name of the organization/website
  • domains (object): Domain configuration for the tenant
    • base (string|null): The base domain assigned to the tenant
    • custom (string|null): Custom domain if configured
    • subdomain (string|null): Subdomain if configured

Error Responses:

401 Unauthorized:

{
  "message": "Unauthorized"
}

404 Not Found:

{
  "message": "No query results for model [App\\Models\\Tenant] {tenant_uuid}"
}

Usage Examples

cURL

Create a Tenant

curl -X POST https://webfluss.com/api/tenant \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Example Response:

{
  "tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1"
}

Get Tenant Details

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

Example Response:

{
  "tenant_id": "860f5708-21eb-44bf-bb4f-ce1dbed2ede1",
  "organization_name": "Agile Harbor",
  "domains": {
    "base": "dmz-tey-k83.webfluss.com",
    "custom": null,
    "subdomain": null
  }
}

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/tenant
  2. Headers Tab

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

    • Select: raw
    • Type: JSON
    • Content: {} (empty object) or leave empty

2. Get Tenant Details Request

  1. Create a new request

    • Method: GET
    • URL: {{base_url}}/api/tenant/:tenantUuid
  2. Params Tab

    • Add path variable: tenantUuid = 860f5708-21eb-44bf-bb4f-ce1dbed2ede1
  3. Headers Tab

    Key Value
    Content-Type application/json
    Accept application/json
    Authorization Bearer {{api_token}}

Save as Collection

  1. Click "Save" to add to a collection
  2. Collection name: "Tenant API"
  3. Organize requests: "Create Tenant", "Get Tenant Details"

Domain Information

Domain Types

  1. Base Domain: The primary domain automatically assigned to the tenant (e.g., dmz-tey-k83.webfluss.com)
  2. Custom Domain: A custom domain configured by the user (e.g., example.com)
  3. Subdomain: A subdomain under the main domain (e.g., mysite.webfluss.com)

Domain States

  • null: No domain of this type is configured
  • string: The configured domain value