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

# Local API

> Turn on the Uplink local API so that the dashboard can show the prompts, responses, and tool output that Uplink keeps.

The local API lets the dashboard show session content that a Self-Hosted Uplink instance keeps. The browser of each user gets the content directly from Uplink, so the content never passes through Agent Golf servers. See [Trust in the dashboard](#trust-in-the-dashboard).

Show session content: the dashboard asks the Agent Golf API to authorize the signed-in user, then the browser requests the content from the Uplink local API, and Uplink returns it to the browser.

Content travels from Uplink to the browser of a user who can reveal the session. Agent Golf authorizes the user,
but never receives the content.

Without the local API and an advertised URL, the dashboard shows session totals and timelines, but no content. For what leaves your network, see [What Leaves Your Network](https://docs.agent.golf/getting-started/data-boundary.md).

The local API is off by default in the binary and the container image. The Helm chart always turns it on. A Cloud Uplink instance needs none of these settings, because its content goes to the browser through Agent Golf. See [Cloud Uplink](https://docs.agent.golf/uplink/cloud.md#session-content).

## Enable the local API

On a host or in Docker, set these variables, then restart Uplink. For the Helm chart, see [With the Helm chart](#with-the-helm-chart).

```bash theme={null}
UPLINK_LOCAL_API_ADDR=0.0.0.0:8443
UPLINK_LOCAL_API_ALLOW_EXTERNAL=true
UPLINK_LOCAL_API_TLS_CERT_FILE=/etc/uplink/tls/local-api.pem
UPLINK_LOCAL_API_TLS_KEY_FILE=/etc/uplink/tls/local-api-key.pem
UPLINK_LOCAL_API_ADVERTISE_URL=https://uplink.example.internal:8443
```

In Docker, also publish the port, for example `-p 8443:8443`.

The advertised URL must be reachable from the browsers of your users, for example a host name on your VPN. It does not need to be reachable from the internet. Use a certificate that these browsers trust for that host name.

| Environment variable | Flag | Purpose |
| - | - | - |
| `UPLINK_LOCAL_API_ADDR` | `-local-api-addr` | The `host:port` that the local API binds, with an explicit host. Empty turns the local API off. |
| `UPLINK_LOCAL_API_ALLOW_EXTERNAL` | `-local-api-allow-external` | Required to bind a host other than loopback. Uplink does not start without it. |
| `UPLINK_LOCAL_API_TLS_CERT_FILE`, `UPLINK_LOCAL_API_TLS_KEY_FILE` | `-local-api-tls-cert-file`, `-local-api-tls-key-file` | The PEM certificate chain and key for HTTPS. Set both. A host other than loopback needs TLS or a trusted HTTPS proxy in front. Uplink does not check that you have one. |
| `UPLINK_LOCAL_API_TLS_SELF_SIGNED` | `-local-api-tls-self-signed` | `true` makes and keeps a self-signed certificate. It covers `localhost`, the loopback addresses, and the listen host when that host is not loopback or a bind-all address such as `0.0.0.0`. The certificate is valid for 365 days. Uplink makes a new one at start when less than 30 days remain. Do not set it with the certificate files. Browsers do not trust it. |
| `UPLINK_LOCAL_API_ADVERTISE_URL` | `-local-api-advertise-url` | The exact origin, `scheme://host[:port]`, where browsers reach the local API. Uplink reports it to Agent Golf in its health reports. It needs `UPLINK_LOCAL_API_ADDR`, `UPLINK_METRICS_PUSH=true`, and an instance that sends data to Agent Golf, as with the default `AGENTGOLF_API_BASE_URL`. Uplink does not start without them. |
| `UPLINK_LOCAL_API_ALLOWED_ORIGINS` | `-local-api-allowed-origin` | More browser origins to allow, separated by commas. Uplink always allows the dashboard origin of its Agent Golf API: `https://app.agent.golf` for the default API. A custom API address has no known dashboard, so add its dashboard origin here. |

A trusted HTTPS proxy can end TLS in place of Uplink. Then set `UPLINK_LOCAL_API_ADVERTISE_URL` to the URL of the proxy.

## With the Helm chart

The chart sets `UPLINK_LOCAL_API_ADDR=0.0.0.0:9090` and `UPLINK_LOCAL_API_ALLOW_EXTERNAL=true`, because its probes use the local API. You cannot change these values or turn off the local API. The Service `uplink` exposes the local API on port 9090.

The local API serves plain HTTP until you set TLS. It issues access tokens and returns session content, so set TLS and keep port 9090 on a private network.

To let the dashboard show content:

1. Store the certificate and its key in a Secret:

   ```bash theme={null}
   kubectl --namespace uplink create secret tls uplink-local-api-tls --cert=local-api.pem --key=local-api-key.pem
   ```

2. Add these settings to a values file, for example `local-api-values.yaml`. Set the TLS variables in `config`, not in `extraEnv`: the chart picks the HTTPS probes from `config`.

   ```yaml theme={null}
   config:
     UPLINK_LOCAL_API_TLS_CERT_FILE: /etc/uplink/local-api-tls/tls.crt
     UPLINK_LOCAL_API_TLS_KEY_FILE: /etc/uplink/local-api-tls/tls.key
     UPLINK_LOCAL_API_ADVERTISE_URL: https://uplink.example.internal:9090
   extraVolumes:
     - name: local-api-tls
       secret:
         secretName: uplink-local-api-tls
         defaultMode: 0440
   extraVolumeMounts:
     - name: local-api-tls
       mountPath: /etc/uplink/local-api-tls
       readOnly: true
   ```

3. Upgrade the release with all the values of your installation and the new file. See [Install the new release](https://docs.agent.golf/uplink/upgrade.md#install-the-new-release).

   ```bash theme={null}
   helm get values uplink --namespace uplink --output yaml > uplink-values.yaml
   helm upgrade uplink oci://ghcr.io/agentgolf/charts/uplink \
     --version <version> \
     --namespace uplink \
     --values uplink-values.yaml \
     --values local-api-values.yaml
   ```

4. Route the advertised host name to port 9090 of the Service `uplink`. The Service type is `ClusterIP` by default, and the chart has no Ingress, so create this route yourself. The Service also exposes port 4318, so keep any change of `service.type` on a private network.

With `networkPolicy.enabled`, add your proxy or load balancer to `networkPolicy.localApiFrom`, or the dashboard cannot reach the local API.

`config.UPLINK_LOCAL_API_TLS_SELF_SIGNED` also serves HTTPS. On the bind address of the chart, its certificate covers only `localhost` and the loopback addresses, so a browser does not accept it for your host name.

## Test the connection

1. Open your instance in the **Uplink** section of the dashboard sidebar.
2. Under **Instance Settings**, confirm that **Instance API URL** shows your advertised URL.
3. Select **Test Connection**. The dashboard shows "Uplink instance connection verified."

On first use, the browser can ask each user to allow access to a local network address. Users must allow it.

If the test fails, see [The dashboard does not show session content](https://docs.agent.golf/uplink/troubleshooting.md#the-dashboard-does-not-show-session-content).

## How access is authorized

1. The dashboard asks Agent Golf for a short-lived credential for one session on the uplink instance. Agent Golf checks that the user is in the workspace and can show the content of that session. See [Sign-in and token lifetimes](https://docs.agent.golf/account/identity.md#sign-in-and-token-lifetimes).
2. The browser exchanges the credential for a local access token at the local API.
3. The local API returns only the content of the session that the credential names.

The users who can show session content are listed in [Session content](https://docs.agent.golf/dashboard/sessions.md#session-content).

## Trust in the dashboard

Agent Golf cannot decrypt session content by itself. The keys and the encrypted content stay on the uplink instance, and Agent Golf stores only references.

The browser of a user is the only path that reveals the content. The local API accepts each credential that Agent Golf signs, and Agent Golf serves the dashboard code that shows the content. Thus a user who opens session content in the dashboard trusts Agent Golf with that content, as with any web app that shows your data.

If you do not accept this trust, remove the path. The dashboard then shows session totals and timelines, but no content.

* **Binary or container image:** leave `UPLINK_LOCAL_API_ADDR` (`-local-api-addr`) unset, the default. The local API then does not run.
* **Helm chart:** the local API always runs, because the probes use it, but browsers reach it only when you expose it. Keep the Service `uplink` at type `ClusterIP`, add no route to port 9090, and leave `config.UPLINK_LOCAL_API_ADVERTISE_URL` empty, the default. To also limit the peers that reach port 9090 in the cluster, set `networkPolicy.enabled` and keep `networkPolicy.localApiFrom` empty. An empty list admits no peer, and the kubelet probes continue. The policy also needs a non-empty `networkPolicy.otlpFrom`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.