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

# Retrieve customer context

> Retrieve the signed-in customer’s approved account context, then use it to answer a support-plan question.

Retrieve the signed-in customer’s approved account context, then use it to answer a support-plan question. This guide uses the same protected service contract across the five warehouse manuals; the selected manual owns its provider access and deployment.

## Before you begin

- A test application with a real sign-in and a developer-owned runtime proxy. The backend maps the authenticated login to the authorized tenant/customer and keeps runtime credentials/session keys server-side.
- One completed warehouse setup: [Snowflake](/docs/guides/integrations/snowflake/overview), [BigQuery](/docs/guides/integrations/bigquery/overview), [Redshift](/docs/guides/integrations/redshift/overview), [Fabric Warehouse](/docs/guides/integrations/microsoft-fabric/overview) or [Databricks SQL](/docs/guides/integrations/databricks/overview). Its service, Secret, API tool and provided lookup-token variable must pass the manual’s standalone check.
- Two distinct test customers, a data owner’s approved field definitions and a freshness policy. The example view contains plan, support tier, open-case count and source refresh time.

## Retrieve and use the context

### 1. Authorize the current customer

Have the application backend authenticate the login and resolve its tenant/customer mapping. Use `trustedContextTurn` on every forwarded launch, turn and supported resume; it issues a short-lived signed lookup token and discards browser variable/state/identity overrides. Stop private lookup when the mapping is missing. A typed email, runtime user ID or initial launch variable alone is not authentication.

### 2. Attach the current lookup

#### Studio

Open **Agent → Global tools → Read authorized customer context**. Keep **service_token** provided by the restricted Secret and **lookup_token** provided by `warehouse_lookup_token`. Set **Trigger** to reading the signed-in customer’s support plan or case count when they ask. A saved request in Tools alone is not an agent attachment.

Native API tool for the protected context service — Bind the lookup to the service and the customer authorized by your application.

#### Developer

Follow the selected provider manual’s API-tool creation and attachment commands. Retain `API_TOOL_ID`; its attachment must use the two returned input IDs and provided defaults. Compile the test Draft and resolve `unresolvedReferences`. The proxy must provide a fresh token for the same login on every turn; keep credentials on the backend.

### 3. Answer the actual customer question

Send “What support does my plan include?” through the authenticated application. Inspect the current tool invocation and result before answering. Require `ok: true`, `found: true`, the intended customer ID and an allowed `source_updated_at`. Use only the approved plan/tier/case fields and the data owner’s policy; a tier label alone does not define service entitlements.

### 4. Handle missing, stale or failed context

For `found: false`, rejected authorization or unavailable/stale data, explain that account context is unavailable and continue with general help. Do not reuse a previous customer’s result or infer that an absent row means no account. `fetched_at` is the request time; only `source_updated_at` describes upstream freshness.

## Verify the customer boundary

1. Customer A and Customer B each receive only their approved context and an answer consistent with it.
2. A later-turn foreign ID/token/state override cannot change the server-authorized mapping. Test the proxy and the actual tool result, not only a model’s refusal.
3. Expired/tampered tokens, duplicate rows, stale source data and revoked provider access produce the general-help path without private data.
4. An unfinished provider query does not produce an account-specific answer. The service deadline does not prove that remote compute stopped.

A current warehouse read does not ingest Knowledge. For reusable reference content, follow [Importing data sources](/docs/documentation/build/importing-data-sources) and verify its separate selection, completion and refresh contract.
