Get Organization

Get your organization details.
GET /api/organization

Authentication

Authorization
string
required
Bearer token from login

Response

{
  "id": "org_123",
  "name": "My Company",
  "slug": "my-company",
  "plan": "pro",
  "api_key": "ak_1234567890abcdef",
  "is_active": true,
  "created_at": "2024-01-15T10:00:00Z"
}

Regenerate API Key

Generate a new API key for your organization.
POST /api/organization/regenerate-key
This immediately invalidates the old API key. All services using it will stop working until updated.

Response

{
  "id": "org_123",
  "name": "My Company",
  "api_key": "ak_newkey1234567890abcdef",
  "created_at": "2024-01-15T10:00:00Z"
}

Get Current Plan

Get details about your current plan and usage.
GET /api/billing/plan

Response

{
  "current_plan": "pro",
  "plan_details": {
    "name": "Pro",
    "price": 29,
    "interval": "month",
    "limits": {
      "max_agents": 10,
      "max_logs_per_month": 50000,
      "log_retention_days": 30,
      "max_team_members": 5,
      "features": [
        "advanced_permissions",
        "approval_workflows",
        "webhooks",
        "priority_support"
      ]
    },
    "description": "For growing teams"
  },
  "usage": {
    "logs_this_month": 12450,
    "agents_count": 5
  },
  "all_plans": {
    "free": { ... },
    "pro": { ... },
    "business": { ... },
    "enterprise": { ... }
  }
}

Get Subscription

Get active subscription details.
GET /api/billing/subscription

Response

{
  "id": "sub_123",
  "stripe_subscription_id": "sub_xyz789",
  "plan": "pro",
  "status": "active",
  "current_period_start": "2024-02-01T00:00:00Z",
  "current_period_end": "2024-03-01T00:00:00Z",
  "cancel_at_period_end": false
}

Get Invoices

Get billing invoice history.
GET /api/billing/invoices

Response

[
  {
    "id": "inv_123",
    "stripe_invoice_id": "in_abc123",
    "amount": 2900,
    "currency": "usd",
    "status": "paid",
    "invoice_pdf": "https://stripe.com/invoice.pdf",
    "created_at": "2024-02-01T00:00:00Z"
  }
]

Get Usage Stats

Get current usage and limits.
GET /api/limits/usage

Response

{
  "agents": {
    "current": 5,
    "limit": 10,
    "percentage": 50.0
  },
  "logs": {
    "current": 12450,
    "limit": 50000,
    "percentage": 24.9
  },
  "warnings": [
    {
      "type": "agents",
      "message": "Warning: You're using 8/10 agents. Consider upgrading soon.",
      "severity": "warning"
    }
  ],
  "plan": "pro"
}