> For the complete documentation index, see [llms.txt](https://docs.fastn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastn.ai/tutorials/developer/deployment.md).

# Deployment

When you deploy the application you've embedded Fastn into, the main consideration is how environment variables and secrets bind on your deploy target. Getting this wrong is a common cause of a working local build that fails in production.

### Environment variables: runtime vs build time

Your embedded integration needs at least:

* `FASTN_API_KEY` — your `fsk_` API key
* `FASTN_END_ORG_ID` — the customer UUID

These must be available to the server-side function that generates embed tokens.

On some hosts, environment variables set in a CI pipeline are not automatically available to the deployed runtime. They bind at deploy time on the hosting target, not from the pipeline's own secrets. If the token function reads an undefined API key in production, token generation fails and the embed renders blank.

### Checklist for deploying

1. Set `FASTN_API_KEY` and `FASTN_END_ORG_ID` directly on the hosting target (not only in CI).
2. Use a `fsk_live_` key in production (and drop the `X-fastn-Test-Mode` header — see [Authentication & API Keys](/tutorials/developer/authentication-and-api-keys.md)).
3. Redeploy after changing environment variables, if your host binds them at deploy time.
4. Paste secret values raw — no surrounding quotes or brackets.
5. Confirm the token endpoint is reachable from your deployed backend.

### Verifying after deploy

Load the embedded page in production and confirm the widget renders and a token is being generated fresh on each load. If the iframe is blank, check that the environment variables are bound on the runtime, not just present in CI. See [Troubleshooting](/tutorials/developer/troubleshooting.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fastn.ai/tutorials/developer/deployment.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
