Baselyne API

The Baselyne API gives you programmatic access to your business data — customers, jobs, invoices, and intelligence. Every request is authenticated with an API key and rate-limited per key.

Base URL

https://baselyne.ca/api/v1/

Quick Start

curl https://baselyne.ca/api/v1/customers \ -H "Authorization: Bearer bsl_live_your_key_here"

Response Format

Every response returns a consistent JSON shape:

{ "data": [...], "meta": { "total": 142, "page": 1, "per_page": 20, "has_more": true }, "error": null }

Customers

GET/api/v1/customers

List customers. Supports pagination and name search.

Scope: customers:read
Query params: page (default: 1), per_page (default: 20, max: 100), search (name/email filter)
GET/api/v1/customers/:id

Get a single customer by ID.

Scope: customers:read

Jobs

GET/api/v1/jobs

List jobs. Filter by status or trade category.

Scope: jobs:read
Query params: page, per_page, status (scheduled, in_progress, completed, etc.), trade_category

Invoices

GET/api/v1/invoices

List business invoices. Filter by status.

Scope: invoices:read
Query params: page, per_page, status (draft, sent, paid, overdue)

Intelligence

GET/api/v1/intelligence/churn

Customer health scores for churn prediction.

Scope: intelligence:read
Query params: tier (healthy, at_risk, churning)
GET/api/v1/intelligence/capacity

4-week capacity forecast.

Scope: intelligence:read

Webhooks

POST/api/v1/webhooks

Register a webhook endpoint. Returns the signing secret once.

Scope: webhooks:write
Query params: url (HTTPS required), events (array of event names)
GET/api/v1/webhooks

List registered webhooks. Secrets are not returned.

Scope: webhooks:write

Available events: customer.created, invoice.sent, job.completed

Error Codes

StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
403INSUFFICIENT_SCOPEKey doesn't have the required scope
404NOT_FOUNDResource not found
429RATE_LIMITEDToo many requests — check Retry-After header
400VALIDATION_ERRORInvalid request body or params
500INTERNAL_ERRORUnexpected server error