Skip to main content

Organizations page

An organization groups teams, members, models and budgets above the team level. The Organizations page is where you create and delete organizations, add and remove their members, change their limits and access, and set up single sign-on and SCIM for one organization. It lives at /ui/organizations and sits under ACCESS CONTROL in the left nav as Organizations. The nav item shows for the session roles Admin (proxy_admin) and Admin Viewer (the view-only proxy_admin_viewer), and for organization admins (the session role Org Admin, or a user who holds org_admin in at least one organization). For an organization admin the item is also hidden when a proxy admin has set the enabled_ui_pages_internal_users UI setting and left organizations out of it.

The whole page needs an Enterprise license. Without one it shows only "This is a Spanway Enterprise feature, and requires a valid key to use. Get a trial key here." with a link to pricing. The SSO tab of an organization also needs the organization_sso license feature.

Opening an organization puts it in the URL as /ui/organizations?org=<organization_id>, and the open tab as &org_tab=<tab>, so you can share a link to one tab of one organization.

A real-world scenario​

A holding company runs the gateway for two business units. The admin creates an organization per unit with its own budget and models, makes each unit's lead an org admin, and each lead then creates teams inside their organization without seeing the other unit's teams.

Steps​

  1. Open Organizations under Access Control, or go to /ui/organizations, and click + Create New Organization.

  2. Name it, pick its models, set its budget, and click Create Organization. The same with the API:

    curl -X POST http://localhost:4000/organization/new \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
    -d '{"organization_alias": "research", "max_budget": 5000, "budget_duration": "30d", "models": ["claude-sonnet-5-5", "claude-haiku-5-5"]}'
  3. Open the organization, select the Members tab and add the lead with the org_admin role.

Expected result​

"Organization created successfully" shows, the lead sees only their organization, and teams created in it can only use its models.

Organization list​

The page opens with + Create New Organization, shown only to proxy admins (session role Admin), and the line "Click on an organization ID to view its details." followed by a Read the Organizations guide link to this page.

Search and filters​

ControlTypeWhat it does
SearchText boxPlaceholder "Search by Organization Name". Asks the gateway for organizations whose name matches.
FiltersToggle buttonShows or hides the extra filter row. It shows a marker when a filter is active.
Reset FiltersButtonClears the name search and the ID filter.
Organization ID filterText boxIn the extra row. Placeholder "Search by Organization ID".

Columns​

The table sorts and pages in the browser, 25 rows per page, newest first by default.

ColumnMeaning
Organization IDThe ID. Click it to open the organization. Sortable.
Organization NameThe alias, or "-". Sortable.
CreatedThe creation date. Sortable.
Spend (USD)Total spend of the organization, with four decimals. Sortable.
Budget (USD)The max budget, or "Unlimited".
ModelsThe models the organization may use. An empty list shows as all proxy models.
TPM / RPM LimitsThe token and request per minute limits, or "Unlimited".
MembersThe member count, such as "4 Members".
ActionsA row menu with Edit and Delete, shown only to the session role Admin.

Edit opens the organization on its Settings tab. Delete opens Delete Organization?, which shows the organization ID and says "Are you sure you want to delete this organization? This action cannot be undone." Confirming deletes the organization and shows "Organization deleted successfully". The gateway also deletes every team in the organization, every membership and the keys that belong to the organization, all in one database transaction, so if any step fails nothing is deleted and you can simply try again. Before that transaction it disconnects the organization's code graph repositories and removes their stored credentials, and doing that again on a retry is harmless. Each removed organization, team and key gets its own deleted row in the audit log as soon as the transaction completes. None of it can be restored, so move teams and keys you want to keep before you delete. Only a proxy admin can delete an organization, and the gateway enforces that.

Create Organization dialog​

FieldTypeWhat it does
Organization NameText boxRequired ("Please input an organization name").
ModelsModel pickerThe models the organization may use, including the special all proxy models option.
Existing BudgetSearch pickerOptional. Picks a budget from the Budgets page by its ID, with its max budget and reset period as the second line. When one is picked the organization shares that budget, the note "The organization shares the selected budget. Its limits come from that budget, so the budget fields below are not sent." appears, and the budget fields down to Per-Model Budgets are disabled. Leave it empty to create a budget from those fields.
Max Budget (USD)NumberOptional. Must be a number of 0 or more. Requests fail once it is spent.
Reset BudgetDropdownNo reset, daily, weekly or monthly. Defaults to No reset.
Tokens per minute Limit (TPM)NumberOptional. A whole number of 0 or more.
Requests per minute Limit (RPM)NumberOptional. A whole number of 0 or more.
Tokens per day Limit (TPD)NumberOptional. A whole number of 0 or more, counted by batch submissions on the organization's keys, teams and customers.
Per-Model BudgetsRepeating rowsOptional. Add Model Budget adds a row with a model picker, a dollar cap and a window (Hourly, Daily, Weekly, Monthly or Calendar month). Caps spend for that model below the organization budget.
Model-Specific LimitsRepeating rowsOptional. Add Model Limit adds a row with a model name, a TPM and an RPM, enforced on every key in the organization. A row without a model or without a value is left out, and a value that is not a whole number blocks the create ("Must be a non-negative whole number").
Maximum key lifetime (days)NumberOptional. Keys of this organization expire at most this many days after they are created, stored in the organization metadata as max_key_lifetime_days. The stricter of this and the gateway cap wins. A value outside 1 to 3650 blocks the create ("Must be a whole number of days from 1 to 3650"). Needs a license granting key_hygiene. Without it the gateway refuses the value with a 403, because the hourly job that applies it does not run. See leaked keys and key expiry.
Allowed Vector StoresSelectorPlaceholder "Select vector stores (optional)". Leave it empty for access to all vector stores.
Allowed MCP ServersSelectorPlaceholder "Select MCP servers and access groups (optional)". Picks MCP servers, access groups and toolsets. Leave it empty for access to all.
Data policyGroup of switchesRequire zero data retention, Forbid training on request data, Restrict code traffic to ZDR or self-hosted models, Also scan prompts for code and Allowed regions (placeholder "Any region", with EU, United Kingdom, Switzerland, United States, Canada and Asia Pacific).
MetadataText areaOptional. Must be a valid JSON object ("Metadata must be a valid JSON object").

The dialog offers no soft budget and no parallel request cap. The API accepts both. max_parallel_requests on an organization caps how many requests all of its keys may have running at once, and one more gets a 429 with x-spanway-rate-limited-by: organization, see rate limits. soft_budget is stored but not acted on for organizations, so no alert fires. To be warned before a budget runs out, set a soft budget on a team or key, see budget alerts.

Create Organization reads "Creating..." while it runs. On success "Organization created successfully" shows and the dialog closes. Cancel and closing the dialog throw away the form, except while a create is running.

The gateway lets only a proxy admin create organizations, so the button is hidden from everyone else.

Organization detail view​

Back to Organizations returns to the list. The header shows the organization name and ID with a copy button. The tabs are Overview, Members, Settings and SSO.

Overview tab​

CardWhat it shows
Organization DetailsCreated and updated dates and who created it.
Budget StatusSpend "of" the max budget or "Unlimited", and the reset period when set.
Rate LimitsTPM and RPM, or "Unlimited". A max parallel requests value stored through the API shows here too, and the gateway enforces it: once that many requests from the organization are in flight, the next one gets a 429.
ModelsThe organization's models, or "All proxy models".
TeamsLinks to each team in the organization.
Object permissionsThe vector stores, MCP servers and other resources the organization may use.

Members tab​

The member table has a search box ("Search by name, email, or user ID"), a Filters drawer with an organization role filter (default "All Roles"), and the columns Name, User Email, User ID, Organization Role, Spend (USD), Created At and Actions. The default proxy admin user shows as a "Default Proxy Admin" badge in the User ID column.

ControlWhat it does
Add MemberOpens Add Organization Member.
Edit member (pencil)Opens Edit Member to change the member's role.
Delete member (trash)Opens Remove followed by the member's email or user ID and "from the organization?", which says "They lose their organization role and the access it gives. Their user account, keys and team memberships are kept." Remove member removes them and Cancel keeps them. A removed member has to be added again.

Add Organization Member explains that the search only finds users that already exist, and that a proxy admin must create a new person's account first. Search by Email or by User ID, then pick a Member Role.

RoleMeaning
org_adminCan add and remove members and change their roles.
internal_userCan view and create keys for themselves within the organization. The default.
internal_user_viewerCan only view their keys within the organization.

Add Member is disabled until you pick a user and reads "Adding..." while it runs. Edit Member shows the member's email and user ID and a Role dropdown with the current role, offering Org Admin, Internal User and Internal User Viewer. Save Changes applies it.

Settings tab​

The Organization Settings card shows Organization Name, Organization ID, Created At, Models, Rate Limits, Budget (Max, or "No Limit", and Reset, or "Never") and the object permissions. Edit Settings opens the form.

FieldTypeWhat it does
Organization NameText boxRequired.
Require two-factor sign-inSwitchMembers who sign in with a username and password must use an authenticator app code.
ModelsModel pickerProxy admin only.
Max Budget (USD)NumberProxy admin only.
Reset BudgetDropdownProxy admin only. No reset, daily, weekly or monthly.
Tokens per minute Limit (TPM)NumberProxy admin only.
Requests per minute Limit (RPM)NumberProxy admin only.
Maximum key lifetime (days)NumberProxy admin only. The organization's key lifetime cap from its metadata, shown here instead of in the Metadata text area. Clearing it removes the cap, so only the gateway cap applies. Needs a license granting key_hygiene, and the gateway answers 400 for anything but a whole number from 1 to 3650.
Per-Model BudgetsRepeating rowsProxy admin only. The same rows as the create dialog. Removing the last row clears the per-model budgets.
Model-Specific LimitsRepeating rowsProxy admin only. Shows the per-model TPM and RPM stored in the organization metadata as rows, so they no longer appear in the Metadata text area. Saving writes the rows back into the metadata, and removing every row removes them.
Vector StoresSelectorProxy admin only.
MCP Servers & Access GroupsSelectorProxy admin only.
Data policyGroup of switchesProxy admin only. The same switches as the create dialog.
MetadataText areaMust be a valid JSON object.

For anyone who is not the session role Admin, the proxy admin only fields are disabled and a note says "Only a proxy admin can change the models, budgets, rate limits, vector stores, MCP servers and data policy. As an organization admin you can change the name, two-factor sign-in and metadata." Save Changes sends only the fields you changed, is disabled until you change something, and reads "Saving..." while it runs. On success "Organization settings updated successfully" shows.

SSO tab​

The tab is wrapped in a license check titled Organization single sign-on. Without the organization_sso feature it shows "Organization single sign-on needs a Spanway Enterprise license" and a link to get a trial license. With it the tab has three cards.

Identity providers lists the organization's providers with Name, Protocol, Redirect / ACS path and Enabled. Register the path shown, prefixed with the gateway URL, at your identity provider. When there are none it says "No identity provider yet."

ControlWhat it does
Add identity providerOpens the provider form below the table.
EnabledSwitch. Turns sign-in through this provider on or off right away.
EditOpens the form for that provider.
RemoveOpens Remove the followed by the connection name and "connection?", which says "Nobody can sign in through this identity provider any more, and domains routed to it fall back to the organization's other connections. Users it created keep their accounts." Remove connection deletes the provider and Cancel keeps it.
FieldWhat it does
Display nameThe name shown for the provider.
ProtocolOpenID Connect or SAML 2.0.
Issuer URL, Client ID, Client secret, ScopesOpenID Connect settings. When editing a provider that already has a secret, the label reads "Client secret (leave blank to keep the current one)".
IdP metadata URL, IdP metadata XML (if there is no URL)SAML settings.
Groups claim or attributeWhere the provider sends the user's groups.
Default team IDThe team new users join.
Default organization roleorg_admin, internal_user or internal_user_viewer.
Role mappings, one group=role per lineMaps groups to organization roles. A role that is not an organization role shows "Not an organization role" and blocks saving.
Team mappings, one group=team_id per lineMaps groups to teams.

Add identity provider or Save identity provider saves the form and shows "Identity provider added" or "Identity provider saved". Cancel closes it.

Email domains routes sign-ins from a verified email domain to this organization. Type a domain and click Claim domain. Each claimed domain shows Domain, Status (Verified or Pending), Signs in through (a dropdown with First enabled provider or a named provider) and, while pending, the DNS TXT record name and value with a copy button. Add that TXT record at your DNS host and click Verify. A proxy admin also gets Mark verified, which skips the DNS check. Another organization can hold a pending claim on the same domain, and the first one to verify keeps it. Remove opens Release followed by the domain, which says "People with this email domain go back to the gateway-wide sign-in options. To claim the domain again you add it and prove ownership with a new DNS record." Release domain drops the domain and Cancel keeps it.

SCIM provisioning issues tokens your identity provider uses to sync users and groups into this organization only. Users it creates join the organization, and groups it creates become teams of the organization. Create SCIM token shows the new token once with a copy button and the SCIM base URL. Copy it then, because it is not shown again. The token list shows Name and Created, and Revoke opens Revoke the SCIM token followed by the token name, which says "Your identity provider can no longer create, update or deactivate users with this token, so user sync stops until you give it a new token. This cannot be undone." Revoke token deletes the token and Cancel keeps it. Provisioning with a revoked token stops working.

Empty, error and disabled states​

SituationWhat you seeWhat to do
No license"This is a Spanway Enterprise feature, and requires a valid key to use."Add an Enterprise license.
No organizations"No organizations yet" and "Create an organization to group teams, models, and budgets."Create one.
Search finds nothing"No matching organizations"Change or reset the search.
Detail loading or missing"Loading..." or "Organization not found"Check the ID in the URL.
Member add, update or delete fails"Failed to add organization member", "Failed to update organization member" or "Failed to delete organization member"Check your role and that the user exists.
Create or settings save failsThe gateway's error in a toastFix the input or ask a proxy admin.
Proxy admin only fieldsDisabled, with the note aboveAsk a proxy admin.
Save Changes disabledThe button is greyed outChange at least one field.
SSO without the license feature"Organization single sign-on needs a Spanway Enterprise license"Add the organization_sso feature to the license.

Differences by role and license​

Role or settingEffect on this page
Proxy admin (session role Admin)Sees every organization, the row menu, every settings field, and Mark verified on domains.
View-only admin (proxy_admin_viewer)Gets session role Admin Viewer and reads every organization under the view-only banner, without the create button, the row menu or the edit controls. The gateway refuses writes for this role.
Organization adminSees the organizations the gateway returns for them, with no row menu and no + Create New Organization. In an organization where they hold org_admin, they can edit the name, two-factor switch and metadata, manage members, and open the SSO tab.
Everyone else who opens an organizationThe detail view is read only. Add Member, the member actions, Edit Settings and the SSO tab show only for a proxy admin or an org_admin member of that organization.
enabled_ui_pages_internal_usersWhen set without organizations, organization admins do not see the nav item.
Enterprise licenseNeeded for the whole page. The SSO tab also needs the organization_sso license feature.

API​

Everything on this page has an API route. The ones the Admin UI does not show directly are these.

RouteWhat it does
PATCH /v2/organization/{organization_id}Changes an organization by its id. Fields left out keep their value, models takes [] to clear it, and organization_alias cannot be cleared. The Settings tab saves through this route.
PATCH /organization/updateThe older update route, with organization_id in the body.
GET /organization/daily/activitySpend, tokens and requests per day for organization_ids (comma separated) between start_date and end_date. Proxy admins and admin viewers see every organization, organization admins only their own.
GET /organization/spend/reportSpend for one organization over a date range, grouped by key with a per model and per team breakdown. Defaults to the caller's own organization.
curl -X PATCH "http://localhost:4000/v2/organization/org-research" \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"organization_alias": "research", "max_budget": 8000}'

The answer is the organization after the change, with its members, teams and budget.

metadata.allowed_ips limits the addresses the organization's keys may be used from. Only a proxy admin can set or change it, and it needs the IP allow-list license feature. See per organization IP allow-lists. Turning on require_mfa when you create an organization needs an Enterprise license as well.

Audit​

Every change on this page writes a row to the audit log. Creating, updating and deleting an organization write rows on Spanway_OrganizationTable with the organization before and after. Deleting an organization also writes a deleted row for each team on Spanway_TeamTable and each key on Spanway_VerificationToken it removed, and the deleted teams are kept in the deleted teams list. Adding, changing and removing a member write rows on Spanway_OrganizationMembership.

Errors​

What you seeWhat it meansFix
No + Create New Organization buttonOnly proxy admins create organizations.Sign in as a proxy admin.
org_model_access_denied on requestsThe organization's models do not include that model.Add it in the organization's Settings tab.
budget_exceeded for the organizationThe organization spent its budget.Raise it.
The SSO tab shows a license noticeOrganization SSO needs organization_sso.Add the feature.

The API routes answer these errors, with the body {"detail": {"error": "<message>"}} unless noted.

Status and messageCauseFix
403 Organizations are only available for Spanway Enterprise users...The gateway has no Enterprise license.Add the license.
401 Only admins can create orgs. Your role is = <role>A caller who is not a proxy admin tried to create an organization.Ask a proxy admin.
401 Only proxy admins can delete organizationsA caller who is not a proxy admin tried to delete.Ask a proxy admin.
403 You do not have access to this organizationThe caller is neither a proxy admin nor an org_admin of that organization.Ask an admin of the organization.
403 Only a proxy admin can change <fields> on an organization...An organization admin sent a field only a proxy admin may change.Send only the name, require_mfa or metadata.
403 Only proxy admins can set data_policy on this organizationAn organization admin sent a data policy that differs from the stored one.Ask a proxy admin to change it.
400 or 422 max_budget must be a non-negative finite number...The budget is negative, infinite or not a number. The older routes answer 400, the v2 route 422.Send 0 or more.
400 User not allowed to give access to all models...Only a proxy admin may give an organization every model.List the models.
422 organization_alias cannot be cleared; it is requiredThe v2 route got "organization_alias": null.Leave the field out to keep the name.
422 models cannot be set to null; send [] to clear itThe v2 route got "models": null.Send [].
404 Organization not found for organization_id=<id>The organization does not exist. Both update routes answer this.Check the id.
404 Organization=<id> not foundA delete named an organization that does not exist. Nothing is deleted, even for the other ids in the request.Remove the unknown id.
400 Multiple users with this email found in db. Please use 'user_id' instead.Member add or update named an email that more than one user has.Send user_id instead.
409 user_id=<id> is already a member of organization_id=<org>The user is already in the organization.Change their role with member update instead.
403 Only PROXY_ADMIN may modify the organization role of a user who is a global PROXY_ADMINAn organization admin tried to change a proxy admin's organization role.Ask a proxy admin.
500 Could not add the member to the organization, the gateway log has the causeMember add failed for a reason the gateway did not expect.Read the Error adding member to organization log line.
400 Error finding organization membership for user_id=<id> in organization=<org>Member update could not read the membership, usually because the database is down. The database error is not sent back.Read the Error finding organization membership log line, then retry.
500 Could not update the organization member, the gateway log has the causeMember update failed for a reason the gateway did not expect.Read the Error updating member in organization log line.
500 Could not remove the organization member, the gateway log has the causeMember delete failed for a reason the gateway did not expect.Read the Error deleting member from organization log line.

Member add answers in the OpenAI error shape, {"error": {"message": ..., "type": ..., "code": ...}}, with the same status and message. The three 500 answers above use that shape on every member route.

Logs​

LevelLineMeaningAction
ERRORError adding member to organization: <ExceptionType>Member add failed unexpectedly. Only the error type is logged, never the member's email.Check the database, then retry.
ERRORError updating member in organization: <ExceptionType>A role or budget change failed for a reason the gateway did not expect, and the caller got a 500. Only the error type is logged, never the member's email or the database message.Check the database, then retry.
ERRORError deleting member from organization: <ExceptionType>Member delete failed for a reason the gateway did not expect, and the caller got a 500. Only the error type is logged.Check the database, then retry.
ERRORError finding organization membership: <ExceptionType>Member update could not read the membership and the caller got a 400. Only the error type is logged.Check the database, then retry.

Both lines are listed in the log reference.