First admin setup
This page walks a new customer organization from nothing to a gateway that its own people sign in to with their own accounts. It covers both ways to run Spanway. On a self-hosted gateway you install the container image yourself and the first person in is the built-in admin, who signs in with the master key. On Spanway Cloud there is nothing to install, and the first person to sign up becomes the admin of the organization. Either way, the goal at the end is the same: every admin signs in as themselves, their changes are recorded under their own name, and nobody shares a password.
A real-world scenario
A 40-person company buys Spanway for its platform team. The platform lead emails sales, receives a license key, and installs the gateway on the company's Kubernetes cluster with Helm. She signs in to the Admin UI once with the master key, sets the license, connects the company's Okta, and invites two colleagues as admins. When all three can sign in through Okta, she turns off the master key login, so the master key only lives in the secret store for emergencies over the API.
Before you start
Decide where the gateway runs. Self-hosted means you run the container image on your own infrastructure, with your own Postgres database, and you choose which tier you need. Without a license key the image runs the free Starter tier. A license key turns on the Enterprise features, such as single sign-on for more than 5 users, custom roles, audit logs and compliance, in the same image. Spanway Enterprise lists what each tier includes. Spanway Cloud means Spanway hosts the gateway for you, so skip to Spanway Cloud.
Self-hosted, step by step
1. Get a license
Write to sales@spanway.ai with your company name, the number of users and teams you expect, and the features you need. There is no self-serve checkout today. Sales replies with a license key, a long signed text that names your organization, its expiry date, the features it includes and any user or team limits. The gateway checks the signature offline against a public key built into the image, so it never calls home and works on networks with no internet access. Store the key in your secret store, the same way you store a database password.
You can install and try the gateway before the license arrives. It runs as Starter until you add the key, and adding it later needs no reinstall and no data migration.
2. Choose a master key
The master key is the gateway's own admin credential. It can call every management route, and until you set up named admins it is also the password for the first Admin UI login. Generate a long random value and keep it in your secret store.
export SPANWAY_MASTER_KEY="sk-$(openssl rand -hex 32)"
The gateway refuses to start when the master key is unset, empty or a publicly known example value, and prints how to fix it. Also set SPANWAY_SALT_KEY to a separate random value on day one. It encrypts the provider credentials you save in the database, and when it is unset the master key is used instead, which makes changing the master key later much harder. See production checklist and rotating the master key.
3. Install the gateway
Pick the way you deploy software today. All three use the same image and accept the same settings.
Docker. Pass the master key, the salt key and, once you have it, the license as environment variables. The Admin UI needs a database, so give the container DATABASE_URL too. Docker quick start has a full Docker Compose file with Postgres.
docker run -p 4000:4000 \
-v "$PWD/config.yaml:/app/config.yaml" \
-e DATABASE_URL="postgresql://spanway:<password>@db.example.com:5432/spanway" \
-e SPANWAY_MASTER_KEY -e SPANWAY_SALT_KEY -e SPANWAY_LICENSE \
registry.spanway.ai/spanway/spanway-ai:2.0.0 --config /app/config.yaml
Helm. Install the spanway-helm chart and pass your master key with --set masterkey=.... Leave it out and the chart generates one and stores it in the Secret spanway-masterkey. The license goes in a Kubernetes Secret that the chart reads through license.secretName. See Helm.
kubectl create namespace spanway
kubectl -n spanway create secret generic spanway-license --from-literal=license='<license key>'
helm upgrade --install spanway oci://registry.spanway.ai/spanway/charts/spanway-helm \
--namespace spanway \
--set masterkey="$SPANWAY_MASTER_KEY" \
--set license.secretName=spanway-license \
--set postgresql.auth.password=choose-a-password \
--set postgresql.auth.postgres-password=choose-a-password
Terraform. The AWS, GCP and Azure stacks take the master key as spanway_master_key and the license as spanway_license, both best passed as TF_VAR_* environment variables so they never land in a tfvars file. An empty spanway_master_key makes the stack generate one and store it in the cloud's secret store. See Terraform.
export TF_VAR_spanway_master_key="$SPANWAY_MASTER_KEY"
export TF_VAR_spanway_license="<license key>"
terraform init
terraform apply
Spanway is in private preview. The container images and Helm charts will be published soon. To request access, write to sales@spanway.ai, and preview customers receive download instructions in their onboarding pack.
Check that the gateway is up. The liveness check needs no key.
curl http://localhost:4000/health/liveliness
4. Sign in to the Admin UI for the first time
Open /ui on your gateway, for example http://localhost:4000/ui. On the Login page type admin as Username and the master key as Password, then click Login. You are signed in as the built-in proxy admin, with every permission.
If you would rather not type the master key into a browser, set UI_PASSWORD (and optionally UI_USERNAME) on the container before you sign in. The built-in admin then uses that username and password instead of the master key. Setting UI_PASSWORD also hides the Default Credentials hint on the sign-in page. Admin UI lists the other sign-in settings.
While this built-in login is still on, admins see a red banner at the top of the Admin UI, Environment-credential login is enabled. That is expected until step 8.
5. Set the license and check it
If you did not pass SPANWAY_LICENSE at install time, add it now with the method you used in step 3 and restart the containers. Then check it.
curl http://localhost:4000/health/license -H "Authorization: Bearer $SPANWAY_MASTER_KEY"
Expected result:
{
"has_license": true,
"license_type": "enterprise",
"expiration_date": "2027-10-31",
"allowed_features": ["*"],
"limits": {"max_users": 100, "max_teams": 20}
}
The sign that the license works is "license_type": "enterprise". "has_license": true only means a SPANWAY_LICENSE value reached the gateway, even one that is invalid or expired. The dates, features and limits are the ones in your license. In the Admin UI, open the account menu at the bottom of the left sidebar. The Tier row reads Enterprise. If it still reads Starter, sign out and sign in again.
6. Turn on single sign-on
Single sign-on lets people use their work account instead of a password that someone has to share and rotate. It works for up to 5 users without a license, and for any number with one.
-
Register an application at your identity provider (Okta, Microsoft Entra ID, Google or any OIDC or SAML provider) with the redirect URL
<PROXY_BASE_URL>/sso/callback, for examplehttps://gateway.example.com/sso/callback. SetPROXY_BASE_URLon the gateway to the same public address. -
In the Admin UI open Settings, then Admin Settings, stay on the SSO Settings tab, choose Add SSO, pick the provider, fill in the client id and secret (or the SAML metadata) and the Proxy Base URL, and choose Add SSO.
-
Click Check readiness in the SSO readiness card. A green result names the provider. The same check with curl:
curl http://localhost:4000/sso/readiness -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -
Decide who becomes an admin when they sign in through SSO. Either set
PROXY_ADMIN_IDto your own user id at the identity provider, or map an identity provider group to theproxy_adminrole with Use Role Mappings. Everyone else gets the Default Role you pick. -
Sign out and click Login with SSO.
Admin UI single sign-on has every provider's settings, the group to role mappings and the troubleshooting table.
7. Invite admins and give them roles
Every person who manages the gateway should have their own account. There are four built-in roles to choose from.
| Role in the Admin UI | Role name in the API | What the person can do |
|---|---|---|
| Admin (All Permissions) | proxy_admin | Everything, including models, keys, users, settings and the license. |
| Admin (View Only) | proxy_admin_viewer | See every key, team, user and spend figure, change nothing. |
| Internal User (Create/Delete/View) | internal_user | Create and manage their own keys and see their own spend. |
| Internal User (View Only) | internal_user_viewer | See their own keys and spend. |
Organization and team admins are set on the organization or team, not here. Access control explains every role, and custom roles let you define your own with an Enterprise license.
- Open Internal Users in the left sidebar and click + Invite User.
- Type the person's User Email, pick the Global Proxy Role, for example Admin (All Permissions), and click Invite User.
- The Invitation Link dialog shows a one-time link. Send it to the person. With email set up and Send invitation email switched on, the gateway mails it for you, see email.
- The person opens the link, chooses a password and is signed in. From then on they sign in with their email as Username and that password, or with SSO once it is on.
The same with the API. The first call creates the user and returns its user_id, the second creates the invitation, whose id makes the link <PROXY_BASE_URL>/ui/onboarding?invitation_id=<id>. The link works for seven days.
curl -X POST http://localhost:4000/user/new \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"user_email": "ana@example.com", "user_role": "proxy_admin", "auto_create_key": false}'
curl -X POST http://localhost:4000/invitation/new \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"user_id": "<user_id from the first call>"}'
To change the role of someone who already exists, open Internal Users, open the person, click Edit Settings and pick another Global Proxy Role, or send user_role to /user/update. If a person loses their password, open them and click Reset Password for a new one-time link.
8. Retire the master key login
Once named admins can sign in, turn off the shared built-in login so that a leaked master key or UI_PASSWORD can no longer open the Admin UI.
-
Check that at least one person with Admin (All Permissions) can sign in with their own password or through SSO. If nobody can, turning the login off locks everyone out of the Admin UI.
-
Add the setting to your config file and restart the gateway.
general_settings:disable_env_credential_login: true -
Sign out and try
adminwith the master key on the sign-in page. It is refused withInvalid credentials used to access UI. Check the password set for your user, and the red banner from step 4 no longer shows for admins.
What the switch does, in plain words. Off (the default), anyone who knows UI_USERNAME and UI_PASSWORD, or the master key when UI_PASSWORD is unset, can sign in as the full admin. On, only real user accounts can sign in, so every change in the Admin UI belongs to a named person in the audit log. People with their own passwords and SSO users are not affected. The master key itself keeps working over the API, which is how you recover: call the API with it, or remove the setting and restart. Only a proxy admin who owns the gateway's configuration should change it.
If you want SSO to be the only way in, also set general_settings.disable_password_login_when_sso_enabled: true. That turns off every username and password sign-in, the /fallback/login page included, as long as SSO is fully configured. Keep it off if you want a password fallback for days when the identity provider is down. Password sign-ins can also require an authenticator app code, see two-factor sign-in.
Keep the master key in your secret store after this step. Treat it like a break-glass credential and rotate it as described in rotating the master key if it was ever shared.
Spanway Cloud
On Spanway Cloud, Spanway runs the gateway, the database and the upgrades. There is no license key to set and no master key to manage. Your organization is a tenant, and the first person to sign up is its admin.
- Open the Spanway Cloud sign-up page,
/ui/cloud/signupon the Cloud address. Fill in Work email, Company, Full legal name and Country (and the optional address fields), accept the Terms of Service and Privacy Policy, and click Create workspace. Signup screens the name and address against sanctions lists before anything is created, see Cloud sanctions screening. - Open the verification link in the email. It expires after 24 hours. If it never arrives, the sign-up page offers to send it again. Choose a password and click Create workspace.
- The page shows your first API key once and the Base URL. Copy the key into your secret store, then click Go to dashboard.
- Sign in to the Admin UI with your work email as Username and the password you chose. You are the organization admin (
org_admin) of your tenant, a member of its default team, and the owner of its first key. You do not get gateway-wide admin rights, which stay with Spanway.
The same signup with the API, which is what the sign-up page calls:
curl -X POST $SPANWAY_URL/cloud/signup -H "Content-Type: application/json" \
-d '{"accepted_terms": true, "email": "founder@example.com", "company": "Example Labs",
"legal_name": "Example Labs Inc.", "country": "US"}'
Expected result: {"tenant_id": "...", "status": "pending_verification", "under_review": false}. Spanway Cloud covers plans, credits and billing.
Invite colleagues
- In the Admin UI open Organizations, open your organization and choose the Members tab.
- Click Add Member, type the colleague's Email, pick the Member Role (
org_adminfor another admin,internal_userfor someone who creates their own keys,internal_user_viewerfor read-only access) and confirm. The gateway creates the account if it does not exist yet. - Open Internal Users, open the colleague and click Reset Password. Send them the one-time link from the dialog, and they choose their own password.
The same with the API, using a key that belongs to you as organization admin:
curl -X POST $SPANWAY_URL/organization/member_add \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{"organization_id": "<your organization_id>", "member": {"role": "org_admin", "user_email": "ana@example.com"}}'
curl -X POST $SPANWAY_URL/invitation/new \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{"user_id": "<user_id from the first answer>"}'
Organization admins can create invitations only for people in their own organization or team.
Organization single sign-on
Cloud tenants on a plan that includes single sign-on, the enterprise plan by default, connect their own identity provider. Open Organizations, open your organization and choose the SSO tab. Add the identity provider under Identity providers, claim your email domain under Email domains, publish the DNS TXT record it shows, and click verify. After that, colleagues type their work email under Work email on the sign-in page and are sent to your identity provider, then land in your organization with the role your mappings give them. Organization single sign-on has every field, the DNS record format and SCIM provisioning.
Expected result
On a self-hosted gateway, /health/license answers "license_type": "enterprise", the account menu shows Enterprise, every admin signs in as themselves through SSO or their own password, and the admin login with the master key is refused. On Spanway Cloud, the first user is the organization admin, colleagues sign in with their own accounts, and with organization SSO they sign in through your identity provider.
Errors
| What you see | What it means | Fix |
|---|---|---|
The gateway exits with Spanway proxy refused to start: no master key is set, ... or ... the master key is a publicly known default. | The master key is missing, empty or an example value. | Generate a key as in step 2 and pass it as SPANWAY_MASTER_KEY. |
Invalid credentials used to access UI. Check 'UI_USERNAME' and 'UI_PASSWORD', or the password set for your user | The username or password is wrong. When UI_PASSWORD is set, the master key is no longer the password. | Use UI_PASSWORD, or the master key when it is unset. |
Invalid credentials used to access UI. Check the password set for your user when signing in as admin | disable_env_credential_login is on, so the built-in login is off. | Sign in with your own account, or remove the setting and restart if nobody can. |
403 Username/password login is disabled because SSO is configured and 'disable_password_login_when_sso_enabled' is set. Sign in via SSO. | Password sign-in is turned off while SSO is on. | Use Login with SSO, or remove the setting and restart. |
| Login with SSO is greyed out with Please configure SSO to log in with SSO. | No SSO provider is set up yet. | Finish step 6. |
has_license: false after setting SPANWAY_LICENSE | The variable never reached the container. | Check the variable inside the container and restart it. |
license_type: starter (with has_license: true and expiration_date: null) after setting SPANWAY_LICENSE | The key reached the gateway but is invalid, truncated or expired. The key itself is never logged. | Paste the whole key again, and ask sales@spanway.ai for a new key if it expired. |
403 You must be a Spanway Enterprise user to use SSO for more than 5 users. ... | Without a license SSO allows 5 users. | Set the license as in step 5. |
400 You can only create invitations for users in your organization or team. | An organization or team admin tried to invite someone outside their organization or team. | Add the person to your organization first. |
| Failed to load invitation on the invitation page | The link was already used, has expired after seven days, or was mistyped. | Ask an admin for a new link with Reset Password. |
| The UI asks for a database | DATABASE_URL is not set. | Set it. Sign-in, users and invitations live in the database. |
The error reference lists every gateway error with its fix.
Logs
| Level | Line | Meaning | Action |
|---|---|---|---|
| Printed on exit | Spanway proxy refused to start: <reason> followed by the fix | The master key check stopped the gateway before it served traffic. | Follow the printed steps. |
Log reference lists the other operator log lines.
Audit
With an Enterprise license, every step above that changes something is written to the audit log with who made the change: creating a user, an invitation, an organization membership, a role change, and every SSO settings change. Before step 8 those changes are recorded under the built-in admin, which is one more reason to move everyone to their own accounts.
Related
- Spanway Enterprise for what the license unlocks.
- Docker quick start, Helm and Terraform for installing.
- Admin UI for every sign-in setting.
- Admin UI single sign-on and organization single sign-on.
- Access control for roles.
- Production checklist before going live.
- Spanway Cloud for plans, credits and billing.