Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Lathe customer Analytics API
description: 'Manage your Lathe instances from code or from an AI agent.
**Authentication.** Create an API key on the Access page of the portal and send it as
`Authorization: Bearer lathe_…`. Keys act as the customer who created them; they cannot create or
revoke other keys.
**Creating an instance.** Where `GET /plans` offers Free, `POST /instances` with `tier: "free"` creates a $0 instance immediately, with no card or checkout; it returns `checkout_url: null`. Free has 1000 GB outbound traffic per month and no daily backups. A paid plan returns `checkout_url`:
open it in a browser and pay; the instance is provisioned as soon as the payment page returns and
the response''s `instance_id` is valid from the start (poll `GET /instances/{id}` - its `status` goes
`awaiting_payment` → `pending` → `creating` → `running`; `payment_failed` if the card was declined,
`error` if creation failed). A coupon that covers the whole first month skips the page. Every paid
purchase goes through the hosted page, card on file or not. Where the trial is offered (`GET /plans` →
`trial`), a customer''s first Mini starts with a 14-day free trial and the response says `trial: true`.
With `trial.card = "later"` the instance is created at once (`status: pending`, no `checkout_url`) and it is kept
from the portal''s billing page before the trial ends; without that it pauses and is deleted a week later. What
keeping it costs depends on the gateway: where a card can be verified and held, adding one charges nothing and the
first month is charged when the trial ends; where the provider holds the subscription itself there is no such page,
so keeping the instance is the purchase and the first month is charged at once, ending the trial there. With
`trial.card = "start"`, `checkout_url` verifies the card first (a temporary $1 authorisation that is released) and
the first month is charged when the trial ends.
**Slow operations are jobs.** Reset, restore, rotate, allowlist, upgrade, SQL console and delete
answer `202` with a `job_id`; one job runs per instance at a time and the instance answers `409`
while one is queued or running. Destructive actions (reset, restore, delete) require
`confirm` to equal the instance id. (The portal asks for the instance''s name instead, since that is what a
person knows; either is accepted.)
The same operations are available to AI agents over MCP: the server is the MCP host itself, no path.'
version: '1.0'
servers:
- url: /api/v1
tags:
- name: Analytics
paths:
/instances/{instance_id}/apps/{name}/analytics:
get:
tags:
- Analytics
summary: 'One app''s traffic over a window: totals and the period before, deltas, a…'
operationId: app_analytics_instances__instance_id__apps__name__analytics_get
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
- name: name
in: path
required: true
schema:
type: string
title: Name
- name: range
in: query
required: false
schema:
type: string
description: 1h, 24h, 72h, 7d, 30d, 90d or 365d; 24h when neither this nor from is given. Limited to what the plan keeps.
default: ''
title: Range
description: 1h, 24h, 72h, 7d, 30d, 90d or 365d; 24h when neither this nor from is given. Limited to what the plan keeps.
- name: from
in: query
required: false
schema:
type: string
description: Start of a window in UTC, such as 2026-09-30 or 2026-09-30T14:00:00Z, instead of range.
default: ''
title: From
description: Start of a window in UTC, such as 2026-09-30 or 2026-09-30T14:00:00Z, instead of range.
- name: to
in: query
required: false
schema:
type: string
description: End of that window in UTC; now when omitted.
default: ''
title: To
description: End of that window in UTC; now when omitted.
- name: compare
in: query
required: false
schema:
type: boolean
description: Also answer the period of the same length just before, and the deltas.
default: true
title: Compare
description: Also answer the period of the same length just before, and the deltas.
- name: path
in: query
required: false
schema:
type: string
description: Only requests stored under this path, exactly.
default: ''
title: Path
description: Only requests stored under this path, exactly.
- name: referrer
in: query
required: false
schema:
type: string
description: Only requests referred by this host, exactly; (direct) for none.
default: ''
title: Referrer
description: Only requests referred by this host, exactly; (direct) for none.
- name: status
in: query
required: false
schema:
type: string
description: Only this status code (404) or class (5xx).
default: ''
title: Status
description: Only this status code (404) or class (5xx).
- name: host_kind
in: query
required: false
schema:
type: string
description: 'Only requests to the app''s subdomain, a custom domain, or the box''s own name: subdomain, custom or box.'
default: ''
title: Host Kind
description: 'Only requests to the app''s subdomain, a custom domain, or the box''s own name: subdomain, custom or box.'
- name: breakdown
in: query
required: false
schema:
type: array
items:
type: string
description: paths, referrers, countries, devices, browsers, os, statuses, host_kinds; repeat or separate with commas. With a filter, only that filter's dimension.
default: []
title: Breakdown
description: paths, referrers, countries, devices, browsers, os, statuses, host_kinds; repeat or separate with commas. With a filter, only that filter's dimension.
- name: limit
in: query
required: false
schema:
type: integer
description: Rows per breakdown, 1 to 200.
default: 20
title: Limit
description: Rows per breakdown, 1 to 200.
- name: cursor
in: query
required: false
schema:
type: string
description: A breakdown's next_cursor, for its next page.
default: ''
title: Cursor
description: A breakdown's next_cursor, for its next page.
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/instances/{instance_id}/apps/{name}/analytics/health:
get:
tags:
- Analytics
summary: 'Whether the app is ok, degraded or down, and why: running, minutes up, server…'
operationId: app_health_instances__instance_id__apps__name__analytics_health_get
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
- name: name
in: path
required: true
schema:
type: string
title: Name
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/instances/{instance_id}/analytics/health:
get:
tags:
- Analytics
summary: The health of every app on the instance, with the worst verdict among them
operationId: apps_health_instances__instance_id__analytics_health_get
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/instances/{instance_id}/apps/{name}/analytics/changes:
get:
tags:
- Analytics
summary: What moved in the app's traffic, errors and response times, lined up with its…
operationId: app_changes_instances__instance_id__apps__name__analytics_changes_get
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
- name: name
in: path
required: true
schema:
type: string
title: Name
- name: range
in: query
required: false
schema:
type: string
description: As for analytics; 72h when neither this nor from is given.
default: ''
title: Range
description: As for analytics; 72h when neither this nor from is given.
- name: from
in: query
required: false
schema:
type: string
default: ''
title: From
- name: to
in: query
required: false
schema:
type: string
default: ''
title: To
- name: before
in: query
required: false
schema:
type: string
description: 'The next_before of the previous page: only what happened before this time.'
default: ''
title: Before
description: 'The next_before of the previous page: only what happened before this time.'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/instances/{instance_id}/apps/{name}/analytics/events:
get:
tags:
- Analytics
summary: The custom events the app sent, by name with their counts, or one event's…
operationId: app_events_instances__instance_id__apps__name__analytics_events_get
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
- name: name
in: path
required: true
schema:
type: string
title: Name
- name: range
in: query
required: false
schema:
type: string
description: As for analytics; 7d when neither this nor from is given.
default: ''
title: Range
description: As for analytics; 7d when neither this nor from is given.
- name: from
in: query
required: false
schema:
type: string
default: ''
title: From
- name: to
in: query
required: false
schema:
type: string
default: ''
title: To
- name: event
in: query
required: false
schema:
type: string
description: One event name, to see its properties.
default: ''
title: Event
description: One event name, to see its properties.
- name: limit
in: query
required: false
schema:
type: integer
description: Rows per page, 1 to 200.
default: 50
title: Limit
description: Rows per page, 1 to 200.
- name: cursor
in: query
required: false
schema:
type: string
description: The next_cursor of the previous page.
default: ''
title: Cursor
description: The next_cursor of the previous page.
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/instances/{instance_id}/apps/{name}/analytics/ask:
post:
tags:
- Analytics
summary: A question about the app's traffic in words, mapped to one of the answers above…
operationId: ask_app_analytics_instances__instance_id__apps__name__analytics_ask_post
parameters:
- name: instance_id
in: path
required: true
schema:
type: string
title: Instance Id
- name: name
in: path
required: true
schema:
type: string
title: Name
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AskIn'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
AskIn:
properties:
question:
type: string
title: Question
description: In words, such as "why did traffic drop yesterday?" or "top pages this week".
type: object
required:
- question
title: AskIn
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError