Enable a public endpoint
Add theunauthenticated_requests capability to the @application decorator:
public_api.py
allow attribute accepts a list of application capabilities. At the moment, unauthenticated_requests is the only supported capability.
Deploy the application
Deploy the application normally:public_endpoint_id. Redeploying the application preserves this ID. The public URL has this form:
Authorization header:
Read request headers
A sanitized list of HTTP request headers are available inside your application’s request context when you use public endpoints. You can access them throughRequestContext.get().headers. The Headers collection is immutable and supports case-insensitive lookups:
get() return the last value. getlist() returns all values in their received order.
Tensorlake prevents the following headers from being forwarded into application invocations:
- Credentials and browser state:
Authorization,Authentication,Cookie, and proxy authentication headers - Routing and transport details:
Host, standard hop-by-hop headers, and headers named byConnection
Receive a raw request body
Use the typeHttpBody when you need to parse the request body sent into a public endpoint.
HttpBody exposes the raw bytes through body.content, along with body.content_type, body.text(), and body.json().
Usage example: Receiving webhooks
Webhook providers are a common use for public endpoints. The following handler receives GitHubworkflow_job events and validates each request using GitHub’s X-Hub-Signature-256 header and the exact request body:
github_webhook.py
Disable public access
If you want to disable your application’s public endpoint, removeunauthenticated_requests from the allow list and redeploy: