---
title: "Exchange the Slack OAuth code"
method: POST
path: "/api/{org_id}/alerts/destinations/slack/oauth/exchange"
tags: ["Alerts"]
---

# Exchange the Slack OAuth code

`POST /api/{org_id}/alerts/destinations/slack/oauth/exchange`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/api/{org_id}/alerts/destinations/slack/oauth/exchange`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/api/:org_id/alerts/destinations/slack/oauth/exchange/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required

## Request body

- SlackOAuthExchangeRequest: Slack's callback code plus the still-unexpired state issued by `start`.
  - `code` string, required
  - `state` string, required

## Response `200`

Connected Slack incoming webhook

- SlackOAuthConnection: Only the channel-bound incoming webhook; the access token never leaves the server.
  - `channel` string, required
  - `channelId` string, required
  - `teamId` string, required
  - `teamName` string, required
  - `webhookUrl` string, required

## Other responses

- `400`: Invalid or rejected authorization
- `502`: Slack authorization service failure
- `503`: Slack OAuth is not configured

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
