API Overview
Complete REST API reference for Lambda compute platform.
Base URL
https://api.lambda.io/v1All API requests must be made over HTTPS. HTTP requests will be rejected.
Authentication
Lambda API uses API keys for authentication.
Getting Your API Key
Option 1: From the Dashboard (Recommended)
- Go to Dashboard → Settings → API Keys
- Click "Create New API Key"
- Give it a descriptive name
- Set permissions as needed
- Copy and save the key securely (shown only once)
Option 2: Using the CLI
lambda api-key create --name "my-api-key"
# Output:
API Key Created:
Name: my-api-key
Key: λ_sk_1234567890abcdef
Created: 2026-01-24T10:30:00Z
⚠️ Save this key securely. It won't be shown again.Using API Keys
Include your API key in the Authorization header:
curl -H "Authorization: Bearer λ_sk_1234567890abcdef" \
https://api.lambda.io/v1/instancesOr use the X-API-Key header:
curl -H "X-API-Key: λ_sk_1234567890abcdef" \
https://api.lambda.io/v1/instancesRate Limiting
| Plan | Requests/Hour | Burst |
|---|---|---|
| Free | 1,000 | 50 |
| Professional | 10,000 | 200 |
| Enterprise | 100,000 | 1,000 |
Rate limit headers are included in all responses:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9543
X-RateLimit-Reset: 1706097600HTTP 429 Too Many Requests when limit exceeded:
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 3600 seconds.",
"retry_after": 3600
}
}Response Format
Success Response
{
"success": true,
"data": {
"id": "inst_abc123",
"name": "my-instance",
"status": "running"
},
"metadata": {
"request_id": "req_xyz789",
"timestamp": "2026-01-24T10:30:00Z"
}
}Error Response
{
"success": false,
"error": {
"code": "invalid_request",
"message": "Invalid instance type specified",
"details": {
"field": "instance_type",
"value": "invalid-type",
"allowed_values": ["compute-1x", "compute-2x", "..."]
}
},
"metadata": {
"request_id": "req_xyz789",
"timestamp": "2026-01-24T10:30:00Z"
}
}Common Error Codes
| Code | HTTP Status | Description |
|---|---|---|
invalid_request | 400 | Malformed request |
authentication_failed | 401 | Invalid API key |
forbidden | 403 | Insufficient permissions |
not_found | 404 | Resource not found |
rate_limit_exceeded | 429 | Too many requests |
server_error | 500 | Internal server error |
service_unavailable | 503 | Temporary unavailability |
Pagination
List endpoints support pagination:
curl "https://api.lambda.io/v1/instances?page=1&limit=20" \
-H "Authorization: Bearer λ_sk_..."Response:
{
"success": true,
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total_items": 156,
"total_pages": 8,
"has_next": true,
"has_prev": false
}
}Filtering & Sorting
Filtering
# Filter by status
curl "https://api.lambda.io/v1/instances?status=running"
# Filter by region
curl "https://api.lambda.io/v1/instances?region=us-west-1"
# Multiple filters
curl "https://api.lambda.io/v1/instances?status=running®ion=us-west-1"Sorting
# Sort by created_at ascending
curl "https://api.lambda.io/v1/instances?sort=created_at&order=asc"
# Sort by name descending
curl "https://api.lambda.io/v1/instances?sort=name&order=desc"Webhooks
Subscribe to events via webhooks:
curl -X POST https://api.lambda.io/v1/webhooks \
-H "Authorization: Bearer λ_sk_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://your-app.com/webhook",
"events": ["instance.created", "instance.stopped"],
"secret": "your-webhook-secret"
}'Webhook Payload:
{
"id": "evt_abc123",
"type": "instance.created",
"timestamp": "2026-01-24T10:30:00Z",
"data": {
"instance_id": "inst_abc123",
"name": "my-instance",
"status": "running"
},
"signature": "sha256=..."
}Verify Signature:
const crypto = require("crypto");
function verifyWebhook(payload, signature, secret) {
const hmac = crypto.createHmac("sha256", secret);
const digest = "sha256=" + hmac.update(payload).digest("hex");
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest));
}API Endpoints
Instances
POST /v1/instances- Create InstanceGET /v1/instances- List InstancesGET /v1/instances/:id- Get InstancePATCH /v1/instances/:id- Update InstanceDELETE /v1/instances/:id- Delete InstancePOST /v1/instances/:id/start- Start InstancePOST /v1/instances/:id/stop- Stop InstancePOST /v1/instances/:id/restart- Restart InstancePOST /v1/instances/:id/resize- Resize Instance
Storage
POST /v1/volumes- Create VolumeGET /v1/volumes- List VolumesGET /v1/volumes/:id- Get VolumeDELETE /v1/volumes/:id- Delete VolumePOST /v1/volumes/:id/attach- Attach VolumePOST /v1/volumes/:id/detach- Detach VolumePOST /v1/volumes/:id/resize- Resize Volume
Snapshots
POST /v1/snapshots- Create SnapshotGET /v1/snapshots- List SnapshotsGET /v1/snapshots/:id- Get SnapshotDELETE /v1/snapshots/:id- Delete SnapshotPOST /v1/snapshots/:id/restore- Restore Snapshot
Networking
GET /v1/instances/:id/network- Get Network InfoPOST /v1/firewall/rules- Create Firewall RuleGET /v1/firewall/rules- List Firewall RulesDELETE /v1/firewall/rules/:id- Delete Firewall RulePOST /v1/vpn- Create VPNGET /v1/vpn- List VPNs
Monitoring
GET /v1/instances/:id/metrics- Get MetricsGET /v1/instances/:id/metrics/stream- Stream Metrics (WebSocket)
Billing
GET /v1/billing/usage- Get UsageGET /v1/billing/invoices- List InvoicesGET /v1/billing/invoices/:id- Get InvoiceGET /v1/billing/estimate- Estimate Cost
Account
GET /v1/account- Get Account InfoPATCH /v1/account- Update AccountGET /v1/account/quota- Get QuotasPOST /v1/account/api-keys- Create API KeyGET /v1/account/api-keys- List API KeysDELETE /v1/account/api-keys/:id- Delete API Key
SDKs
Official SDKs
- JavaScript/TypeScript:
npm install @lambda/sdk - Python:
pip install lambda-sdk - Go:
go get github.com/lambda/lambda-go - Ruby:
gem install lambda-sdk - Java: Maven/Gradle support
Community SDKs
- Rust:
cargo add lambda-rs - PHP:
composer require lambda/sdk - .NET:
dotnet add Lambda.SDK
Example: Create and Start Instance
Using cURL
# 1. Create instance
curl -X POST https://api.lambda.io/v1/instances \
-H "Authorization: Bearer λ_sk_..." \
-H "Content-Type: application/json" \
-d '{
"name": "my-api-instance",
"instance_type": "compute-4x",
"region": "us-west-1",
"image": "ubuntu-22.04",
"ssh_keys": ["key_abc123"]
}'
# Response: {"success": true, "data": {"id": "inst_xyz789", ...}}
# 2. Wait for instance to be ready
curl https://api.lambda.io/v1/instances/inst_xyz789 \
-H "Authorization: Bearer λ_sk_..."
# 3. Connect via SSH
ssh lambda@203.0.113.42Using JavaScript SDK
import { Lambda } from "@lambda/sdk";
const lambda = new Lambda({ apiKey: "λ_sk_..." });
// Create instance
const instance = await lambda.instances.create({
name: "my-js-instance",
instanceType: "compute-4x",
region: "us-west-1",
image: "ubuntu-22.04",
sshKeys: ["key_abc123"],
});
console.log(`Instance created: ${instance.id}`);
// Wait for ready
await instance.waitUntilReady();
// Get connection info
console.log(`SSH: ssh lambda@${instance.publicIp}`);Using Python SDK
from lambda_sdk import Lambda
lambda_client = Lambda(api_key='λ_sk_...')
# Create instance
instance = lambda_client.instances.create(
name='my-python-instance',
instance_type='compute-4x',
region='us-west-1',
image='ubuntu-22.04',
ssh_keys=['key_abc123']
)
print(f'Instance created: {instance.id}')
# Wait for ready
instance.wait_until_ready()
# Get connection info
print(f'SSH: ssh lambda@{instance.public_ip}')API Versioning
Lambda API uses URL-based versioning:
- Current:
v1(stable) - Beta:
v2(preview features)
Version Compatibility
| Version | Introduced | End of Life | Status |
|---|---|---|---|
| v1 | 2024-01-01 | TBD | ✓ Stable |
| v2 | 2026-01-01 | TBD | ⚠️ Beta |
Deprecation Policy:
- 12 months notice before EOL
- New features in latest version
- Critical bugs fixed in all versions
Best Practices
1. Use Idempotency Keys
For requests that create resources, use idempotency keys to prevent duplicates:
curl -X POST https://api.lambda.io/v1/instances \
-H "Idempotency-Key: unique-key-12345" \
-H "Authorization: Bearer λ_sk_..." \
-d '...'2. Implement Exponential Backoff
async function createInstanceWithRetry(data, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await lambda.instances.create(data);
} catch (error) {
if (error.status === 429) {
const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
await new Promise((resolve) => setTimeout(resolve, delay));
} else {
throw error;
}
}
}
}3. Validate Webhooks
Always verify webhook signatures to prevent spoofing.
4. Use HTTPS Only
Never make API calls over HTTP.
5. Rotate API Keys
Rotate API keys every 90 days.
Support
Next Step
Understand the pricing model.
Think Lambda, Think Privacy
