How to structure rate-limited developer APIs, enforce extra company slot limits, and build a transparent add-on management pricing portal.
As SaaS platforms mature, revenue growth often shifts from simple per-user pricing to usage-based monetization and feature add-ons. Two key expansion vectors for B2B platforms are:
1. Open API Rate Limits: Charging for developer API throughput and third-party integrations beyond base monthly call quotas.
2. Multi-Company Workspace Slots: Charging accounts for managing multiple legal entities or subsidiary companies under a single master billing dashboard.
Here is how we architected API rate-limiting middleware, multi-tenant company slot enforcement, and an intuitive pricing portal for both guest prospects and active subscribers.
To monetize API usage without breaking existing integrations, assign rate limits dynamically based on the account's active plan or purchased API add-on.
class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// app/Http/Middleware/MonetizedApiThrottleMiddleware.php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
class MonetizedApiThrottleMiddleware
{
public function handle(Request $request, Closure $next)
{
$user = $request->user();
$rateLimitKey = 'api-user:' . $user->id;
class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// Determine max requests per minute based on plan tier
$maxAttempts = match ($user->plan_tier) {
'enterprise' => 500,
'pro' => 120,
default => 30, class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// Free / Basic Tier
};
class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// Add additional quota if the user purchased the "API Unlimited" add-on
if ($user->hasAddon('api_boost')) {
$maxAttempts += 1000;
}
if (RateLimiter::tooManyAttempts($rateLimitKey, $maxAttempts)) {
return response()->json([
'error' => 'API rate limit exceeded. Upgrade your subscription plan or add an API quota pack.',
'retry_after' => RateLimiter::availableIn($rateLimitKey)
], 429);
}
RateLimiter::hit($rateLimitKey);
return $next($request);
}
}Allowing users to manage multiple companies requires enforcing company slot limits during creation workflows.
class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// app/Http/Controllers/CompanyController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CompanyController extends Controller
{
public function store(Request $request)
{
$user = $request->user();
$currentCompanyCount = $user->companies()->count();
$allowedSlots = $user->purchased_company_slots ?? 1; class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// Default 1 company
if ($currentCompanyCount >= $allowedSlots) {
return response()->json([
'error' => 'Company limit reached. Upgrade your subscription to add extra company slots.',
'code' => 'UPGRADE_REQUIRED'
], 403);
}
class=class="text-emerald-500 dark:text-emerald-400 font-medium">"text-slate-500 italic">// Proceed to create company record...
}
}To ensure transparency, build a unified pricing component that serves two distinct states:
<!-- components/PricingAddonManager.vue (Vue 3 / Composition API) -->
<template>
<div class="bg-slate-900 text-white p-8 rounded-2xl border border-slate-800">
<h2 class="text-2xl font-bold mb-4">Manage Subscription & Add-Ons</h2>
<!-- Company Slots Add-On -->
<div class="flex justify-between items-center py-4 border-b border-slate-800">
<div>
<h3 class="font-semibold text-sm">Extra Company Workspaces</h3>
<p class="text-xs text-slate-400">Manage multiple legal entities under one account</p>
</div>
<div class="flex items-center gap-3">
<button @click="updateCompanySlots(-1)" class="w-8 h-8 rounded-lg bg-slate-800 font-bold">-</button>
<span class="font-mono text-sm font-bold">{{ companySlots }} slots ($15/mo each)</span>
<button @click="updateCompanySlots(1)" class="w-8 h-8 rounded-lg bg-blue-600 font-bold">+</button>
</div>
</div>
<!-- API Rate Limit Boost -->
<div class="flex justify-between items-center py-4">
<div>
<h3 class="font-semibold text-sm">Developer API Boost (+1,000 req/min)</h3>
<p class="text-xs text-slate-400">High-throughput webhooks and CRM integrations</p>
</div>
<button
@click="toggleApiBoost"
:class="hasApiBoost ? 'bg-emerald-600' : 'bg-slate-800'"
class="px-4 py-2 rounded-xl text-xs font-bold uppercase transition-colors"
>
{{ hasApiBoost ? 'Active ($29/mo)' : 'Add to Plan' }}
</button>
</div>
</div>
</template>Monetizing API throughput and multi-company slots transforms static pricing plans into a flexible, usage-driven revenue model.