Resource Quotas

Query subscription tier-based resource quotas for services. Quotas control the maximum number of resources (such as compute instances) a customer can provision based on their subscription tier.

Get All Customer Quotas

Retrieve all resource quotas for the authenticated customer organized by service.

Endpoint: https://apis.threatwinds.com/api/billing/v1/quotas

Method: GET

Parameters

Headers

Header Type Required Description
Authorization string Optional* Bearer token for session authentication
api-key string Optional* API key for key-based authentication
api-secret string Optional* API secret for key-based authentication

Note: You must use either Authorization header OR API key/secret combination.

Required Roles

Required role: owner, admin, or user

All authenticated customer members can query their resource quotas.

Request

To retrieve all quotas, use a GET request:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>'

Or using API key and secret:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas' \
  -H 'accept: application/json' \
  -H 'api-key: your-api-key' \
  -H 'api-secret: your-api-secret'

Response

A successful response will return all configured quotas organized by service.

Success Response (200 OK)

{
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "tierName": "Adversary Pro",
  "quotas": {
    "compute-api": {
      "max_instances": {
        "value": 1,
        "description": "Maximum concurrent compute instances"
      }
    }
  }
}

Response Schema

Field Type Description
customerId string (UUID) Customer unique identifier
tierName string Subscription tier name
quotas object Quotas organized by service name
quotas.{service} object Service-specific quotas
quotas.{service}.{featureKey} object Quota details
quotas.{service}.{featureKey}.value integer Quota value (-1 for unlimited, 0 for disabled)
quotas.{service}.{featureKey}.description string Human-readable description

Business Logic

  • Retrieves customer’s subscription to determine tier
  • Reads quotas from a global cache populated via service discovery
  • Returns empty quotas map if cache exists but tier has no quotas configured
  • Value of -1 indicates unlimited, 0 indicates feature disabled

Error Codes

Status Code Description Possible Cause
200 OK Request successful
400 Bad Request Invalid request
401 Unauthorized Missing or invalid authentication
403 Forbidden Insufficient permissions
404 Not Found Customer not found or no active subscription
500 Internal Server Error Quota cache not initialized

Get Service-Specific Quotas

Retrieve resource quotas for a specific service only.

Endpoint: https://apis.threatwinds.com/api/billing/v1/quotas/{serviceName}

Method: GET

Parameters

Headers

Header Type Required Description
Authorization string Optional* Bearer token for session authentication
api-key string Optional* API key for key-based authentication
api-secret string Optional* API secret for key-based authentication

Note: You must use either Authorization header OR API key/secret combination.

Path Parameters

Parameter Type Required Description Example
serviceName string Yes Service identifier compute-api

Required Roles

Required role: owner, admin, or user

Request

To retrieve quotas for a specific service, use a GET request:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/compute-api' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>'

Or using API key and secret:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/compute-api' \
  -H 'accept: application/json' \
  -H 'api-key: your-api-key' \
  -H 'api-secret: your-api-secret'

Response

Success Response (200 OK)

{
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "tierName": "Adversary Pro",
  "serviceName": "compute-api",
  "quotas": {
    "max_instances": {
      "value": 1,
      "description": "Maximum concurrent compute instances"
    }
  }
}

Response Schema

Field Type Description
customerId string (UUID) Customer unique identifier
tierName string Subscription tier name
serviceName string Service identifier
quotas object Service-specific quotas with value and description

Business Logic

  • Returns only quotas for the specified service
  • Returns 404 if service quotas not found for the customer’s tier

Error Codes

Status Code Description Possible Cause
200 OK Request successful
400 Bad Request Empty serviceName parameter
401 Unauthorized Missing or invalid authentication
403 Forbidden Insufficient permissions
404 Not Found Customer not found or service quotas not configured
500 Internal Server Error Quota cache not initialized

Get Specific Quota Value

Retrieve a single quota value for a specific service and feature.

Endpoint: https://apis.threatwinds.com/api/billing/v1/quotas/{serviceName}/{featureKey}

Method: GET

Parameters

Headers

Header Type Required Description
Authorization string Optional* Bearer token for session authentication
api-key string Optional* API key for key-based authentication
api-secret string Optional* API secret for key-based authentication

Note: You must use either Authorization header OR API key/secret combination.

Path Parameters

Parameter Type Required Description Example
serviceName string Yes Service identifier compute-api
featureKey string Yes Feature/quota key name max_instances

Required Roles

Required role: owner, admin, or user

Request

To retrieve a specific quota value, use a GET request:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/compute-api/max_instances' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>'

Or using API key and secret:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/compute-api/max_instances' \
  -H 'accept: application/json' \
  -H 'api-key: your-api-key' \
  -H 'api-secret: your-api-secret'

Response

Success Response (200 OK)

{
  "customerId": "550e8400-e29b-41d4-a716-446655440000",
  "tierName": "Adversary Pro",
  "serviceName": "compute-api",
  "featureKey": "max_instances",
  "value": 1,
  "description": "Maximum concurrent compute instances"
}

Response Schema

Field Type Description
customerId string (UUID) Customer unique identifier
tierName string Subscription tier name
serviceName string Service identifier
featureKey string Feature/quota key name
value integer Quota value (-1 for unlimited, 0 for disabled)
description string Human-readable description

Business Logic

  • Returns a single quota value from the global cache
  • Value of -1 indicates unlimited usage
  • Value of 0 indicates the feature is disabled for the tier

Error Codes

Status Code Description Possible Cause
200 OK Request successful
400 Bad Request Empty path parameters
401 Unauthorized Missing or invalid authentication
403 Forbidden Insufficient permissions
404 Not Found Quota not found for service and feature combination
500 Internal Server Error Quota cache not initialized

Get Aggregated Quota Usage

Retrieve aggregated quota usage statistics across all services for the authenticated user. This endpoint combines current resource usage with quota limits to show consumption status.

Endpoint: https://apis.threatwinds.com/api/billing/v1/quotas/usage

Method: GET

Parameters

Headers

Header Type Required Description
Authorization string Optional* Bearer token for session authentication
api-key string Optional* API key for key-based authentication
api-secret string Optional* API secret for key-based authentication

Note: You must use either Authorization header OR API key/secret combination.

Required Roles

Required role: owner, admin, or user

All authenticated customer members can query their quota usage.

Request

To retrieve aggregated quota usage, use a GET request:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/usage' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <token>'

Or using API key and secret:

curl -X 'GET' \
  'https://apis.threatwinds.com/api/billing/v1/quotas/usage' \
  -H 'accept: application/json' \
  -H 'api-key: your-api-key' \
  -H 'api-secret: your-api-secret'

Response

A successful response will return aggregated quota usage organized by service.

Success Response (200 OK)

{
  "userId": "550e8400-e29b-41d4-a716-446655440000",
  "services": {
    "compute-api": {
      "serviceName": "compute-api",
      "features": [
        {
          "featureKey": "max_instances",
          "currentUsage": 1,
          "limit": 2,
          "remaining": 1,
          "description": "Active compute instances"
        }
      ]
    }
  },
  "totalFeatures": 1,
  "fetchedAt": 1704067200
}

Response Schema

Field Type Description
userId string (UUID) User unique identifier
services object Quota usage statistics by service
services.{service} object Service-specific quota usage
services.{service}.serviceName string Service identifier
services.{service}.features array Array of quota feature usage details
features[].featureKey string Feature/quota key name
features[].currentUsage integer Current resource count
features[].limit integer Maximum allowed (-1 for unlimited)
features[].remaining integer Remaining quota (-1 for unlimited)
features[].description string Human-readable description
totalFeatures integer Total number of quota features tracked
fetchedAt integer Unix timestamp when usage was fetched

Business Logic

  • Fetches quota usage reports from all registered services concurrently
  • Enriches usage data with quota limits from the global cache
  • Services that don’t expose quota usage are silently skipped
  • Continues gracefully if individual services fail (graceful degradation)
  • Remaining is calculated as limit - currentUsage (clamped to 0)

Error Codes

Status Code Description Possible Cause
200 OK Request successful
400 Bad Request Invalid request
401 Unauthorized Missing or invalid authentication
403 Forbidden Insufficient permissions
500 Internal Server Error Quota cache not initialized or aggregation failure

Quotas vs Rate Limits

Understanding the difference between resource quotas and rate limits:

Aspect Resource Quotas Rate Limits
Purpose Cap total resources provisioned Cap request frequency
Scope Per customer account Per user or IP
Example Max 2 compute instances Max 10 API calls per minute
Enforcement Checked before resource creation Checked on every request
Endpoints /quotas/* /limits/*
Time dimension None (absolute count) Per time window (minute, hour, day, month)

Special Values

Value Meaning
-1 Unlimited (no quota enforced)
0 Feature disabled for this tier
> 0 Numeric quota enforced