Account API

Manage your Sales Webhooks account, API keys, usage metrics, and billing information.

Quick Reference

GET /api/v1/account
Get account information
PUT /api/v1/account
Update account details
GET /api/v1/account/api-keys
List API keys
POST /api/v1/account/api-keys
Create new API key
DELETE /api/v1/account/api-keys/:keyId
Revoke API key
GET /api/v1/account/usage
Get usage statistics

Get Account Information

Retrieve your account details including subscription plan and limits.

GET /api/v1/account

Response

{
  "id": "acc_8Xk9Lm3Np",
  "email": "john@company.com",
  "company_name": "Acme Corp",
  "created_at": "2024-01-15T10:30:00Z",
  "plan": {
    "name": "Professional",
    "tier": "professional",
    "subscription_limit": 1000,
    "webhook_limit": 100000,
    "polling_frequency": "hourly"
  },
  "usage": {
    "active_subscriptions": 342,
    "webhooks_this_month": 15420,
    "api_calls_today": 1234
  },
  "settings": {
    "timezone": "America/New_York",
    "webhook_retry_enabled": true,
    "email_notifications": true
  }
}

Update Account Details

Update your account information and settings.

PUT /api/v1/account

Request Body

{
  "company_name": "Acme Corporation",  // Optional
  "settings": {  // Optional
    "timezone": "Europe/London",
    "webhook_retry_enabled": false,
    "email_notifications": true
  }
}

Response

{
  "id": "acc_8Xk9Lm3Np",
  "email": "john@company.com",
  "company_name": "Acme Corporation",
  "settings": {
    "timezone": "Europe/London",
    "webhook_retry_enabled": false,
    "email_notifications": true
  },
  "updated_at": "2025-01-20T14:30:00Z"
}

API Key Management

Manage API keys for programmatic access to Sales Webhooks.

List API Keys

GET /api/v1/account/api-keys

Response

{
  "data": [
    {
      "id": "key_9Yx7Kj2Mn",
      "name": "Production API Key",
      "prefix": "lwa.sk_live_",
      "created_at": "2024-12-01T10:00:00Z",
      "last_used_at": "2025-01-20T13:45:00Z",
      "permissions": ["read", "write"],
      "status": "active"
    },
    {
      "id": "key_3Zk1No5Pr",
      "name": "Testing Key",
      "prefix": "lwa.sk_test_",
      "created_at": "2024-11-15T14:00:00Z",
      "last_used_at": null,
      "permissions": ["read"],
      "status": "active"
    }
  ]
}

Note: The full API key is never returned after creation for security.

Create API Key

POST /api/v1/account/api-keys

Request Body

{
  "name": "CI/CD Pipeline Key",  // Required: Descriptive name
  "permissions": ["read", "write"],  // Optional: Default is ["read", "write"]
  "expires_at": "2025-12-31T23:59:59Z"  // Optional: Expiration date
}

Response

{
  "id": "key_4Am2Op6Qs",
  "name": "CI/CD Pipeline Key",
  "api_key": "lwa.sk_live_vJ9kL3mNpQ2rS5tUvWxYz",  // Save this! Only shown once
  "permissions": ["read", "write"],
  "expires_at": "2025-12-31T23:59:59Z",
  "created_at": "2025-01-20T14:00:00Z"
}

Important: Save the api_key immediately. It's only shown once and cannot be retrieved later.

Revoke API Key

DELETE /api/v1/account/api-keys/:keyId

Response

{
  "success": true,
  "message": "API key revoked successfully"
}

Note: Revoked keys cannot be restored. Create a new key if needed.

Usage Statistics

Monitor your API usage and subscription metrics.

GET /api/v1/account/usage

Query Parameters

Parameter Type Description
period string "day", "week", "month" (default: "month")
start_date string ISO date (default: start of period)
end_date string ISO date (default: now)

Response

{
  "period": {
    "start": "2025-01-01T00:00:00Z",
    "end": "2025-01-31T23:59:59Z"
  },
  "limits": {
    "subscriptions": 1000,
    "webhooks_per_month": 100000,
    "api_calls_per_day": 10000
  },
  "usage": {
    "subscriptions": {
      "active": 342,
      "created_this_period": 45,
      "cancelled_this_period": 12,
      "utilization": 34.2
    },
    "webhooks": {
      "delivered": 45230,
      "failed": 89,
      "success_rate": 99.8,
      "utilization": 45.2
    },
    "api_calls": {
      "total": 156789,
      "by_endpoint": {
        "subscriptions": 45230,
        "webhooks": 12340,
        "account": 890
      },
      "by_day": [
        { "date": "2025-01-20", "calls": 5432 },
        { "date": "2025-01-19", "calls": 4890 }
      ]
    }
  },
  "top_events": [
    { "type": "contact.position_changed", "count": 12340 },
    { "type": "contact.post_created", "count": 8920 },
    { "type": "company.employee_count_changed", "count": 3450 }
  ]
}

Billing Information

View and manage billing details.

Console Management

For billing management, payment methods, and invoices, please use the Console interface.

Manage Billing →

Account Rate Limits

Rate limits are based on your subscription plan:

Plan API Calls/Day Burst Rate Concurrent Requests
Free 1,000 10/second 5
Starter 10,000 20/second 10
Professional 50,000 50/second 25
Enterprise Custom Custom Custom

Rate limit headers are included in every API response:

X-RateLimit-Limit: 50
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1674234567

Security Best Practices

🔐 API Key Security

  • Never commit keys - Use environment variables
  • Rotate regularly - Change keys every 90 days
  • Use least privilege - Create read-only keys when possible
  • Monitor usage - Check for unusual activity
  • Separate environments - Use different keys for dev/prod

Next Steps