Secrets: keys for outside services

Keep API keys and tokens out of the app files. Backend functions read them by name; the value never reaches the browser or the AI.

Some features talk to an outside service: a payment provider, an email service, a webhook. Those services give you a private key. If it sits in the app files, anyone could find it. A secret keeps it on the server, encrypted, for this app only.

Screen recording: Settings, Secrets: Add new secret.

1. Open Secrets: In Settings, group Data and security, choose Secrets.

2. Add one: Press Add new secret. Under Key write a name, for example RESEND_API_KEY; under Value paste the key. Save.

3. Tell the builder: In the chat, say which secret to use, for example "send the emails through Resend using the secret RESEND_API_KEY".

Never paste a key in the chat: Put it here, then refer to it by name. A security scan flags keys found in the app files.

The words, in plain language

Word | What it means | Example

API key | A long private code a service gives you, so it knows the requests come from you. Like the key to a locker. | An email service gives you re_8f3k...

Backend function | A small piece of your app that runs on the server, not in the visitor's browser. Only it may use a secret, so visitors never see the key. | "Send the booking confirmation email"

Environment variable | A name-and-value pair the server keeps outside the code. A secret works like one: the code asks for the name and gets the value. | RESEND_API_KEY = re_8f3k...

Questions

Q: I pressed Save and see "Key and Value are required".

A: Both fields must be filled: the name under Key and the key itself under Value.

Q: Can I see a value after I saved it?

A: No, it stays masked. Keep the original with the provider.

Q: Do secrets copy when I clone an app?

A: Only if you tick Include Secrets (API keys, tokens) in Clone App. Otherwise add the keys again in the copy. See Studio settings.

Q: Where do keys for my whole account go?

A: Account-wide connections live in Connections.

Related: App users, login and security, Studio settings, section by section, Connect your services (Connections), Take payments in your app (Cardcom)