Per-request keys
A per-request key is a short-lived credential that DIAL Core generates for a single request to an application or model adapter. It is valid only for the lifetime of that request. Per-request keys govern an application's access to user files, attribute cost and usage limits to the request originator, carry OpenTelemetry tracing context, and mediate access for external applications reached through routes.
This page is a reference for how per-request keys behave. It is intended for developers building applications, adapters, or Toolsets that DIAL Core invokes.
Request types
DIAL Core distinguishes two kinds of request when issuing keys.
| Term | Definition | Example |
|---|---|---|
| Root request | The initial request DIAL Core receives from DIAL Chat or another client. | DIAL Chat → DIAL Core |
| Non-root request | A request DIAL Core makes to fulfil the root request. | DIAL Chat → DIAL Core → Application A → DIAL Core → Application B |
Key lifecycle
Root request
- DIAL Core verifies that the caller — a chat user or an application — has the permissions and limits required by the access control configuration, then generates a per-request key for the request.
- DIAL Core stores data associated with the key in memory or in Redis. This data may include the user's JWT or the application's API key, the
trace-id, thecore-parent-span-id, and the list of user files attached to the request. - DIAL Core passes the key to the application or model adapter in the
Api-Keyheader. The application or adapter returns the same key in theApi-Keyheader when it calls DIAL Core for model requests or file storage operations. - DIAL Core invalidates the key when the request completes.
Non-root request
- DIAL Core verifies that the incoming per-request key — the one issued for the root request — is valid and known.
- DIAL Core checks the caller's permissions, then generates and stores a new outgoing key. This key carries all data from the parent request plus the data needed for the current request.
- DIAL Core passes the new outgoing key in the request header. The application or adapter returns it in the
Api-Keyheader when calling DIAL Core. - DIAL Core invalidates the outgoing key when the request completes.
Associated data
Each key is linked to data used to enforce access, attribute cost, and record telemetry.
| Field | Purpose |
|---|---|
| JWT or API key | Identifies the request originator for permission and limit checks. |
trace-id | Attributes cost, usage limits, and statistics to the originating request. |
core-parent-span-id | Correlates spans when gathering statistics. |
| Attached user files | The set of files the application is permitted to access during the request. |
Cost and limit attribution
DIAL Core attributes the cost and usage limits of a model call to the user or application that initiated the request. Include traceparent in the request header so that the trace-id is preserved across the request lifetime in memory or in Redis.
Statistics
DIAL Core computes statistics from the trace-id and core-parent-span-id stored in the data linked to the key.
File access
DIAL Core verifies the originator's permissions and limits using the JWT or API key from the root request, then links the request's user files to the per-request key. Throughout the key's lifetime and across the call stack, DIAL Core uses this linked data to determine the application's access rights. If an application attempts to share a file that is neither in the linked list nor directly accessible to it, the request fails with 403 Forbidden.
To let an application write output files for the user, DIAL Core grants the application full access to a designated output folder in the user's bucket.
appdata in the bucket response
The path of the output folder is returned in the appdata field of the GET /v1/bucket response. When the request is made with a per-request key, appdata contains the path to the shared folder, including the user's bucket and the application's deployment-id as registered in the DIAL Core configuration.
{
"bucket": "{application-bucket-id}",
"appdata": "{user-bucket-id}/appdata/{deployment-id}"
}
Telemetry tracing
For OpenTelemetry tracing, include traceparent in the request header. Tracing does not affect limits, statistics, or file sharing.
Routes for external applications
Applications can communicate through routes — endpoints registered in DIAL Core that need not conform to the Unified API. A route bridges DIAL Core and an external application: DIAL Core acts as an intermediary, handling authentication and authorization between the client and the external endpoint.
External applications have no direct access to DIAL resources, but they may need to read user data or call other applications and models in DIAL. Per-request keys issued for routes enable:
- Access to language models and applications.
- A dedicated workspace in the BLOB store, where the route can read and write files under
/Keys/<route_name>/. - The ability to fetch user information through the
/v1/user/infoendpoint.
Access and cost control for routes
Assign roles to a route to control access and limits. In the following configuration, the route myApp requires the app_user role, and a user with that role may call the route up to 1000 times per minute:
{
"routes": {
"myApp": {
"userRoles": ["app_user"]
}
},
"roles": {
"app_user": {
"limits": {
"myApp": {
"requestsPerMin": "1000"
}
}
}
}
}
For the full schema, see routes configuration and roles configuration.
Example
A DIAL Chat user asks an external RAG application to answer a prompt based on an attached file:
- DIAL Chat uses a route to reach the external RAG application. DIAL Core generates a per-request key for the interaction.
- The RAG application uses the key to call a language model in DIAL, which processes the file and generates a response.
- The response is relayed back to the user in DIAL Chat, completing the request.
Access to models and request limits are determined by the roles assigned to both the route and the user in DIAL Core.
Further reading
- Auth matrix for apps — securing access across application dependency chains
- DIAL Core configuration: Keys — API key entries, their roles, and IP limits
- DIAL Core configuration: Routes — publish your own HTTP or WebSocket API through Core
- DIAL Core configuration: Roles — role fields for access, limits, and sharing
- File management — the file operations that per-request keys authorize
- Data protection and isolation — which controls protect data and where external systems take over