Skip to main content
By default, applications require an API Key for authorization. Public endpoints let you call applications without Tensorlake credentials.

Enable a public endpoint

Add the unauthenticated_requests capability to the @application decorator:
public_api.py
The 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:
On the first deployment, Tensorlake assigns the application a stable, opaque public_endpoint_id. Redeploying the application preserves this ID. The public URL has this form:
After the application is deployed, you can call the public endpoint without an 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 through RequestContext.get().headers. The Headers collection is immutable and supports case-insensitive lookups:
When a header has multiple values, 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 by Connection

Receive a raw request body

Use the type HttpBody 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 GitHub workflow_job events and validates each request using GitHub’s X-Hub-Signature-256 header and the exact request body:
github_webhook.py
Store the same secret that you configure with GitHub, then deploy the application:

Disable public access

If you want to disable your application’s public endpoint, remove unauthenticated_requests from the allow list and redeploy: