Partner API Documentation

Integrate domain registration, availability checks, and checkout flows into your platform using our REST API.

Overview & Authentication

Base URL

https://usslkqrqiozweaxigiqf.supabase.co/functions/v1

Authentication

All API requests require an X-API-Key header with your partner API key.

X-API-Key: your_api_key_here

Rate Limiting

Default rate limit: 60 requests per minute per API key. Rate limit headers are included in all responses.

Recommended: Use the Session Checkout flow for the best customer experience. It handles user creation, cart population, and payment in one seamless redirect.

Session Checkout Flow (Recommended)

The session checkout flow creates a user (or finds an existing one), pre-populates their cart, and redirects them to CalmLock to complete payment.

How It Works

  1. Your site collects customer info and selected services
  2. Call /partner-create-session with cart items
  3. Redirect customer to the returned loginUrl
  4. Customer is auto-authenticated, cart pre-filled, ready to pay
IMPORTANT: After receiving the API response, you MUST redirect the customer to the loginUrl. This is a one-time access token that expires in 15 minutes.

Redirect URL Format

https://app.calmlock.co.zw/partner-login?token=abc123...

Access Token Security

PropertyValue
Token Expiry15 minutes from creation
Token UsageOne-time use only (invalidated after use)
StorageSHA-256 hashed (never stored in plain text)
DeliveryReturned in loginUrl query parameter

What Happens After Redirect

  1. Token is validated and marked as used
  2. Customer is automatically signed in (magic link auth)
  3. Cart is pre-populated with the items you specified
  4. Customer lands on /checkout ready to pay

Return URL (Optional)

The returnUrl parameter specifies where to redirect the customer after they complete payment on CalmLock.

{
  "returnUrl": "https://yoursite.com/order-complete?orderId=123"
}

API Endpoints

POST /partner-check-domain

Check domain availability and get pricing

POST /partner-create-session

Create checkout session with pre-populated cart (recommended)

POST /partner-create-user

Create end-user account (standalone)

POST /partner-register-domain

Register domain for existing user (backend processing)

International Domains & Partner Prices

.co.zw and other .zw names are checked with ZISPA; .com, .net, .org and every other active ending are checked live with eNom. Each result has status: available, taken, premium (contact CalmLock) or unknown (check failed, retry; never treat as free).

Check many endings at once

POST /partner-check-domain
{ "name": "acme", "tlds": [".co.zw", ".com", ".net"] }   // omit tlds for all endings, max 20
→ { "name": "acme", "results": [ { "domain": "acme.co.zw", "status": "available", "type": "local",
     "pricing": { "price": 9.99, "cost": 9.49, "profit": 0.5, "byYears": { "1": {...}, "2": {...}, "5": {...} } } } ] }

Sending { "domain": "acme.com" } still returns a single result.

Set your own selling prices

GET    /partner-set-pricing                       // your saved prices
POST   /partner-set-pricing  { "prices": [ { "tld": ".com", "registration": 15, "renewal": 17, "transfer": 15 } ] }
DELETE /partner-set-pricing  { "tlds": [".com"] }  // back to CalmLock standard price

Prices below your cost are refused (422 invalid_prices). If you have not set a price, the CalmLock standard price is used. GET /partner-pricing lists your cost and selling price for every ending, for 1, 2 and 5 years.

Registration re-checks the name with the registry: taken → 409, premium → 422, unknown → 503 (retry).

Hosting & Email (core prices)

GET /partner-pricing also returns services: CalmLock's active hosting and email plans at core prices (id, name, category, tier, currency, monthly, yearly, billingCycles, readOnly). These are read-only and cannot be changed by partners. Hosting and email are billed yearly only, so monthly is always null for them.

Keeping prices up to date

GET /partner-pricing returns a version and an ETag. Check every 6 hours sending If-None-Match: "<version>" (or ?version=); you get 304 when nothing changed. For instant updates, save your site address in Reseller Dashboard → API → Website price updates: CalmLock POSTs {"event":"prices.changed"} signed with X-CalmLock-Signature: sha256=<HMAC-SHA256 of body>, then you re-fetch the list.

Check Domain Availability

Request

POST /partner-check-domain
Content-Type: application/json
X-API-Key: your_api_key_here

{
  "domain": "example.co.zw"
}

Response (Domain Available)

{
  "domain": "example.co.zw",
  "available": true,
  "pricing": {
    "basePrice": 20,
    "baseRenewalPrice": 20,
    "baseTransferPrice": 15,
    "partnerPrice": 17,
    "partnerRenewalPrice": 17,
    "partnerTransferPrice": 12.75,
    "retailPrice": 25,
    "retailRenewalPrice": 25,
    "retailTransferPrice": 20,
    "discountPercentage": 15,
    "discountAmount": 3,
    "currency": "USD"
  }
}

Response (Domain Unavailable - Includes Suggestions)

{
  "domain": "example.co.zw",
  "available": false,
  "pricing": { ... },
  "suggestions": [
    "getexample.co.zw",
    "myexample.co.zw",
    "examplehub.co.zw",
    "examplepro.co.zw",
    "theexample.co.zw"
  ]
}
Suggestions: When a domain is unavailable, the API returns up to 5 alternative domain suggestions. These are intelligently generated based on the original search query using brandable prefixes, suffixes, and industry terms. Display these to your customers as clickable alternatives.

Pricing Explanation

FieldDescription
basePricePlatform's standard retail price
partnerPriceYour wholesale cost (after tier discount)
retailPriceYour custom retail price (if configured)
discountPercentageYour partner tier discount percentage
suggestionsAlternative domains when requested domain is unavailable

Create Checkout Session

Request

POST /partner-create-session
Content-Type: application/json
X-API-Key: your_api_key_here

{
  "email": "customer@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "phone": "+263771234567",
  "address": {
    "line1": "123 Main Street",
    "city": "Harare",
    "state": "Harare",
    "postalCode": "00263",
    "country": "Zimbabwe"
  },
  "cartItems": [
    {
      "type": "domain",
      "domain": "example.co.zw",
      "price": 25,
      "period": 1,
      "registrationData": {
        "fullName": "John Doe",
        "email": "customer@example.com",
        "phone": "+263771234567",
        "companyName": "Acme Ltd",
        "natureOfBusiness": "Technology Services",
        "proposedDomainUsage": "Company website and email",
        "address": {
          "line1": "123 Main Street",
          "city": "Harare",
          "state": "Harare",
          "postalCode": "00263",
          "country": "Zimbabwe"
        }
      }
    },
    {
      "type": "email-hosting",
      "name": "Professional Email for example.co.zw",
      "price": 30,
      "period": 1,
      "plan": "email-pro",
      "selectedDomain": "example.co.zw",
      "metadata": {
        "planId": "email-pro",
        "storageGB": 50,
        "emailAccounts": 1
      }
    },
    {
      "type": "web-hosting",
      "name": "Shared Hosting for example.co.zw",
      "price": 30,
      "period": 1,
      "plan": "hosting-shared",
      "selectedDomain": "example.co.zw",
      "metadata": {
        "planId": "hosting-shared",
        "storage": "10GB SSD",
        "bandwidth": "100GB"
      }
    }
  ],
  "returnUrl": "https://yoursite.com/order-complete"
}

Response

{
  "success": true,
  "userId": "uuid-here",
  "isExistingUser": false,
  "loginUrl": "https://app.calmlock.co.zw/partner-login?token=abc123...",
  "expiresIn": 900,
  "message": "Redirect customer to loginUrl to complete checkout"
}
Next Step: Redirect the customer to loginUrl immediately. The token expires in 15 minutes.

Create User Account (Standalone)

Use this endpoint to create a user account without a checkout session. Useful for pre-registering users before they make a purchase.

Request

POST /partner-create-user
Content-Type: application/json
X-API-Key: your_api_key_here

{
  "email": "customer@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "phone": "+263771234567",
  "organization": "Acme Ltd",
  "address": {
    "line1": "123 Main Street",
    "city": "Harare",
    "state": "Harare",
    "postalCode": "00263",
    "country": "Zimbabwe"
  }
}

Response

{
  "success": true,
  "userId": "uuid-here",
  "email": "customer@example.com",
  "temporaryPassword": "SecureP@ss123",
  "message": "User created successfully"
}

Register Domain (Backend Processing)

For systems that handle payment themselves and need backend domain registration.

Request

POST /partner-register-domain
Content-Type: application/json
X-API-Key: your_api_key_here

{
  "userId": "user-uuid-from-create-user",
  "domain": "example.co.zw",
  "retailPrice": 25,
  "contactInfo": {
    "fullName": "John Doe",
    "email": "customer@example.com",
    "phone": "+263771234567",
    "companyName": "Acme Ltd",
    "natureOfBusiness": "Technology Services",
    "proposedDomainUsage": "Company website",
    "domiciliumCitandi": "123 Main Street, Harare",
    "address": {
      "line1": "123 Main Street",
      "city": "Harare",
      "state": "Harare",
      "postalCode": "00263",
      "country": "Zimbabwe"
    }
  },
  "nameservers": {
    "type": "calmlock"
  }
}

Response

{
  "success": true,
  "domainId": "uuid-here",
  "domain": "example.co.zw",
  "orderId": "uuid-here",
  "orderNumber": "ORD-XXXXX",
  "status": "pending_zispa",
  "zispaStatus": "submitted"
}

ZISPA Fields (Required for .co.zw domains)

FieldDescriptionRequired
natureOfBusinessDescription of business activitiesYes
proposedDomainUsageHow the domain will be usedYes
companyNameRegistered company nameYes
domiciliumCitandiLegal address for serviceOptional

Cart Item Structures

Domain Registration

{
  "type": "domain",
  "domain": "example.co.zw",
  "price": 25,
  "period": 1,
  "registrationData": {
    "fullName": "John Doe",
    "email": "customer@example.com",
    "phone": "+263771234567",
    "companyName": "Acme Ltd",
    "natureOfBusiness": "Technology Services",
    "proposedDomainUsage": "Company website",
    "address": { ... }
  }
}

Email Hosting

{
  "type": "email-hosting",
  "name": "Professional Email for example.co.zw",
  "price": 30,
  "period": 1,
  "plan": "email-pro",
  "selectedDomain": "example.co.zw",
  "metadata": {
    "planId": "email-pro",
    "storageGB": 50,
    "emailAccounts": 1
  }
}

Web Hosting

{
  "type": "web-hosting",
  "name": "Shared Hosting for example.co.zw",
  "price": 30,
  "period": 1,
  "plan": "hosting-shared",
  "selectedDomain": "example.co.zw",
  "metadata": {
    "planId": "hosting-shared",
    "storage": "10GB SSD",
    "bandwidth": "100GB"
  }
}

Available Service Types

TypePlan IDPrice (USD/year)Description
domain—Your retail priceDomain registration
email-hostingemail-professional$12.00 / mailboxProfessional Email — billed yearly only
web-hostinghosting-shared$299.99Shared Hosting (10GB SSD) — billed yearly only

Bundle Discount: When both email and hosting are selected, a 10% discount is automatically applied during checkout.

Error Handling

Token Errors

Error MessageCauseSolution
"No login token provided" Token missing from URL Ensure loginUrl is used exactly as returned
"Invalid or expired token" Token is older than 15 minutes Call partner-create-session again for a new token
"Token has already been used" One-time token was reused Create a new session for each checkout attempt

API Errors

StatusErrorDescription
401UnauthorizedMissing or invalid API key
400Bad RequestInvalid request body or missing required fields
404Not FoundDomain or user not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error, contact support

Code Examples

JavaScript / Node.js

// Check domain availability
const response = await fetch('https://usslkqrqiozweaxigiqf.supabase.co/functions/v1/partner-check-domain', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    domain: 'example.co.zw'
  })
});

const result = await response.json();
console.log(result);

// Create checkout session
const sessionResponse = await fetch('https://usslkqrqiozweaxigiqf.supabase.co/functions/v1/partner-create-session', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key_here'
  },
  body: JSON.stringify({
    email: 'customer@example.com',
    firstName: 'John',
    lastName: 'Doe',
    cartItems: [{
      type: 'domain',
      domain: 'example.co.zw',
      price: 25,
      period: 1
    }],
    returnUrl: 'https://yoursite.com/complete'
  })
});

const session = await sessionResponse.json();
// Redirect customer to loginUrl
window.location.href = session.loginUrl;

Python

import requests

API_KEY = 'your_api_key_here'
BASE_URL = 'https://usslkqrqiozweaxigiqf.supabase.co/functions/v1'

# Check domain availability
def check_domain(domain):
    response = requests.post(
        f'{BASE_URL}/partner-check-domain',
        headers={
            'Content-Type': 'application/json',
            'X-API-Key': API_KEY
        },
        json={'domain': domain}
    )
    return response.json()

# Create checkout session
def create_session(customer_data, cart_items, return_url=None):
    payload = {
        'email': customer_data['email'],
        'firstName': customer_data['first_name'],
        'lastName': customer_data['last_name'],
        'cartItems': cart_items,
        'returnUrl': return_url
    }
    response = requests.post(
        f'{BASE_URL}/partner-create-session',
        headers={
            'Content-Type': 'application/json',
            'X-API-Key': API_KEY
        },
        json=payload
    )
    return response.json()

# Usage
result = check_domain('example.co.zw')
print(f"Available: {result['available']}")

session = create_session(
    {'email': 'john@example.com', 'first_name': 'John', 'last_name': 'Doe'},
    [{'type': 'domain', 'domain': 'example.co.zw', 'price': 25, 'period': 1}],
    'https://yoursite.com/complete'
)
print(f"Redirect to: {session['loginUrl']}")

PHP / WordPress

<?php
$apiKey = 'your_api_key_here';
$baseUrl = 'https://usslkqrqiozweaxigiqf.supabase.co/functions/v1';

// Check domain availability
function calmlock_check_domain($domain) {
    global $apiKey, $baseUrl;
    
    $response = wp_remote_post("$baseUrl/partner-check-domain", [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-API-Key' => $apiKey
        ],
        'body' => json_encode(['domain' => $domain]),
        'timeout' => 30
    ]);
    
    if (is_wp_error($response)) {
        return ['error' => $response->get_error_message()];
    }
    
    return json_decode(wp_remote_retrieve_body($response), true);
}

// Create checkout session
function calmlock_create_session($customer, $cart_items, $return_url = null) {
    global $apiKey, $baseUrl;
    
    $request_body = [
        'email' => $customer['email'],
        'firstName' => $customer['firstName'],
        'lastName' => $customer['lastName'],
        'cartItems' => $cart_items,
        'returnUrl' => $return_url
    ];
    
    $response = wp_remote_post("$baseUrl/partner-create-session", [
        'headers' => [
            'Content-Type' => 'application/json',
            'X-API-Key' => $apiKey
        ],
        'body' => json_encode($request_body),
        'timeout' => 30
    ]);
    
    if (is_wp_error($response)) {
        return ['error' => $response->get_error_message()];
    }
    
    return json_decode(wp_remote_retrieve_body($response), true);
}

// Usage with domain suggestions handling
$result = calmlock_check_domain('example.co.zw');

if ($result['available']) {
    // Domain is available - proceed to checkout
    $session = calmlock_create_session(
        ['email' => 'john@example.com', 'firstName' => 'John', 'lastName' => 'Doe'],
        [['type' => 'domain', 'domain' => 'example.co.zw', 'price' => 25, 'period' => 1]],
        get_site_url() . '/order-complete'
    );
    
    // Redirect to CalmLock checkout
    wp_redirect($session['loginUrl']);
    exit;
} else {
    // Domain is taken - display alternative suggestions
    echo '<div class="domain-unavailable">';
    echo '<p>Sorry, <strong>' . esc_html($result['domain']) . '</strong> is not available.</p>';
    
    if (!empty($result['suggestions'])) {
        echo '<h4>Try these alternatives:</h4>';
        echo '<ul class="domain-suggestions">';
        foreach ($result['suggestions'] as $suggestion) {
            echo '<li>';
            echo '<a href="?domain=' . urlencode($suggestion) . '">';
            echo esc_html($suggestion);
            echo '</a>';
            echo '</li>';
        }
        echo '</ul>';
    }
    echo '</div>';
}
?>

cURL

# Check domain availability
curl -X POST https://usslkqrqiozweaxigiqf.supabase.co/functions/v1/partner-check-domain \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"domain": "example.co.zw"}'

# Create checkout session
curl -X POST https://usslkqrqiozweaxigiqf.supabase.co/functions/v1/partner-create-session \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "email": "customer@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "cartItems": [{"type": "domain", "domain": "example.co.zw", "price": 25, "period": 1}],
    "returnUrl": "https://yoursite.com/complete"
  }'

WordPress: Displaying Domain Suggestions

When a domain is unavailable, the API returns up to 5 alternative suggestions. Here's how to display them in WordPress:

PHP Display Function

/**
 * Display domain search result with clickable suggestions
 */
function calmlock_display_domain_result($result, $retail_price = 25) {
    if (isset($result['error'])) {
        echo '<div class="calmlock-error">' . esc_html($result['error']) . '</div>';
        return;
    }
    
    $domain = esc_html($result['domain']);
    
    if ($result['available']) {
        echo '<div class="calmlock-available">';
        echo '<strong>' . $domain . '</strong> is available! ';
        echo '<span class="price">$' . $retail_price . '/year</span>';
        echo '<button class="select-domain" data-domain="' . $domain . '">Register Now</button>';
        echo '</div>';
    } else {
        echo '<div class="calmlock-unavailable">';
        echo '<strong>' . $domain . '</strong> is not available.';
        echo '</div>';
        
        // Display alternative suggestions
        if (!empty($result['suggestions'])) {
            echo '<div class="calmlock-suggestions">';
            echo '<h4>Try these alternatives:</h4>';
            echo '<ul class="suggestion-list">';
            foreach ($result['suggestions'] as $suggestion) {
                $suggestion_escaped = esc_html($suggestion);
                echo '<li class="suggestion-item">';
                echo '<span class="suggestion-domain">' . $suggestion_escaped . '</span>';
                echo '<span class="suggestion-price">$' . $retail_price . '/year</span>';
                echo '<button class="check-suggestion" data-domain="' . $suggestion_escaped . '">';
                echo 'Check Availability';
                echo '</button>';
                echo '</li>';
            }
            echo '</ul>';
            echo '</div>';
        }
    }
}

CSS Styling

.calmlock-available {
    background: #f0fdf4;
    border: 1px solid #22c55e;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.calmlock-unavailable {
    background: #fef2f2;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.calmlock-suggestions {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
}

.suggestion-list {
    list-style: none;
    padding: 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.suggestion-domain {
    font-weight: 600;
    color: #1e40af;
}

.check-suggestion {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.check-suggestion:hover {
    background: #2563eb;
}
Tip: When a user clicks a suggested domain, re-call the partner-check-domain endpoint with the suggestion to verify availability before proceeding to checkout.