---
title: "Slack Set Connection Dataset"
method: POST
path: "/api/v1/integrations/slack/connection/dataset"
tags: ["integrations"]
---

# Slack Set Connection Dataset

`POST /api/v1/integrations/slack/connection/dataset`

## Request

- Base URL: `https://api.aws.cognee.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.aws.cognee.ai/api/v1/integrations/slack/connection/dataset`
- Auth: API key in header `X-Api-Key`

Choose or clear Slack's target dataset. Owner-only (CLO-1014).

``payload.dataset_id`` is checked against
:func:`~.flow.list_writable_datasets`, never trusted from the request
body alone — that list is also where a name shaped like some
connector's own default has already been excluded (finding #1), and
this route stores *that* list's own name for the id, never
``payload.dataset_name`` (finding #2), same as the generic connector
framework's version of this route.

``delete_old_target`` is far more limited here than in the generic
framework. Slack's bulk messages are tagged
(``modules/integrations/slack_dlt_source.py``'s ``SOURCE_TAG``), but
the attachments a sync also ingests go through a plain, untagged
``remember()`` call (``get_slack_sync_router.py``'s
``_ingest_attachments``) — there is no way to identify which rows in
a *shared* dataset are this connection's attachments, so leaving a
chosen target always refuses the delete (409, finding #11) rather
than leaving them orphaned or, worse, guessing. Leaving Slack's own
default is different: nothing else can ever share that name
(``f"slack-{team_id}"`` is exclusive to this connection by
construction, the same invariant ``dataset_name_for`` relies on for
every other connector's default), so an unscoped whole-dataset wipe
is safe there and is allowed.

**Write, then delete, never the other way round (finding #6)** —
same ordering and the same reasoning as the generic framework's
version: the new target is recorded first, under the row's own lock
with an optimistic check against a concurrent write, and only once
that has committed does a requested delete run.

``sweep_previous_only`` (CLO-1069) switches this into a dedicated
mode that never resolves or writes a new target at all - see the
generic framework's own field docstring and its ``_sweep_previous_
only`` for the retry-banner bug this closes.

## Query parameters

- `tenant_id` string, uuid, required

## Request body

- IntegrationsGetIntegrationsRouterSetTargetDatasetPayload: Body for ``POST /slack/connection/dataset`` (CLO-1014). Same contract as the generic connector framework's own version in ``get_connectors_router.py`` — Slack predates that framework and is not migrated onto it (CLO-628 scope), so this is a small, deliberate duplicate rather than a shared import between two routers that otherwise know nothing about each other. ``sweep_previous_only`` (CLO-1069) is the same addition in both: see the generic router's own field docstring.
  - `dataset_id` string, uuid, nullable
  - `dataset_name` string, nullable
  - `delete_old_target` boolean
  - `sweep_previous_only` boolean

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

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