---
title: "Complete connecting a Slack workspace with the code and state Slack handed back to the front. Returns the organization's connection with that workspace, now active: a new one, the pending one, or the one the organization already had (reconnected)."
method: POST
path: "/v2/organizations/{organizationId}/slack-connections"
tags: ["Organization Slack Connections Api Service"]
---

# Complete connecting a Slack workspace with the code and state Slack handed back to the front. Returns the organization's connection with that workspace, now active: a new one, the pending one, or the one the organization already had (reconnected).

`POST /v2/organizations/{organizationId}/slack-connections`

## Request

- Base URL: `https://app.metricool.com/api`
- URL: `https://app.metricool.com/api/v2/organizations/{organizationId}/slack-connections`
- Auth: none declared

## Path parameters

- `organizationId` integer, required

## Request body

- CreateSlackConnectionRequest: What Slack handed back to the front after the user approved the app.
  - `code` string, required: The code query parameter Slack added to the callback page.
  - `state` string, required: The state query parameter Slack added to the callback page, as returned by POST /v2/organizations/{organizationId}/slack-connections/authorizations.

## Response `201`

Workspace connected.

## Other responses

- `400`: Invalid body, or the reason as error title: slackAuthorizationExpired (unknown, expired or already used state), slackAuthorizationRejected (Slack refused the code), slackEnterpriseInstallNotSupported (organization-wide Enterprise Grid install) or slackMissingScopes (the app was approved without all its permissions).
- `403`: Caller is not a regular-user session, or is neither the organization owner nor a team member with manageBrands (a team member also needs the organization to be usable: its permissions feature and the owner's plan). Also slackPlanRequired: the owner's plan does not allow Slack (slack-availability locked or planLocked). Also slackAuthorizationNotOwned: the authorization was started by another user or for another organization.
- `404`: Organization not found, or its owner account could no longer be resolved.
- `502`: slackUnavailable: Slack could not be reached or gave an unexpected answer.
- `503`: slackNotConfigured: this environment has no Slack app credentials.

---

[API](https://skmtc.dev/metricool/apis/metricool-api.md) · [All operations](https://skmtc.dev/metricool/apis/metricool-api/llms.txt) · [OpenAPI document](https://skmtc.dev/metricool/apis/metricool-api/revisions/cd0ca612fa01?raw)
