Skip to main content

API Reference

The MLM Platform API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.

Base URL

https://api.mlm-platform.example.com/functions/v1

Authentication

All API requests require authentication using a tenant API key:
curl https://api.mlm-platform.example.com/functions/v1/users \
  -H "x-tenant-api-key: mlm_live_your_api_key"
See the Authentication Guide for more details.

Request Format

All POST/PUT requests should include:
Content-Type: application/json
Request bodies should be JSON-encoded:
{
  "email": "user@example.com",
  "membership_tier": "ORDINARY"
}

Response Format

All responses are JSON-encoded:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "email": "user@example.com",
  "membership_tier": "ORDINARY",
  "created_at": "2024-01-15T10:30:00Z"
}

Response Headers

HeaderDescription
X-EnvironmentCurrent environment (LIVE or SANDBOX)
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRequests remaining in window
X-RateLimit-ResetUnix timestamp when limit resets

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid input
401Unauthorized - Invalid API key
403Forbidden - Action not allowed
404Not Found - Resource doesn’t exist
409Conflict - Resource already exists
429Too Many Requests - Rate limited
500Internal Server Error

Error Response Format

{
  "error": "Human-readable error message",
  "code": "MACHINE_READABLE_CODE",
  "details": {
    "field": "email",
    "message": "Invalid email format"
  }
}

Pagination

List endpoints support pagination:
GET /v1/users?limit=20&offset=0
ParameterTypeDefaultDescription
limitinteger20Items per page (max 100)
offsetinteger0Number of items to skip

Rate Limiting

API requests are rate limited per API key:
TierRequests/Minute
Standard100
Enterprise1000
When rate limited, you’ll receive a 429 response with Retry-After header.

Idempotency

For POST requests that create resources, use the idempotency_key field to prevent duplicate operations:
{
  "user_id": "...",
  "amount": 99.99,
  "idempotency_key": "order_12345"
}
Requests with the same idempotency key within 24 hours return the original response.

Endpoints