> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rork.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API keys and environment variables

> Store API keys in your Rork project instead of pasting them into code. This page explains the Secrets editor, which variables reach the phone, and how to keep a private key private.

export const CtaBanner = () => <div style={{
  display: "flex",
  alignItems: "center",
  justifyContent: "space-between",
  gap: "24px",
  flexWrap: "wrap",
  margin: "40px 0 8px",
  padding: "22px 28px",
  borderRadius: "16px",
  background: "linear-gradient(135deg,rgba(249,115,22,0.10),rgba(255,255,255,0.03),rgba(249,115,22,0.06))",
  border: "1px solid rgba(255,255,255,0.08)"
}}>
    <div>
      <div style={{
  fontSize: "19px",
  fontWeight: 700,
  color: "#fff",
  letterSpacing: "-0.3px",
  lineHeight: 1.3
}}>
        Build your app with Rork today.
      </div>
      <div style={{
  fontSize: "14px",
  color: "rgba(255,255,255,0.6)",
  marginTop: "4px",
  lineHeight: 1.5
}}>
        Ship iOS, Android, and web apps by chatting with AI.
      </div>
    </div>
    <a href="https://rork.com?utm_source=docs&amp;utm_medium=referral&amp;utm_campaign=docs-cta&amp;utm_content=cta-banner" onClick={tagCtaLink} style={{
  flexShrink: 0,
  display: "inline-block",
  padding: "10px 24px",
  background: "linear-gradient(135deg,#fff,#f0f0f0)",
  color: "#000",
  fontSize: "14px",
  fontWeight: 600,
  borderRadius: "100px",
  textDecoration: "none",
  whiteSpace: "nowrap"
}}>
      Try Rork for Free
    </a>
  </div>;

Most useful apps need a key: a weather API, an email sender, a payment provider, a model provider. Those keys belong in your project's **Secrets**, not in your code and not in a chat message.

## Where secrets live

Open **More → Secrets** in a project.

<Frame caption="The Secrets editor. Values are hidden until you press the eye, and the label under each key says how far it travels.">
  <img src="https://mintcdn.com/rork/DvKNYT4s6kJH2rkl/images/secrets/env-editor.png?fit=max&auto=format&n=DvKNYT4s6kJH2rkl&q=85&s=3a728590db9503cddedaec82992d68e9" alt="The Rork Secrets panel with a RESEND_API_KEY row, a hidden value, a Server-side only label, an Add Variable button, and Bulk Edit and Save buttons" width="2470" height="501" data-path="images/secrets/env-editor.png" />
</Frame>

<Steps>
  <Step title="Press Add Variable">
    A new row appears with a **Key** and a **Value**.
  </Step>

  <Step title="Type the name in capitals with underscores">
    `RESEND_API_KEY`, `STRIPE_SECRET_KEY`, `OPENWEATHER_API_KEY`. Use the exact name the provider's documentation uses.
  </Step>

  <Step title="Paste the value">
    Rork hides it straight away. The eye button reveals it when you need to check it.
  </Step>

  <Step title="Press Save">
    Rork stores the variable and rebuilds the parts of your app that need it.
  </Step>
</Steps>

Adding several at once is faster with **Bulk Edit**. Paste one variable per line as `KEY=value`.

## How far a variable travels

The label under each key is the important part of this page. It tells you who can read that value.

| Label                       | Where the value goes                                       |
| --------------------------- | ---------------------------------------------------------- |
| **Server-side only**        | Stays on the server. Your users can never read it          |
| **Available at build time** | Baked into the app when it is built                        |
| **Available to all users**  | Shipped inside the app, readable by anyone who installs it |

The rule that decides this is the name. A variable whose name starts with `EXPO_PUBLIC_` is sent to the app itself, and everything else stays server-side. The editor repeats the rule at the bottom: "Prefix with `EXPO_PUBLIC_` to make a variable available on the client-side".

<Warning>
  Never give a secret key an `EXPO_PUBLIC_` name, and never paste one into your app's code. Anything shipped inside an app can be extracted from it, which means a leaked key on your account, used by strangers, billed to you. A private key belongs in a **Server-side only** variable, used by a server function.
</Warning>

Two examples make the split clear:

* `EXPO_PUBLIC_SUPABASE_URL` is fine as a public value. It is an address, and it is protected by database rules.
* `STRIPE_SECRET_KEY` must be **Server-side only**. It can move money.

If your feature needs a private key, ask Rork for a server function and it will build one:

```
Send the confirmation email from a server function so the Resend key stays private
```

Some rows are marked **Managed by Rork** or **Managed by the Supabase integration**. Rork writes and rotates those itself, so leave them alone.

## When Rork asks you for a key

You usually do not open the Secrets editor at all. When a build needs a key, Rork stops and asks in chat, with one field per key and a short description of what each one is for. Paste the values and press **Save & Continue**, and the build carries on where it stopped.

When Rork already knows the values, for example after an integration, the card asks you to confirm instead: **Yes, set them**.

## Who can see your keys

| Role   | Secrets                     |
| ------ | --------------------------- |
| Owner  | Can read and edit           |
| Editor | Can read and edit           |
| Viewer | Sees the panel, cannot edit |

So an editor on your project can read your keys. Invite editors accordingly. See [Share a project and work together](/collaborate/share-a-project).

A cloned project carries your variables over, except the keys Rork manages itself, which it mints fresh for the copy.

## Rotate a key you leaked

If a key ends up somewhere public, changing it in Rork is not enough. Do it in this order:

<Steps>
  <Step title="Revoke the key at the provider">
    Delete or rotate it in the provider's own dashboard. That is what actually stops the key from working.
  </Step>

  <Step title="Create a new key">
    Copy the new value.
  </Step>

  <Step title="Update the variable in Rork">
    Same key name, new value, then **Save**.
  </Step>

  <Step title="Check where it was exposed">
    If it was in your code, ask Rork to remove it and to read the value from the variable instead.
  </Step>
</Steps>

## FAQ

<AccordionGroup>
  <Accordion title="Should I paste my API key into the chat?">
    Prefer the Secrets editor, or the card Rork shows when it needs a key. Both keep the value out of the conversation.
  </Accordion>

  <Accordion title="Do secrets go to GitHub?">
    No. They live with the project, not in your code, so they are not committed. Set them again in any environment you run the code yourself. See [How to sync your project with GitHub](/tutorials/how-to-connect-github).
  </Accordion>

  <Accordion title="Are secrets per project or per account?">
    Per project. A project with an iPhone app and a web app shares one set of variables.
  </Accordion>

  <Accordion title="I added a variable and the app still cannot see it.">
    Reload the preview first. If it is a native app, the value is baked in at build time, so it needs a new build. If the name is missing the `EXPO_PUBLIC_` prefix, the app cannot read it by design, and the call belongs on the server.
  </Accordion>

  <Accordion title="Do I need my own OpenAI key to use AI in my app?">
    Not necessarily. Rork Cloud gives your app models without your own provider keys. See [What is Rork Cloud](/backend/rork-cloud).
  </Accordion>

  <Accordion title="Where do Supabase keys go?">
    Connecting Supabase sets them for you and marks them as managed. See [How to add a Supabase backend to Rork](/backend/supabase).
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card icon="plug" href="/features-apis/apis/how-to-connect-an-api-to-your-project" title="Connect an API">
    Use a third party API with your new key.
  </Card>

  <Card icon="database" href="/backend/rork-cloud" title="Rork Cloud">
    A backend inside Rork, with server-side keys handled for you.
  </Card>

  <Card icon="users" href="/collaborate/share-a-project" title="Share the project">
    Who can read your secrets, and who cannot.
  </Card>

  <Card icon="credit-card" href="/payment-guides/revenuecat-copied-1" title="Add payments">
    Set up in-app purchases with RevenueCat.
  </Card>
</CardGroup>

<CtaBanner />
