API & Tool Subscriptions
Manage API access through subscription-based model.
Overviewβ
STOA implements a subscription-based access model:
- Self-Service Discovery - Browse available APIs/tools
- Subscription Management - Request and manage access
- Approval Workflows - Manual or automatic approval
- Usage Tracking - Monitor subscription usage
- Billing Integration - (Future) Usage-based billing
Subscription Modelβ
User/App β Subscribe β API/Tool β Generate API Key β Access
API Catalogβ
Browse Available APIsβ
# List all APIs in catalog
stoa catalog list --tenant acme
# Search for specific API
stoa catalog search --query "payment"
# Get API details
stoa catalog get payment-api
API Catalog Entryβ
Each API includes:
- Name & Description - What the API does
- Version - API version
- Documentation - OpenAPI spec, guides
- Endpoints - Available paths
- Pricing Tier - Free, paid, etc.
- Rate Limits - Request quotas
- SLA - Uptime targets
Subscription Lifecycleβ
1. Create Subscriptionβ
# Subscribe to an API
stoa subscription create \
--tenant acme \
--api payment-api \
--plan community \
--app my-mobile-app
# Response includes:
# - Subscription ID
# - API key (if auto-approved)
# - Status (pending/active)
2. Approval (if required)β
# API owner reviews subscription request
stoa subscription approve \
--subscription-id sub-12345 \
--rate-limit 1000/hour
# Or reject
stoa subscription reject \
--subscription-id sub-12345 \
--reason "Invalid use case"
3. API Key Managementβ
# List your API keys
stoa apikey list --tenant acme
# Rotate API key
stoa apikey rotate \
--subscription-id sub-12345
# Revoke API key
stoa apikey revoke \
--key sk_live_abc123
4. Monitor Usageβ
# Check subscription usage
stoa subscription usage \
--subscription-id sub-12345 \
--period last-30-days
# Output:
# Requests: 45,231
# Errors: 23 (0.05%)
# P95 Latency: 124ms
# Quota Used: 45.2%
Subscription Plansβ
Plan Tiersβ
| Plan | Self-Hosted | Managed SaaS | Price |
|---|---|---|---|
| Community | Unlimited, forever | 1M requests/month | Free |
| Enterprise | N/A | Unlimited + custom SLA | Contact us |
| Sovereign | On-premise option | Dedicated EU infra | Custom |
Self-Hosted Licensing
STOA is Apache 2.0 licensed. Self-hosted deployments of the open-source core are free with no licensing fees. We monetize managed services and enterprise support.
Configure Planβ
# API owner defines subscription plans
stoa api plan create \
--api payment-api \
--name enterprise \
--rate-limit unlimited \
--quota unlimited \
--features "Custom SLA,Priority support,Webhook notifications"
Developer Portalβ
Self-Service Portalβ
STOA provides a web portal for developers:
- API Discovery - Browse catalog
- Interactive Docs - Try API endpoints
- Subscription Management - Create/manage subscriptions
- Usage Dashboard - View analytics
- Billing - Manage payment methods
Access portal at: https://portal.<YOUR_DOMAIN>/{tenant}
Portal Configurationβ
# Customize developer portal
stoa portal configure \
--tenant acme \
--logo https://acme.com/logo.png \
--primary-color "#4F46E5" \
--custom-domain portal.acme.com
API Keysβ
Types of API Keysβ
- User API Keys - Tied to individual user
- Application Keys - Tied to application/service
- Environment Keys - Separate keys for dev/staging/prod
Key Formatβ
sk_live_abc123xyz789... # Production
sk_test_abc123xyz789... # Sandbox/Test
Using API Keysβ
# In request header
curl ${STOA_GATEWAY_URL}/acme/payment-api/charge \
-H "X-API-Key: sk_live_abc123xyz789"
# Or as query parameter (not recommended)
curl ${STOA_GATEWAY_URL}/acme/payment-api/charge?apikey=sk_live_abc123
Webhooksβ
Subscribe to events:
# Register webhook for subscription events
stoa webhook create \
--tenant acme \
--url https://myapp.com/webhooks/stoa \
--events subscription.created,subscription.cancelled \
--secret whsec_abc123
Webhook Eventsβ
subscription.created- New subscriptionsubscription.approved- Subscription approvedsubscription.cancelled- Subscription cancelledsubscription.usage_threshold- Usage quota warningapikey.rotated- API key rotatedapikey.revoked- API key revoked
Usage Quotasβ
Enforce Quotasβ
# Set usage quotas
stoa subscription quota set \
--subscription-id sub-12345 \
--requests 50000/month \
--bandwidth 10GB/month
# Check quota status
stoa subscription quota get \
--subscription-id sub-12345
Quota Exceededβ
When quota exceeded:
- HTTP 429 response (Too Many Requests)
X-RateLimit-*headers included- Webhook notification sent
- Portal notification displayed
Advanced Featuresβ
Subscription Groupsβ
Group subscriptions for shared quotas:
stoa subscription-group create \
--tenant acme \
--name mobile-apps \
--shared-quota 100000/month
Conditional Accessβ
Restrict access based on conditions:
# Allow access only from specific IPs
stoa subscription acl add \
--subscription-id sub-12345 \
--allow-ips 203.0.113.0/24
# Restrict to certain endpoints
stoa subscription scope set \
--subscription-id sub-12345 \
--allow-paths "/read/*,/list/*" \
--deny-paths "/admin/*"
Next Stepsβ
- Authentication Setup β Configure SSO and OIDC
- API Reference β Full API documentation
- CLI Reference β Manage subscriptions via CLI
- FAQ β Common questions answered