Get API Credentials
Every Slack API call needs a token. This guide walks you through creating a Slack App, picking scopes, installing it to a workspace, and grabbing the bot token you'll use for every request.
Time to credentials: ~3 minutes. No code in this guide — just clicks and a copy-paste. Head to the 5-minute quickstart once you have your token.
Prerequisites
A Slack workspace
You need permission to install apps. Create one free if you don't have a workspace handy — it takes under a minute.
A test channel
Pick (or create) a channel like #bot-testing so you can invite your app there and post without bothering anyone.
Step-by-Step
Go to api.slack.com/apps, click Create New App, choose From scratch, name it (e.g., My First App), and pick your workspace. You'll land on the Basic Information page — keep that tab open.
Reinstall after every scope change. Adding or removing OAuth scopes only takes effect after you click Reinstall to Workspace — the existing token stays bound to the old scope set.
Which Token Do I Use?
Slack hands you two kinds of tokens depending on what your app needs to do. Most integrations only ever touch the bot token.
Bot User OAuth Token
Starts with xoxb-. Acts as your app. This is the default for posting messages, reacting to events, opening modals — anything where "the app did it" makes sense. Use this unless you have a specific reason not to.
User OAuth Token
Starts with xoxp-. Acts on behalf of the user who installed the app. Use it only when you need to read or write as that user — e.g., searching their DMs, posting as them in a channel they belong to but your bot doesn't.
Verify Your Token
Before you start writing real code, confirm the token works. The fastest sanity check is auth.test — it echoes back the workspace, user, and bot IDs your token resolves to.
curl -X POST "https://slack.com/api/auth.test" \
-H "Authorization: Bearer xoxb-your-bot-token" \
-H "Content-Type: application/json"A successful response looks like:
{
"ok": true,
"url": "https://your-workspace.slack.com/",
"team": "Your Workspace",
"user": "your-app",
"team_id": "T0123456789",
"user_id": "U0123456789",
"bot_id": "B0123456789"
}If ok is true, your token is live and you're ready to post a real message.
Common Setup Errors
Distributing to Other Workspaces
If your app will be installed by other people's workspaces (the Slack Marketplace path), you'll layer OAuth v2 on top of the steps above: redirect users to Slack's authorization URL, handle the callback with a code, exchange it for an access token via oauth.v2.access, and store the token keyed by team_id.
The full pattern lives in Building Integrations.
Next Steps
5-Minute Quickstart
Install the SDK and post your first real message — every language, copy-paste ready.
SDK Setup
Full install and client-configuration walkthroughs for every supported language.
Build a Bot
Add interactivity, slash commands, and event handling on top of your fresh token.
API Reference
Browse every endpoint with live, language-specific code samples.

