All docs
Programmatic access

API Reference

Read-only API keys (Pro and above) and the structured JSON shapes for every resource.

Base URL

https://cmd.jehorizon.com

All API routes live under /api. Responses are JSON. Errors use HTTP status codes (400 for bad input, 401 for auth, 404 for not found, 500 for server). Every response includes ok: boolean.

Authentication

Create a read-only API key from Account → API Keys (Pro and above). Pass it as a bearer token:

curl https://cmd.jehorizon.com/api/leads \
  -H "Authorization: Bearer ccc_live_..."
Tenant isolation
Every API request is scoped to the business that owns the API key. There is no business_id query parameter — passing one would be ignored. This is enforced at the route layer for every tenant-scoped resource.

GET /api/leads

Returns the most recent leads for your business, newest first.

curl https://cmd.jehorizon.com/api/leads \
  -H "Authorization: Bearer ccc_live_..."

200 OK
{
  "ok": true,
  "_source": "db",
  "leads": [ { "id": "...", "customer_name": "...", "phone": "...", ... } ]
}

POST /api/leads

Create a lead. Only message is required. business_id is taken from your API key — any value you send is ignored.

curl -X POST https://cmd.jehorizon.com/api/leads \
  -H "Authorization: Bearer ccc_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "customer_name": "Sam Patel",
    "phone": "+15551234567",
    "source": "website",
    "service_type": "Generator install",
    "message": "Looking for a quote on a 22kW Generac.",
    "zip_code": "78704"
  }'

GET /api/account/summary

Returns plan, usage, and limits for the business that owns the key.

GET /api/account/export

Streams a CSV of every lead, customer, quote, and job tied to your business. Useful for one-off backups before cancellation. Scoped strictly to your tenant.

GET /api/followups

Returns the upcoming follow-up queue (the leads the AI will reach out to next, when, and why).

Rate limits

  • 60 req/min per API key on read endpoints.
  • 10 req/min per API key on write endpoints (POST /api/leads).
  • HTTP 429 on overrun, with Retry-After seconds.

Webhooks

Outbound webhooks (lead created, quote accepted, job completed) are on the roadmap. Public launch will ship lead-level webhooks first; quote and job webhooks follow within the same quarter. If you need them now, email support@jehorizon.com.

Versioning

There is no /v1 prefix today. We will introduce one before any breaking change, with a 90-day deprecation window and explicit changelog notice to every customer with an active API key.