Are PATs (user or service principal) accepted by Databricks Apps?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2026 02:09 AM
- Is the 401 expected behavior, and is it documented anywhere?
- Is there a supported way for an external system with only a static header to call a Databricks App?
I want to receive webhooks from an external SaaS product. The sender can only POST to a public HTTPS URL, and it has a beta feature that lets me add static custom header values. It can’t run an OAuth flow or refresh tokens.
what I've tested:
- A service principal with Can USE on the app, and an OAuth M2M secret. Calling the app with the OAuth access token works. The request reaches my code.
- A PAT for the service principal, sent to the app URL. This returns HTTP 401 with an empty body, so the app proxy rejects it before my code runs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2026 05:22 PM - edited 10-13-2026 05:31 PM
Yes, the 401 is expected: the Databricks Apps proxy only accepts OAuth access tokens, not PATs, so it rejects the request before your code runs. A static header can't hold an OAuth token either, because M2M tokens expire after about an hour. The supported pattern is a small relay in front of the app that holds the service principal's OAuth secret, gets and caches a token, and forwards the webhook.
Why the PAT fails
- PATs work for the workspace REST API, but app URLs go through the Apps auth proxy, which only accepts OAuth tokens (user U2M or service principal M2M).
The app docs only describe OAuth bearer tokens (M2M for external systems): https://docs.databricks.com/aws/en/dev-tools/databricks-apps/connect-local. The notebook example there even exchanges a PAT for an OAuth token first, and the MCP-on-Apps docs say outright that PATs aren't supported. So your 401 matches the documented behaviour, even if there's no single sentence saying "PATs rejected."
- There's no anonymous or public mode for an app, so the SaaS sender can't call it directly with only a static header.
You can have a relay setup something like below:
1. Deploy a tiny HTTPS function (AWS Lambda + function URL, Azure Function, Cloud Run or a Cloudflare Worker) as the public webhook target.
2. Have the SaaS send its static header (a long random shared secret) and check it in the relay. Also verify the sender's HMAC signature if it offers one.
3. In the relay, get an M2M token from https://<workspace-host>/oidc/v1/token with grant_type=client_credentials&scope=all-apis, using the service principal's client ID and secret (stored in the cloud's secret manager). Cache the token until shortly before expires_in.
4. Forward the body to the app with Authorization: Bearer <token>. You've already confirmed this path reaches your code.
token = requests.post(f"{HOST}/oidc/v1/token",
auth=(CLIENT_ID, CLIENT_SECRET),
data={"grant_type": "client_credentials", "scope": "all-apis"}).json()["access_token"]
requests.post(APP_URL + "/webhook", data=body,
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"})
If the app only stores the events, consider skipping the app: let the relay write the payloads to a cloud storage path or queue and pick them up with Auto Loader or a Lakeflow pipeline. That way you don't need a long-running endpoint at all.
If the solution helps, please accept it as solution so that it is helpful for other community members 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2026 01:30 PM
Hi @databrickspooja,
PATs are not supported for calling Databricks Apps, and the 401 you're seeing is expected. The Apps ingress proxy only accepts OAuth tokens. A PAT will be rejected before your code ever runs, which is what you're seeing.
The Configure authorization in a Databricks app page documents the supported authentication methods as OAuth U2M and OAuth M2M only. The Connect to an API Databricks app using token authentication page also describes 401 troubleshooting exclusively in terms of OAuth tokens. PATs are not mentioned as a supported option anywhere in the Apps auth docs.
So, to your core question about receiving webhooks from an external SaaS product that can only POST with a static header.. there is no built-in way to make that work directly against a Databricks App URL. The Apps proxy requires a valid OAuth token, and OAuth tokens expire after one hour, so a static header value won't stay valid.
If this answer resolves your question, could you mark it as “Accept as Solution”? That helps other users quickly find the correct fix.
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***