Skip to content
AI GatewayAI Gateway Manual

Bootstrap

Complete the initial setup session to configure the license, identity provider, and first administrator after the first installation.

After ./install.sh install finishes, open the bootstrap URL in a browser and work through the seven-screen wizard. This page covers everything you need to complete that session successfully.

For the package download and installer flags, see Getting Started. For .env and secret handling, see Secrets and .env.

Collect the following before you begin.

ItemWhere to find it
Bootstrap tokenAIG_BOOTSTRAP_TOKEN in aig/current/.env. Run grep AIG_BOOTSTRAP_TOKEN .env from aig/current.
License fileThe AI Gateway license file (a PEM certificate starting with -----BEGIN CERTIFICATE-----). Issuing a license requires this installation’s Installation ID, which the wizard shows at step 2. If you do not have the license yet, enter the token and find the Installation ID at step 2. For details, contact QueryPie support (ab@querypie.com). The Installation ID does not change when the session ends.
IdP application valuesOkta: issuer URL, client ID, client secret, client authentication method. Google Workspace: client ID, client secret. Keycloak: issuer URL, client ID, client secret. See the provider pages under IdP app registration below.
First administrator emailThe email address of an account in the IdP. The first login must be made with this account.
Organization name1–128 characters.

If you do not finish within 30 minutes of entering the token, or make no input for 15 minutes, the wizard returns to step 1.

For Google Workspace, Okta, and Keycloak, AI Gateway uses the OIDC Authorization Code flow with a client secret. PKCE and refresh tokens are not used. Register a web application in your identity provider before starting the wizard.

For Active Directory or OpenLDAP password sign-in, follow LDAP integration. LDAP uses directory settings instead of an OIDC application; the redirect URI and scopes below apply only to OIDC.

The redirect URI and login start URL depend on your hostname:

SettingValue
Redirect URIhttps://<hostname>/api/auth/oidc/callback. If the load-balancer HTTPS port is not 443, use https://<hostname>:<port>/api/auth/oidc/callback. For a localhost installation, use http://localhost/api/auth/oidc/callback (or http://localhost:<port>/api/auth/oidc/callback if AIG_HTTP_PORT is not 80). The installer prints this value as IdP redirect URI at the end of installation.
Scopesopenid email profile
Login start URLhttps://<hostname>/api/auth/oidc/login (used when launching the application from the IdP portal). For a localhost installation: http://localhost/api/auth/oidc/login, plus :<AIG_HTTP_PORT> when the port is not 80

Two important network constraints apply:

  • AI Gateway connects directly to the IdP without using any HTTP proxy environment variables. The host must have direct outbound HTTPS access to the IdP endpoint.
  • AI Gateway also connects to an IdP on a private IP address, but never to cloud metadata addresses (169.254.0.0/16, fd00:ec2::254). It trusts only certificates issued by CAs in the system trust store, so for a Keycloak that uses an internal CA, see Internal CA certificate for Keycloak.

Follow the page for your provider to register the application.

Open the bootstrap URL that install.sh printed (the root of your hostname, for example https://aig.example.com/). The browser redirects to the login screen at /login.

StepScreenAction
1Sign inEnter the value of AIG_BOOTSTRAP_TOKEN in Bootstrap token and click Next.
2LicenseThe screen shows this installation’s Installation ID at the top. Paste the full certificate including the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- lines, or use Load file to load the .pem file. Click Validate license to see the license ID, owner, type, seat count, and validity period. Confirm the details and click Next.
3Identity providerSelect Google Workspace, Okta, Keycloak, or LDAP. For OIDC, enter the application values and confirm the Callback URL matches the registered redirect URI. For LDAP, enter the directory settings. Add CA certificate (PEM) for an internal CA, then click Next.
4Administrator emailEnter the first administrator email address.
5Organization nameEnter the organization name (1–128 characters).
6Review your settingsReview all values. Click Create organization to commit.
7First administrator loginSign in through SSO, or enter the directory login ID and password for LDAP. A successful first administrator login opens /admin and completes installation.
  • LDAP validates settings without contacting the directory at step 3. Connection, service credentials, user password, and access-group membership are checked at step 7. See LDAP troubleshooting.

  • Okta and Keycloak validate the OIDC discovery document (<issuer>/.well-known/openid-configuration) at step 3. If the issuer URL is malformed, or if the document’s issuer field does not match the value you entered, the wizard shows an error immediately. If the IdP is merely unreachable, the wizard stores the value and continues; the connectivity problem only appears when SSO login is attempted at step 7.

  • Google Workspace stores the values without validating them at step 3. Any misconfiguration (wrong client ID, wrong client secret) is only discovered when the SSO login is attempted at step 7.

  • Every setup step shows the installed version (for example Version 2026.10.15.2) below the form. It is the VERSION in .env, hotfix number included; quote it when you contact support.
  • The license is re-validated at step 6 when you click Create organization. If the license has expired or is otherwise invalid, nothing is saved.
  • Before step 6, clicking End setup session or letting the session time out discards every value you entered. Restart from step 1.
  • No user account is created until step 7 completes. Step 6 commits the organization and IdP settings, so if you close the browser or the session ends after it, the first administrator can still complete step 7 later by signing in at /login. From then on the bootstrap token no longer opens the wizard.
SymptomCause and action
“The token could not be verified” at step 1Copy AIG_BOOTSTRAP_TOKEN from .env without leading or trailing whitespace. Run grep AIG_BOOTSTRAP_TOKEN aig/current/.env to print the exact value.
“Your setup session expired”A session ends 30 minutes after it starts, or after 15 minutes without input. Enter the token again and re-enter every value from step 1.
License: malformed (malformed)The pasted text is not a valid PEM certificate. Check for truncation or extra whitespace, then paste again.
License: untrusted key or signature invalid (untrusted_key, signature_invalid)The certificate was not issued for AI Gateway, or the content has been altered. Request a new license from QueryPie support.
License: unsupported format or missing fields (unsupported_schema, invalid_claims)The license format is not compatible with this version of AI Gateway. Report your version to QueryPie support and request a new license.
License: not yet valid or expired (not_yet_valid, expired)Check the validity period shown on the verify screen. Request a new license if the current one cannot cover the installation date.
License: belongs to another installation (installation_binding_mismatch)The license was issued for another installation’s ID. Send the Installation ID shown at step 2 to QueryPie support and request a reissued license.
Issuer URL rejected at step 3Confirm the URL starts with https://. Confirm the OIDC discovery document at <issuer>/.well-known/openid-configuration has an issuer field equal to the URL you entered.
“The CA certificate is not valid PEM” at step 3Put only certificate blocks that start with -----BEGIN CERTIFICATE----- into CA certificate (PEM). A private key or any other text is rejected.
Step 7 sign-in fails with an internal KeycloakIf the Keycloak certificate comes from an internal CA or is self-signed, check that CA certificate (PEM) contains that CA (or the certificate) and that the certificate’s host name matches the issuer URL. You can correct the CA certificate in recovery mode.
“Your account is not authorized to access AI Gateway” at step 7You signed in with a different account than the one entered at step 4, or the IdP configuration is wrong. Run the command below to read the failure_reason field from the server log. email_mismatch means the signed-in email does not match the first administrator email from step 4; sign in again with the correct account.
“No AI Gateway role is assigned to your account” at step 7Keycloak only. The first administrator has no role of the AI Gateway client, and the server log shows failure_reason client_role_missing. Grant the role as described in Keycloak integration, then sign in again.
Login blocked on the Okta sign-in screenThe account is not assigned to the AI Gateway application, or the application’s sign-in policy requires an authenticator the account cannot satisfy. Find the specific reason in Reports → System Log (Okta: System Log).

To inspect the first administrator finalization log:

Terminal window
cd aig/current
docker compose logs server | grep first_admin_finalization

Edit AIG_BOOTSTRAP_TOKEN in .env, then recreate the server container. A plain restart does not re-read .env:

Terminal window
cd aig/current
docker compose up -d

The new token takes effect immediately. Any in-progress setup session and all values entered in it are discarded.

Forced recovery after organization creation

Section titled “Forced recovery after organization creation”

Once step 6 completes, the bootstrap wizard is closed. If the IdP values are wrong and nobody can sign in, use recovery mode to reopen it.

Recovery mode prevents all logins, including administrator logins, and keeps the first administrator login at step 7 from completing. Disable it as soon as you finish correcting the values.

  1. Start recovery mode from aig/current:

    Terminal window
    cd aig/current
    ./install.sh recover
  2. Open https://<hostname>/login in a signed-out browser and enter the bootstrap token. The changes you can make depend on your current state:

    StateWhat can be changed
    Before the first administrator login (step 7 not yet completed)IdP settings and the first administrator email. The license and organization name are fixed.
    After the first administrator loginOnly the client ID, client secret, (for Okta) the client authentication method, and (for Keycloak) the CA certificate. The provider type and issuer cannot be changed. This recovery session does not grant access to any other administration screen.

    If you enter the token in a browser that is signed in as an administrator, no recovery session is created and you are directed to the Auth providers screen of the administration console instead. If you can sign in, make the correction there without using recovery mode.

  3. After correcting the values, disable recovery mode:

    Terminal window
    ./install.sh recover --done

    If you completed recovery before the first administrator login, proceed to step 7 in the bootstrap wizard after running --done.

    Forgetting to run --done is safe: the next docker compose up -d or ./install.sh upgrade restarts the server in normal mode automatically. Do not add AIG_FORCE_ENABLE_BOOTSTRAP directly to .env; doing so keeps recovery mode permanently on.

If the provider type or issuer is wrong and the first administrator has already signed in, the values cannot be changed from any screen. Contact support.

If the installation is fresh and there is no data to preserve, you can reset completely. This destroys all database and Redis data.

Terminal window
cd aig/current
docker compose down -v
./install.sh install --hostname <hostname>

If you use an external PostgreSQL or Redis, docker compose down -v does not delete that data. Re-create the external database as an empty database and flush the external Redis before running ./install.sh install. The .env file is preserved, so the bootstrap token and connection settings remain unchanged.

Changes to the authentication provider and license are made from the Organization menu in the administration console at /admin.

MenuWhat can be changed
Auth providersOpen Replace provider credentials and re-enter the client ID and client secret. For Okta, you can also change the client authentication method. For Keycloak, you can change the CA certificate (PEM) (re-enter the client secret even when you change only this). The provider type and issuer cannot be changed after setup.
LicenseInstall a new license to renew or increase seats. Paste the certificate, preview the details, and confirm. A license with fewer seats, fewer features, or an earlier expiration date than a license already installed for the same term is rejected. A license issued under a new term is not subject to this check.

AI Gateway does not connect to Keycloak when you save the CA certificate. If you saved a wrong CA certificate and no one can sign in, fix it with Forced recovery after organization creation.

Any user who signs in through the IdP is added automatically as a member with no permissions. An administrator must assign roles after the account is created.

After sign-in, the installed version (for example Version 2026.10.15.2) is the last line of the Account menu under your name at the top right of every screen. It is the VERSION in .env, hotfix number included.

  • Commercial license — a 30-day grace period applies after expiration. Install the new license before it expires to avoid service interruption.
  • PoC license — no grace period. Restrictions apply immediately on expiration.

Install the replacement license before expiration in both cases.