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

# Wiki context and environment variables

> Configure the hosted endpoint, authentication, and selected wiki.

## Wiki selection

<div className="almanac-diagram" tabIndex="0">
  <img src="https://mintcdn.com/almanac-e141534d/PSPQxvCsHo2cfSd-/images/diagrams/wiki-context.svg?fit=max&auto=format&n=PSPQxvCsHo2cfSd-&q=85&s=a588e950f8e35b18a131941f04cf66bf" alt="An explicit flag wins over the environment variable, which wins over the nearest project link." width="1440" height="430" data-path="images/diagrams/wiki-context.svg" />
</div>

| Priority | Source               | Example                                         |
| -------- | -------------------- | ----------------------------------------------- |
| 1        | Command flag         | `--wiki acme/company-handbook`                  |
| 2        | Environment          | `ALMANAC_WIKI=acme/company-handbook`            |
| 3        | Nearest project link | `.almanac.yaml` in the directory or an ancestor |

There is no global selected wiki.

## Environment variables

| Variable                                                                        | Purpose                                           |
| ------------------------------------------------------------------------------- | ------------------------------------------------- |
| `ALMANAC_TOKEN`                                                                 | API key or access token for CLI automation        |
| `ALMANAC_WIKI`                                                                  | Default `workspace/wiki` handle for wiki commands |
| `ALMANAC_API_URL` appears in the REST examples only as a shell convenience for  |                                                   |
| `curl`; it is not a public CLI endpoint override. Python code can pass a custom |                                                   |
| `api_url=` directly when a controlled environment provides one.                 |                                                   |

## Project link

```yaml .almanac.yaml theme={"theme":{"light":"github-light","dark":"vesper"}}
wiki: acme/company-handbook
```

Commit the link when a repository belongs to a wiki. Do not commit tokens. Apply
these settings in [Create and link a wiki](/guides/create-select-wiki) or
[CLI automation](/cli/automation).
