Chronosfy API — Node.js Quickstart
Node 22 has built-in fetch. Set CHRONOSFY_AUTH to a scoped key or JWT from POST /auth/login.
const BASE = 'https://chronosfy.com/api';
const authorization = process.env.CHRONOSFY_AUTH;
async function create(path, body, key) {
const response = await fetch(BASE + path, { method: 'POST',
headers: { Authorization: authorization, 'Content-Type': 'application/json', 'Idempotency-Key': key },
body: JSON.stringify(body) });
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
return result;
}
const person = await create('/crm/persons', {"name":"Alice","email":"[email protected]","external_id":"customer-42","metadata":{"source":"integration"}}, 'person:customer-42:v1');
const action = await create('/actions', {"name":"Monthly reminder","type":"email","template":{"subject":"Reminder","body_html":"<p>Hello</p>"}}, 'action:reminder:v1');
const recurrence = await create('/recurrences', { ...{"name":"Monthly reminder","subject_type":"person","frequency_config":{"type":"monthly","day":31,"time":"09:00","timezone":"Europe/London"},"client_reference":"subscription-42"},
action_id: action.id, subject_id: person.id }, 'recurrence:subscription-42:v1');Use a scoped API key or a JWT from POST /auth/login. Keep one stable key per logical request, including after a timeout or process restart. Changing the payload with the same key returns 409.
Create keys are optional for persons/actions/recurrences, required for payment links. MCP uses request_key.
external_id is unique among active persons in a tenant; client_reference is a non-unique business reference.
For one-off purchases, recurring enrollment or standalone card storage, see /docs/quickstart/checkout for the hosted URL and embedded SDK.
For a direct Stripe Elements setup, configure a verified PSP and use /payment/setup-intent with Stripe.js.
Checkout can save a card with save_payment_method; first_run_at sets the earliest automatic recurrence.
See /docs/quickstart/renewals for the complete HTTP/MCP flow, permissions and recovery.
A 502/unknown outcome must reuse the original key, never create another payment identity.