Unkey Deploy is currently in private beta. To get access, reach out on
Discord or email
support@unkey.com.
X-Unkey-Principal request header. Your app receives the authenticated identity without performing its own credential checks.
The Sentinel supports API key authentication today, with JWT coming soon. All authentication methods produce the same Principal structure, so your app handles identity the same way regardless of how the request was authenticated.
How it works
After all policies pass, the Sentinel serializes the Principal as JSON and sets theX-Unkey-Principal header on the proxied request. The Sentinel always strips any client-supplied X-Unkey-Principal header before policy evaluation, so clients can’t forge identity information. Since all traffic to your deployment routes through the Sentinel, you can trust the header unconditionally.
Only one Principal exists per request. If multiple authentication policies match, the first successful one sets the Principal and subsequent authentication policies are skipped.
The Principal
Your app reads the authenticated identity from theX-Unkey-Principal request header. If the header is absent, the request is anonymous. Here’s an example for an API key linked to an identity:
Downstream policies
Other policies can use the Principal for their own decisions without knowing which authentication method produced it. For example, a rate limit policy can throttle requests persubject, and an API key policy can enforce permissions before requests reach your app. This decoupling means you can swap authentication methods without reconfiguring downstream policies.
