Organizations and workspaces

Invite people to your organization, manage roles and memberships, review organization memory suggestions, and split spend across workspaces.

An organization is the tenant your key belongs to: it owns the members, vaults, shared memory, rules, and workspaces that a key can reach. Every call on this page acts on the organization your key names. There is no organization id to pass, and no way to address another organization.

Roles

A member has one of three roles: owner, admin, or member.

  • Owners and admins manage the organization: they list and invite members, change roles, remove members, manage workspaces, and review memory suggestions. A member who calls one of those routes gets 403 org_forbidden, or workspace_forbidden on a workspace route.
  • An owner's membership is immutable. Nobody can change an owner's role or remove an owner, and an owner cannot leave, so an organization always keeps one. Granting owner requires the caller to be an owner.

A role does not open a vault: an admin reads a vault's content only as a member of it.

Invite someone

POST /api/v1/org/members invites a person, addressed by email or by user_id, exactly one of the two. role is member (the default) or admin; to make someone an owner, change their role after they join.

curl https://api.cruxy.ai/api/v1/org/members \
  -H "Authorization: Bearer $CRUXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "email": "[email protected]", "role": "member" }'

The call creates an invitation, not a membership: nobody joins an organization without accepting. It answers 202 with the invitation, and the answer is the same whether or not the address has an account, so the call cannot be used to find out who does. Re-inviting an address with a live invitation returns that invitation unchanged, and one whose invitation has lapsed gets a fresh 14-day window. Inviting someone who is already a member is 409 org_member_exists.

GET /api/v1/org/invitations lists the invitations your organization has sent, live and settled, each with its email, role, and a status of pending, accepted, declined, or revoked. DELETE /api/v1/org/invitations/{invitation_id} withdraws one before it is accepted.

Accept or decline an invitation

The person invited acts with their own key. GET /api/v1/invitations lists the live invitations addressed to them across every organization, each with the inviting organization's org_name and the inviter's invited_by_email.

# See what you have been invited to.
curl https://api.cruxy.ai/api/v1/invitations \
  -H "Authorization: Bearer $CRUXY_API_KEY"
 
# Accept one, by its id. To decline instead, POST to .../decline.
curl -X POST https://api.cruxy.ai/api/v1/invitations/$INVITATION_ID/accept \
  -H "Authorization: Bearer $CRUXY_API_KEY"
  • POST /api/v1/invitations/{invitation_id}/accept joins the organization with the role the invitation offered and returns the new membership.
  • POST /api/v1/invitations/{invitation_id}/decline settles the invitation and creates nothing. It answers 204. The inviting organization sees the outcome on its invitation list.

An invitation that names somebody else, one that expired, one already settled, and one that never existed are all 404 invitation_not_found.

Once you belong to more than one organization, issuing a new key can no longer pick an organization for you: the request must name one, or it is refused with org_selection_required. Existing keys are unaffected.

Memberships

GET /api/v1/org/memberships lists the organizations you belong to, with your role in each. DELETE /api/v1/org/memberships/{org_id} removes your own membership from the organization the path names. Any member may leave; an owner cannot, and gets 403 org_forbidden. It is the one call on this page that takes an organization id, because the organization you leave need not be the one your key names.

Change a role or remove a member

GET /api/v1/org/members lists the organization's members with each one's user_id, email, and role.

  • PATCH /api/v1/org/members/{user_id} with {"role": "admin"} changes a member's role.
  • DELETE /api/v1/org/members/{user_id} removes a member.

Removing a member, or leaving, ends access and destroys nothing. The person's API keys bound to the organization are revoked in the same step. The memory they wrote at organization and vault scope is kept and frozen until an owner or admin settles it, and their own personal memory is never touched.

POST /api/v1/memories/departed/{user_id} settles a departed member's shared memory with a disposition: keep retains every row and moves authorship to you, and purge deletes them. The response reports how many rows were affected. A user who is still a member is 409 org_member_active, and one who wrote nothing in your organization is 404 org_member_not_found.

Suggest organization memory

Only an owner or admin can turn a suggestion into organization memory, and any member can make one. POST /api/v1/memories/suggestions takes a key and a value. A suggestion is not memory: it is never recalled or added to a turn until it is approved.

# Any member: propose a memory for the whole organization.
curl https://api.cruxy.ai/api/v1/memories/suggestions \
  -H "Authorization: Bearer $CRUXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "key": "deploy-window", "value": "Production deploys go out on Tuesdays." }'
 
# An owner or admin: read the pending queue, then approve one by its id.
curl "https://api.cruxy.ai/api/v1/memories/suggestions?status=pending" \
  -H "Authorization: Bearer $CRUXY_API_KEY"
 
curl -X POST https://api.cruxy.ai/api/v1/memories/suggestions/$SUGGESTION_ID/approve \
  -H "Authorization: Bearer $CRUXY_API_KEY"
  • Suggesting. Suggesting a key you already have pending replaces that pending value. The checks on a memory write apply: an empty value is refused, and content carrying obvious personal data is 400 pii_rejected.
  • Listing. GET /api/v1/memories/suggestions returns the newest 200. An owner or admin sees every member's; any other member sees only their own. status narrows it to pending, approved, or rejected.
  • Approving. POST /api/v1/memories/suggestions/{id}/approve writes the suggestion as organization memory under its key, replacing any organization memory already stored for that key, and names what it wrote in memory_id.
  • Rejecting. POST /api/v1/memories/suggestions/{id}/reject writes nothing. The suggestion is kept as rejected, and its author may suggest the key again.

Approving or rejecting an id your organization has no pending suggestion under is 404 memory_suggestion_not_found: one already approved or rejected, one in another organization, and one that never existed get the same answer. See Memory for how organization memory is recalled.

Workspaces

A workspace is a team's environment and spend budget inside an organization. Prompts and eval suites belong to the workspace a key names, and a workspace can carry a monthly spend cap. Every organization has a reserved default workspace. Workspace calls are for owners and admins.

curl https://api.cruxy.ai/api/v1/workspaces \
  -H "Authorization: Bearer $CRUXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Production", "slug": "production", "spend_cap_micros": 5000000 }'
FieldMeaning
nameRequired, 1 to 128 bytes.
slugA stable handle, derived from the name when omitted. One already used in the organization is 409 workspace_slug_exists, and default is reserved. It cannot be changed later.
spend_cap_microsAn optional monthly ceiling in micro-USD, a positive integer. Omit it, or send null, for no cap.

Chat enforces the cap against the workspace's summed cost: past it, a request from a key in the workspace is 429 workspace_spend_cap_exceeded; see Rate limits and budgets.

CallDoes
GET /api/v1/workspacesLists the organization's workspaces, the default first.
GET /api/v1/workspaces/{id}Returns one workspace.
PATCH /api/v1/workspaces/{id}Changes name, spend_cap_micros, or both. An explicit null cap removes the cap.
DELETE /api/v1/workspaces/{id}Deletes a workspace that has never held a key. One that has is 409 workspace_not_empty, and the default is 409 workspace_is_default.

Next steps

  • Standing rules: instructions that apply to every chat in the organization.
  • Memory: what chat recalls from organization memory.
  • Get your API key: the key that names your organization.
  • API Reference: every organization operation with its exact request and response shape.

Was this page helpful?