API Reference

API Overview

Complete REST API reference for Lambda compute platform.


Base URL

https://api.lambda.io/v1

All 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)

  1. Go to Dashboard → Settings → API Keys
  2. Click "Create New API Key"
  3. Give it a descriptive name
  4. Set permissions as needed
  5. 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/instances

Or use the X-API-Key header:

curl -H "X-API-Key: λ_sk_1234567890abcdef" \
  https://api.lambda.io/v1/instances

Rate Limiting

PlanRequests/HourBurst
Free1,00050
Professional10,000200
Enterprise100,0001,000

Rate limit headers are included in all responses:

X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9543
X-RateLimit-Reset: 1706097600

HTTP 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

CodeHTTP StatusDescription
invalid_request400Malformed request
authentication_failed401Invalid API key
forbidden403Insufficient permissions
not_found404Resource not found
rate_limit_exceeded429Too many requests
server_error500Internal server error
service_unavailable503Temporary 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&region=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

Storage

Snapshots

Networking

Monitoring

Billing

Account


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

See SDK Documentation →


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.42

Using 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

VersionIntroducedEnd of LifeStatus
v12024-01-01TBD✓ Stable
v22026-01-01TBD⚠️ 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.

Billing & Pricing →


Think Lambda, Think Privacy