Skip to content

The customer API ​

The API of kernable Cloud's customer service: what the kernable cloud CLI and the console use, and what your own tools may use. It is kept stable: a change that would break a client gets a new path, the old one keeps working until it is announced gone.

Base URL: the customer service's address (for kernable Cloud, https://api.kernable.cloud, the CLI's default). Bodies: JSON, content-type: application/json. Errors: a status code and {"error": "<code>", "message": "<what happened>"}.

Authentication ​

Every call but those marked public needs an Authorization header, one of:

  • Bearer <access token> — an account's session: from POST /v1/sessions (or a passkey, GitHub, or the CLI's device login). Access tokens are short-lived; POST /v1/sessions/refresh gives a new pair.
  • ApiKey <token> — an API token (POST /v1/organizations/{organization}/tokens): for CI and tools. It is made for one project of one organization, with a role (for CI usually developer), and reaches nothing else of the organization; it needs no second factor and ends when it expires or is revoked.

The console (console.kernable.cloud) holds its session in cookies instead: POST /v1/sessions, /v1/sessions/refresh and /v1/passkeys/sign-in from the console's origin with the header X-Kernable-Console: 1 answer with HttpOnly, Secure, SameSite=Strict cookies (kn_access, and kn_refresh on /v1/sessions) and no tokens in the body; a request carrying the cookie is taken only with that origin and header. The API answers CORS for the console's origin alone.

Roles in an organization, each including the ones below it: viewer (read), developer (works with projects), admin (projects, members, tokens), owner (agreements, payment, the organization itself). Owners must have a second factor; writes by an owner without one in the session are refused.

Accounts and sessions ​

CallBodyAnswersWho
POST /v1/accountsemail, name, password (optional with passkey/GitHub)202, a verification mail goes out; 403 sign_up_closed where registration is by invitation (kernable Cloud)public, rate-limited
POST /v1/sign-up-invitations/peektoken (from the invitation's link)email, the invited address; 400 invalid_token once it expired, was used or revokedpublic, rate-limited
POST /v1/sign-up-invitations/accepttoken, name, password201, account: the account, verified, with its personal organization; 409 account_exists if the address has onepublic, rate-limited
POST /v1/accounts/verifytoken (from the mail)200public
POST /v1/sessionsemail, password, code (TOTP, if set up)access_token, refresh_tokenpublic, rate-limited
POST /v1/sessions/refreshrefresh_tokena new pairpublic
DELETE /v1/sessions—204the session
GET /v1/me—the account: email, name, second factors, organizationsthe session
POST /v1/me/totp—a TOTP secret to scanthe session
POST /v1/me/totp/confirmcode200, TOTP activethe session
POST /v1/me/passkeys/options—WebAuthn creation optionsthe session
POST /v1/me/passkeyslabel, response (the browser's credential)200the session
POST /v1/passkeys/options—WebAuthn request optionspublic
POST /v1/passkeys/sign-inthe browser's assertionaccess_token, refresh_tokenpublic
POST /v1/oidc/{provider}/start—url to send the browser to (github)public

The CLI's device login ​

CallBodyAnswersWho
POST /v1/cli/deviceclientdevice_code, user_code, verification_uri, verification_uri_complete, expires_in, interval (RFC 8628)public
POST /v1/cli/tokendevice_codeaccess_token, refresh_token once approved; 400 with authorization_pending (or slow_down, expired_token, access_denied) until thenpublic
POST /v1/cli/device/approveuser_code200the session (with its second factor)

Organizations, members, tokens ​

CallBodyAnswersRole
GET /v1/organizations—your organizations with your role in each; missing: what keeps an organization from a new project; billing_status (Stripe's: active, past_due, unpaid, canceled, …) and billing_ends_at (ms), if it is set to endany account
POST /v1/organizationsslugthe new organization (you its owner)any account
DELETE /v1/organizations/{organization}—deletion requested: the organization goes after 30 daysowner
POST /v1/organizations/{organization}/restore—the deletion withdrawnowner
POST /v1/organizations/{organization}/agreements—the terms and the Preview Access acceptedowner
POST /v1/organizations/{organization}/payment-method—url: the payment page (Stripe Checkout) to send the owner to; billing counts once it is paid. 409 billing_set_up if it is (and has not ended)owner
GET /v1/organizations/{organization}/usage?month=<yyyy-mm>—the month's usage of all the organization's copies (this month by default, UTC): copies, total (stored_gb_months, sent_gb); included: what the monthly fee includes (stored_gb_months, sent_gb)viewer
POST /v1/organizations/{organization}/billing/portal—url: the billing portal (invoices, the payment method, cancelling)owner
PUT /v1/organizations/{organization}/two-factorrequired (bool)every member must have a second factorowner
GET /v1/organizations/{organization}/members—members and rolesviewer
PUT /v1/organizations/{organization}/members/{identity}rolethe new role (not above your own)admin
DELETE /v1/organizations/{organization}/members/{identity}—removedadmin
POST /v1/organizations/{organization}/invitationsemail, roleinvitation; a mail goes outadmin (owner to invite an owner)
POST /v1/invitations/accepttoken; without a session token, name, passwordjoined; without a session, an account for the invited address is made and joins (sign_in_first if it has one)the invited account, or the invited person
GET /v1/organizations/{organization}/tokens—the organization's API tokens (no secrets)admin
POST /v1/organizations/{organization}/tokenslabel, role, project, expires_days (optional)the token, shown onceadmin
DELETE /v1/organizations/{organization}/tokens/{id}—revokedadmin

The audit log ​

Every change made through this API in an organization is recorded: by whom, what, on what. Entries are never changed or removed while the organization exists.

CallBodyAnswersRole
GET /v1/organizations/{organization}/audit?before=<position>&limit=<n>—up to limit entries (100 by default, 500 at most) older than before, newest first: position, at (ms), actor (account:<id> or token:<id>) and actor_name (an email, a token's label), action, subject and subject_name, detailadmin

The actions: organization.created, organization.terms, organization.payment, organization.two-factor, organization.deletion, organization.restored, member.invited, member.joined, member.role, member.removed, token.created, token.revoked, project.created, project.root_set, project.root_replacing, project.root_replaced (also by kernable, when the 7 days are up), project.root_replaced_now, hosted.allowed (by kernable), hosted.on, hosted.client_ca, hosted.off, partition.linked, partition.unlinked, node.token, and billing.status (by stripe: the subscription changed there, e.g. cancelled in the portal). To page back, pass the last entry's position as before.

Projects ​

kernable Cloud runs no project's code: a project is the organization's record that its kernels link to.

CallBodyAnswersRole
GET /v1/organizations/{organization}/projects—the organization's projectsviewer
POST /v1/organizations/{organization}/projectsname, plan (optional)the project, recordedadmin
GET /v1/organizations/{organization}/projects/{name}—the project, with its root (key_id, since) and, during a replacement, previous_root (key_id, until)viewer
PUT /v1/organizations/{organization}/projects/{name}/rootkey: the content of root.pub (64 hex digits); now (optional): true ends the old root at oncethe project. The first root is set; a later one keeps the old root valid until finish, 7 days at most. 409 replacing during a replacement, same_rootadmin
GET /v1/organizations/{organization}/projects/{name}/hosted—offered, allowed and used (hosted kernels the organization may run and runs), its hosted kernel (name, since, client_ca) or null, its url, and its status at the kernel server (state, ready, kernel_key, pusher_key, server_ca, bytes, problem)viewer
PUT /v1/organizations/{organization}/projects/{name}/hostedclient_ca: one PEM certificateturns the hosted kernel on, or gives it another client CA; as GET. 403 hosted_limit, 409 no_root, 400 invalid_caadmin
DELETE /v1/organizations/{organization}/projects/{name}/hosted—turns it off (its data is kept 30 days); as GET. 409 hosted_offadmin
POST /v1/organizations/{organization}/projects/{name}/root/finish—the project: the old root no longer valid; 409 not_replacingadmin
GET /v1/organizations/{organization}/projects/{name}/usage?month=<yyyy-mm>—the month's usage of its partitions' copies (this month by default, UTC): copies (copy, project, partition, stored_gb now, stored_gb_months, sent_gb, at), total, includedviewer
GET /v1/organizations/{organization}/projects/{name}/links—relay, project and its links: each partition's copy and keys (key, role push or read, state active, stopped or revoked, since, by), and those ended within 30 daysviewer
PUT /v1/organizations/{organization}/projects/{name}/links/{partition}pusher: its key ID (64 hex digits)relay to push to and the link; 409 pusher_active while another pusher of the partition is activedeveloper
PUT /v1/organizations/{organization}/projects/{name}/links/{partition}/keys/{key}role (a new key only): push or read; state (default active): active, stopped or revokedrelay and the link; 404 not_linked, 409 pusher_active, 409 revoked (for good), 400 other_roledeveloper
DELETE /v1/organizations/{organization}/projects/{name}/links/{partition}—the link, ended (removed_at): the copy is kept 30 daysadmin
POST /v1/organizations/{organization}/projects/{name}/nodes/tokensinstancetoken: a one-time join token for a managed node, valid 24 hoursadmin