---
title: "Stop bandit"
method: POST
path: "/api/v2/experiments/bandits/{bandit_id}/stop"
tags: ["Experiments"]
---

# Stop bandit

`POST /api/v2/experiments/bandits/{bandit_id}/stop`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/experiments/bandits/{bandit_id}/stop`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `product_analytics_experiments_write`

Stop a running or paused bandit. From then on its targeting rule serves `served_variant_key` to everyone, overriding any configured fallback, and the bandit stops refreshing. `served_variant_key` can be any of the flag's variants. Stopping can't be reversed and is not idempotent: stopping a bandit that has already stopped or completed returns 409. Bandits must be enabled for the organization.

## Path parameters

- `bandit_id` string, uuid, required: The UUID of the bandit.

## Request body

- ExperimentsStopBanditV2Request: Request to stop a bandit and serve one variant.
  - `data` ExperimentsStopBanditV2RequestData, required: The variant to serve once the bandit stops.
    - `attributes` ExperimentsStopBanditV2RequestDataAttributes, required: The variant to serve once the bandit stops.
      - `served_variant_key` string, required: Key of the flag variant to serve to everyone once the bandit stops. It can be any of the flag's variants, and overrides the configured fallback.
    - `type` 'stop-bandit-request', required: Stop bandit request resource type.

## Response `204`

The bandit is stopped and serves the chosen variant.

## Other responses

- `400`: Malformed bandit ID, a malformed request body, a missing `served_variant_key`, or a `served_variant_key` that isn't a variant of the bandit's flag.
- `401`: Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session).
- `403`: Bandits are not enabled for the organization, the caller lacks the product_analytics_experiments_write permission, or the caller lacks edit access to the bandit's flag or environment.
- `404`: No bandit with this ID exists for the organization.
- `409`: The bandit isn't running or paused, its flag environment requires an approval, or a pending change request touches the flag's targeting rules. Retrying alone does not resolve an approval requirement.
- `415`: Request body sent with a media type other than application/json or application/vnd.api+json.
- `429`: Too many requests

## Changes

- **2026-11-20** `3b1c63e31740`: 4 warning
  - the optional response header `X-RateLimit-Limit` removed for the status `429`
  - the optional response header `X-RateLimit-Period` removed for the status `429`
  - the optional response header `X-RateLimit-Remaining` removed for the status `429`
  - the optional response header `X-RateLimit-Reset` removed for the status `429`
- **2026-11-19** `8623cd014a4f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/changes/api/v2/experiments/bandits/:bandit_id/stop/post.md)

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/4ba32926196d?raw)
