Skip to content
MyAppBuilder
StableGuide

API authentication

Most services require a key or token. In MyAppBuilder the key is stored as an encrypted secret per environment and attached to the request on the server . The project definition, the published app and the AI copilot only ever see the secret's name .

API authentication

Most services require a key or token. In MyAppBuilder the key is stored as an encrypted secret per environment and attached to the request on the server. The project definition, the published app and the AI copilot only ever see the secret's name.

When to use

  • No auth: public APIs and demo endpoints.
  • Bearer token: services expecting Authorization: Bearer <token> (most modern APIs).
  • Basic auth: services expecting a username and password.
  • API key header: services expecting the key in a custom header such as X-API-Key.

How to configure authentication

  1. Create the secret: open Settings → Environment & secrets, choose the environment (Development for the builder and test runs, Staging for the staging app, Production for the live app), add a secret named in capitals such as WEATHER_API_KEY, and paste the value (for example sk_test_…). The value is encrypted and cannot be read back; set it again in each environment you use.
  2. In APIs, open the API source and the Authentication section.
  3. Choose the Type: - Bearer token — the secret's value is sent as Authorization: Bearer <secret>. - Basic auth — the secret's value must be username:password; it is encoded and sent as Authorization: Basic …. - API key header — enter the Header name (default X-API-Key); the secret's value is sent as that header.
  4. Pick the Secret from the list of defined secret names, or choose Type a secret name… to enter one that is not created yet. Badges show per environment whether the value is set or missing.
Example
Authentication
  Type:        API key header
  Header name: X-API-Key
  Secret:      WEATHER_API_KEY   development: set · staging: missing · production: set

Using secrets in other places

Any header, query value, URL or body can also contain {{secret.NAME}}, which is replaced on the server. Use it for services that want the key in an unusual place (for example ?api_key={{secret.MAPS_KEY}} in the query) — but prefer the Authentication section when it fits, and never put the key in the URL where logs may capture it.

What is never exposed

  • Secret values never leave the server: not in the published configuration, not in the test response, not in exports, not in AI prompts.
  • The published app receives API sources with an empty URL, no headers and auth: none; it can only ask the server to run them.

Common mistakes

  • Missing value for the live environment. The call fails with API "Weather" needs the secret WEATHER_API_KEY in production. Set it under Production.
  • Pasting the key into a header value. It is then stored in plain text in the project. Move it to a secret.
  • Lower-case or hyphenated secret names. Names use capitals, digits and underscores (STRIPE_SECRET_KEY).
  • Basic auth without the colon. The secret must contain username:password.
  • OAuth flows. Token refresh flows are not available; use long-lived tokens or API keys.

Advanced

Secrets are stored in encrypted_secrets per (project, environment, key) with AES-256-GCM. executeApiSource reads api.auth.secret with getSecret(projectId, envKey, name) and sets the Authorization or custom header; {{secret.NAME}} placeholders are resolved by interpolateSecrets. Only workspace admins can set or delete secrets (PUT /api/projects/:id/secrets).

Related

Was this helpful?