---
title: "Get bandit"
method: GET
path: "/api/v2/experiments/bandits/{bandit_id}"
tags: ["Experiments"]
---

# Get bandit

`GET /api/v2/experiments/bandits/{bandit_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/experiments/bandits/{bandit_id}`
- 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_read`

Get a bandit: its setup, the policy it serves, its latest refresh, and the arm most likely to be best. When the caller lacks feature flag or environment read permissions, the response omits `datadog_flag_configuration` and `meta.warnings` includes `datadog_flag_configuration_omitted`. Bandits must be enabled for the organization.

## Path parameters

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

## Response `200`

OK

- ExperimentsBanditV2DTO: Response containing a bandit.
  - `data` ExperimentsBanditV2DTOData, required: JSON:API resource containing a bandit.
    - `attributes` ExperimentsBanditV2DTODataAttributes, required: A bandit's setup, the policy it serves, and its latest refresh.
      - `active_policy` ExperimentsBanditPolicyV2, nullable, required: The policy the bandit serves. `null` until the bandit starts.
        - `applied_at` string, date-time, required: When the policy started being served.
        - `config_version` integer, required: The configuration version the policy was made for.
        - `id` string, uuid, required: The policy ID. Each exposure logs it as `bandit.policy_id`.
        - `kind` 'WARMUP' | 'ADAPTIVE' | 'FALLBACK', required: `WARMUP` serves the arms equally. `ADAPTIVE` serves the initial split or a split from a refresh. `FALLBACK` serves one variant after the bandit ends.
        - `reason` 'ACTIVATION' | 'REFRESH' | 'ARM_CHANGE' | 'SCHEDULED_END' | 'STOP', required: Why the policy was applied.
        - `variants` ExperimentsBanditPolicyVariantV2[], required: Each variant's share of traffic. The probabilities add up to 1.
          - `feature_flag_variant_id` string, uuid, required: The variant's ID on the flag.
          - `probability` number, double, required: The share of traffic the variant gets, from 0 to 1.
          - `variant_key` string, nullable, required: The variant's key. `null` when it can't be resolved.
      - `aggregation_window_seconds` integer, required: The aggregation window: how long after an exposure the bandit keeps counting its reward, in seconds.
      - `bayesian_prior` ExperimentsBanditBayesianPriorV2, required: The prior the bandit's estimates start from.
        - `arm_standard_deviation` number, double, required: Prior standard deviation of each arm's mean around the shared mean.
        - `grand_mean` number, double, required: Prior mean of the shared mean of the arms, in the metric's units.
        - `grand_mean_standard_deviation` number, double, required: Prior standard deviation of the shared mean of the arms.
      - `config_version` integer, required: The version of the bandit's configuration. Each saved change adds one.
      - `created_at` string, date-time, required: When the bandit was created.
      - `datadog_flag_configuration` ExperimentsBanditFlagConfigurationV2: The flag rule the bandit serves through. Absent until a draft is added to a flag. Also absent when the caller lacks feature flag or environment read permissions, in which case `meta.warnings` includes `datadog_flag_configuration_omitted`.
        - `allocation_key` string, required: The key of the bandit's rule on the flag. Exposures log it.
        - `environment_id` string, uuid, required: The environment the bandit serves in.
        - `feature_flag_id` string, uuid, required: The flag the bandit serves through.
        - `targeting_rules` ExperimentsTargetingRule[], required: Who the bandit serves. When empty, the bandit serves everyone in the environment.
          - `conditions` ExperimentsTargetingRuleCondition[], required: Conditions that must all match for this rule. Each condition must use exactly one shape: saved_filter_id alone or operator plus attribute plus value.
            - union: A saved-filter condition or a complete inline condition. The two forms cannot be combined.
              - …
      - `description` string, required: The bandit's description.
      - `ended_at` string, date-time, nullable, required: When the bandit was stopped or reached its scheduled end. `null` while it hasn't ended.
      - `exposure_sql_model_id` string, uuid, nullable, required: The exposure SQL model the bandit reads its exposures from. `null` until set on a draft.
      - `latest_refresh` ExperimentsBanditRefreshV2, nullable, required: The most recently started refresh. `null` until one starts.
        - `created_at` string, date-time, required: When the refresh was requested.
        - `ended_at` string, date-time, nullable, required: When the refresh finished. `null` while it runs.
        - `id` string, uuid, required: The refresh ID.
        - `started_at` string, date-time, nullable, required: When the refresh started running. `null` while it is pending.
        - `status` 'PENDING' | 'RUNNING' | 'SUCCEEDED' | 'FAILED' | 'CANCELLED', required: The status of the refresh.
      - `lookback_seconds` integer, required: How far back each refresh reads observations, in seconds.
      - `metric_id` string, uuid, nullable, required: The metric the bandit optimizes. `null` until set on a draft.
      - `name` string, required: The bandit's name.
      - `optimal_variant_key` string, nullable, required: The key of the arm most likely to be best, when one arm leads and the bandit is outside warmup. `null` otherwise. Matches Get bandit results.
      - `optimal_variant_unavailable_reason` 'NO_RESULTS_YET' | 'WARMUP' | 'NOT_ENOUGH_DATA' | 'NO_DIFFERENCE' | 'STATS_UNAVAILABLE': Why no optimal variant is reported. Absent when one is, or when the cause isn't known.
      - `refresh_schedule_id` string, nullable, required: The schedule the bandit refreshes on.
      - `scheduled_end_at` string, date-time, nullable, required: When the bandit ends and serves its fallback. `null` when it has no scheduled end.
      - `scheduled_end_failure` ExperimentsBanditScheduledEndFailureV2: Why the scheduled end couldn't run. It isn't retried until the end date or fallback changes. Absent when there's no failure.
        - `failed_at` string, date-time, required: When the scheduled end failed.
        - `reason` string, required: Why the scheduled end failed.
      - `started_at` string, date-time, nullable, required: When the bandit started. `null` until it starts.
      - `status` 'DRAFT' | 'SCHEDULED' | 'RUNNING' | 'PAUSED' | 'STOPPED' | 'COMPLETED', required: The bandit's status. `STOPPED` means the bandit was stopped and serves the variant chosen then. `COMPLETED` means it reached its scheduled end and serves its fallback.
      - `subject_type_id` string, uuid, nullable, required: The subject type the bandit randomizes and measures by. `null` until set on a draft.
      - `tags` string[], required: The bandit's tags, without team tags.
      - `teams` string[], required: Handles of the teams that own the bandit.
      - `updated_at` string, date-time, required: When the bandit was last changed.
      - `variants` ExperimentsBanditVariantV2[], required: The flag variants the bandit uses: its arms in arm order, then its fallback when the fallback isn't an arm.
        - `feature_flag_variant_id` string, uuid, required: The variant's ID on the flag.
        - `is_active` boolean, required: Whether the variant is one of the arms the bandit chooses between.
        - `is_fallback` boolean, required: Whether the variant is served when the bandit reaches its scheduled end. At most one variant is the fallback.
        - `key` string, nullable, required: The variant's key. An arm keeps the key it had when it was added, because exposures are matched on it. `null` only for a fallback deleted from the flag.
        - `name` string, nullable, required: The variant's name on the flag. `null` when it is no longer on the flag.
      - `warmup_seconds` integer, nullable, required: How long the bandit serves its arms equally after it starts, in seconds. `null` when it has no warmup.
    - `id` string, uuid, required: The bandit ID.
    - `type` 'bandits', required: Bandit resource type.
  - `meta` ExperimentsBanditV2ReadMetaDTO: Information about the bandit response.
    - `warnings` ExperimentsBanditV2WarningDTO[]: Warnings about the response. Absent when there are none.
      - `code` 'datadog_flag_configuration_omitted', required: Code that identifies the warning. `datadog_flag_configuration_omitted` means the caller lacks feature flag or environment read permissions, so the response leaves out `datadog_flag_configuration`.
      - `detail` string, required: Explanation of the warning.

## Other responses

- `400`: Malformed bandit ID (not a valid UUID).
- `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, or the caller lacks the product_analytics_experiments_read permission.
- `404`: No bandit with this ID exists for the organization.
- `429`: Too many requests

## Changes

- **2026-11-17** `633e476d0d57`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/changes/api/v2/experiments/bandits/:bandit_id/get.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/8d1a5e5973da?raw)
