Welcome to the Lava API
The Lava API provides everything you need to implement usage-based billing for AI services. Our REST API follows standard HTTP conventions and returns JSON responses.Base URL
Authentication
All API endpoints (except the forward endpoint) use Bearer token authentication with your secret API key.Getting Your API Key
Manage Secret Keys
Create and manage your API secret keys in the Secrets page. New keys are auto-generated and shown only once—copy them immediately.
Forward Endpoint Authentication
The/forward endpoint uses a special authentication format to support AI proxy requests:
Alternative Authentication Headers
For compatibility with different AI providers, the forward endpoint also accepts:x-api-key(Anthropic style)x-goog-api-key(Google style)keyquery parameter (Google style)xi-api-key(ElevenLabs style)
Response Format
All API responses follow a consistent JSON structure:Success Response
Error Response
Rate Limiting
API requests are rate-limited to ensure platform stability:- Standard endpoints: 1000 requests/minute per API key
- Forward endpoint: No fixed limit (subject to wallet balance)
Pagination
List endpoints support cursor-based pagination:cursor: The ID of the last item from the previous pagelimit: Number of items to return (max 100, default 50)
Idempotency
POST requests support idempotency to prevent duplicate operations. Include anIdempotency-Key header with a unique value:
Metadata
Many endpoints support custom metadata for tracking and filtering:- Maximum 100 key-value pairs
- Keys and values: 1-255 characters
- Keys: ASCII letters, numbers, underscores only (no spaces/special chars)
- Values: Any string
x-lava-metadata header:
SDK Libraries
We provide official SDKs for popular languages:Status Codes
The API uses standard HTTP status codes:| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created successfully |
| 204 | Success with no content |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (invalid API key) |
| 402 | Payment required (insufficient wallet balance) |
| 404 | Resource not found |
| 429 | Too many requests (rate limited) |
| 500 | Internal server error |
Need Help?
- Documentation: lavapayments.com/docs
- Support: [email protected]
- Contact: lavapayments.com/contact