Organizations
An organization is a separate Lantfly account that a team shares: its actors, runs, storages, listening projects, plan and credit belong to it. You sign in as yourself and act for the organization. The API offers two ways to do that.
Option 1: personal token plus X-Lantfly-Account
Send your personal API token and the organization's ID:
curl https://lantfly.com/api/v3/runs \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
-H "X-Lantfly-Account: 4821"
- You must be a member of that organization.
- Everything the request reads or writes belongs to the organization: a run you start is the organization's run and is billed to its plan.
- Your role in the organization applies (owner, admin, member or a custom role). An action your role doesn't allow
answers
403 permission_deniedwithdetails.permission. - Without the header, the same token acts for your personal account.
Find the organization ID in the Console under Settings → API & integrations → IDs while you act for the
organization, or in accounts of GET /me.
Option 2: organization token
Switch to the organization in the Console's account switcher, then create a token under Settings → API & integrations. That token:
- acts for the organization with no header;
- carries your current role there (change your role and the token follows);
- stops working when you leave or are removed from the organization;
- needs the Create API tokens permission (
tokens.create) to create, rename or regenerate. Only you, its creator, can rename or regenerate it. Owners and admins see the organization's tokens and can revoke any of them.
An organization token can't reach your personal settings: /me/profile, /me/avatar, /me/preferences and
/me/sessions answer 403.
When membership ends
If you're no longer a member (you left, were removed, or the organization was deleted), requests for it answer 403
with the response header:
X-Lantfly-Account-Revoked: 1
Treat that header as final: stop sending X-Lantfly-Account for that ID, or discard the organization token, and ask an
owner or admin to invite you again if you still need access.
What changes with the header
Only /api/v3 follows X-Lantfly-Account. Your identity (sign-in, email, password, two-step sign-in) always stays
your own.
| Case | Status | Code |
|---|---|---|
| Not a member of the organization | 403 | forbidden, with X-Lantfly-Account-Revoked: 1 |
| Role doesn't allow the action | 403 | permission_denied |
| Workspace is suspended (view only) | 423 | account_suspended |
| Billing is managed by the parent agency | 409 | billed_to_agency |
AI apps and organizations
An AI app connected through OAuth acts for the one account you picked when you allowed it. It can't
switch accounts with X-Lantfly-Account: connect the app again and pick the other organization.