Back to Blog
Developers

Slack Token Regex: Formats of xoxb, xoxp, xapp and Webhooks, Tested With gitleaks

We minted a bot token, user token, app-level token and webhook URL in a new Slack workspace and ran gitleaks 8.30.1 and betterleaks 1.7.4 over them. Both missed the xoxb and xoxp tokens, because the workspace IDs are 14 digits and the rules allow 13.

Slack Green Team
November 13, 2026
November 13, 2026
3 min read
Share:
slack
slack api
security

A Slack bot token today looks like xoxb- followed by two numbers and a 24-character secret, for example xoxb-<14 digits>-<14 digits>-<24 letters and digits>. On 13 November 2026 we created a throwaway app in a new test workspace, collected one token of each type, recorded each shape, and ran two secret scanners over them. gitleaks 8.30.1 and betterleaks 1.7.4 both missed the bot token and the user token, because their rules expect the two numbers to be 10 to 13 digits long and this workspace's are 14.

Token shapes we saw

All values are masked here, and every token was revoked when the app was deleted.

TokenLengthShape
Bot token59xoxb-<14 digits>-<14 digits>-<24 letters/digits>
User token82xoxp-<14 digits>-<14 digits>-<14 digits>-<32 hex>
App-level token (Socket Mode)98xapp-1-<11 uppercase/digits>-<14 digits>-<64 hex>
Incoming webhook URL81https://hooks.slack.com/services/T<10>/B<10>/<24 letters/digits>
Browser session token114xoxc-<14 digits>-<14 digits>-<14 digits>-<64 hex>
Session cookie d (decoded)205xoxd- then a long base64-style value with / and +

The numbers are IDs, not secrets. In both the bot token and the user token, the first number was the same as the part of the app's client ID before the dot, which every app in that workspace shares. The secret part is the last segment. Our test workspace is new and its IDs are 14 digits, which is what broke the scanners; older workspaces have shorter ones. For what each token type can do, see the Slack bot token guide and the xoxc and xoxd explainer.

gitleaks and betterleaks results

We wrote the six values into one file and ran both scanners on it:

$ gitleaks dir leak_probe -f json
INF scanned ~777 bytes (777 bytes)
WRN leaks found: 2
[('slack-app-token', 3), ('slack-webhook-url', 4)]

$ betterleaks dir leak_probe -f json
[('slack-app-token', 3), ('slack-webhook-url', 4), ('slack-session-token', 5), ('slack-session-cookie', 6)]
Tokengitleaks 8.30.1betterleaks 1.7.4
Bot token (xoxb)missedmissed
User token (xoxp)missedmissed
App-level token (xapp)slack-app-tokenslack-app-token
Webhook URLslack-webhook-urlslack-webhook-url
Session token (xoxc)no ruleslack-session-token
Session cookie (xoxd)no ruleslack-session-cookie

These are the gitleaks rules that should have caught the two misses:

slack-bot-token        xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*
slack-legacy-bot-token xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}
slack-user-token       xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}

[0-9]{10,13} stops one digit short of our 14-digit IDs. The legacy rule allows 14 digits in the first number, but then expects letters, and the second segment is a number. A token from an older workspace with shorter IDs still matches, so a scanner test with an old token passes while new tokens slip through.

Never appear "away" on Slack again

Cloud-based. No downloads. Works 24/7 even when your laptop is off.

Regexes that matched every token

These matched all six of our values and keep the old lengths:

import re

SLACK_PATTERNS = {
    "bot":     r"xoxb-\d{10,15}-\d{10,15}-[A-Za-z0-9]{24}",
    "user":    r"xoxp-\d{10,15}-\d{10,15}-\d{10,15}-[a-f0-9]{32}",
    "app":     r"xapp-\d-[A-Z0-9]{9,12}-\d{10,15}-[a-f0-9]{64}",
    "webhook": r"https://hooks\.slack\.com/services/T[A-Z0-9]{8,12}/B[A-Z0-9]{8,12}/[A-Za-z0-9]{24}",
    "xoxc":    r"xoxc-\d{10,15}-\d{10,15}-\d{10,15}-[a-f0-9]{64}",
    "xoxd":    r"xoxd-[A-Za-z0-9%/+=]{80,}",
}

def find_slack_tokens(text):
    return [(name, m.group(0)[:12] + "...")
            for name, rx in SLACK_PATTERNS.items()
            for m in re.finditer(rx, text)]
bot True
user True
app True
webhook True
xoxc True
xoxd True

Slack does not publish a token grammar, so treat these as tested against one workspace, not as a spec. A loose prefix rule such as xox[abposr]-[0-9A-Za-z-]{20,} does not care about lengths; it matched our bot and user tokens, but not the app token, webhook URL, xoxc or xoxd, so keep those four rules beside it.

If a scanner finds a token

Revoke it first, then rotate. A bot or user token can be revoked with auth.revoke; an app-level token is revoked on the app's Basic Information page; a webhook URL dies when you remove that webhook from the app. Turning on token rotation gives bot and user tokens a 12-hour life, so a leaked one expires on its own.

FAQ

Is a Slack token in a public GitHub repo revoked automatically?

Slack is a GitHub secret scanning partner, and Slack's docs say it revokes tokens that GitHub reports. We did not push a live token to test it, and GitHub's own patterns are not public.

Does the xoxb prefix ever change?

xoxb has meant a bot token for years. With token rotation on, the access token starts with xoxe.xoxb- and the refresh token with xoxe-, which gitleaks covers with separate rules.

Always Active

Stop Jiggling Your Mouse.

Join hundreds of remote workers who never worry about their Slack status. Set it up once, stay green forever.

Related Articles

Developers

Slack Verification Token: Deprecated, Still Sent, Tested

The Verification Token still arrives in every slash command, event and button payload, but Slack calls it deprecated. We regenerated it on 17 November 2026: slash commands switched at once, events lagged, and only the signing secret check kept working through the change.

Slack Green Team
Developers

Slack App Configuration Token: Generate, Rotate and Revoke

An app configuration token lets a script create Slack apps from manifests. We generated one, rotated it five times and tested it again 28 hours later.

Slack Green Team
Developers

Slack App Collaborators: Add, Remove and Transfer Ownership

Collaborators are the people who can edit a Slack app. We added and removed one on 20 November 2026 as a regular member of a test workspace, recorded who can be added and what Slack asks you to do after a removal, and wrote down the hand-over path Slack documents.

Slack Green Team