Create experiment
https://api.datadoghq.com/api/v2/experimentshttps://api.us3.datadoghq.com/api/v2/experimentshttps://api.us5.datadoghq.com/api/v2/experimentshttps://api.datadoghq.eu/api/v2/experimentshttps://api.ap1.datadoghq.com/api/v2/experimentshttps://api.ap2.datadoghq.com/api/v2/experimentshttps://api.uk1.datadoghq.com/api/v2/experimentshttps://api.ddog-gov.com/api/v2/experimentshttps://api.us2.ddog-gov.com/api/v2/experimentsOverview
Create a draft experiment. name is required. structured_metadata identifies each metadata field by field_key; use freetext_value for free-text fields and enum_values for enum fields. When this attribute is present, the request must include a value for every required metadata field. When protocol_id is present, the published protocol supplies the subject type, decision metrics, analysis-plan defaults, and configuration and enforcement baselines. The request may also include hypothesis, tags, teams, related links, and assignment or event date overrides that satisfy the protocol's duration rules; omit subject_type_id, decision_metrics, variants, warehouse_exposure_configuration, datadog_flag_configuration, traffic_exposure, split_by_properties, and structured_metadata. The protocol association cannot be changed after creation. Without protocol_id, a complete Warehouse or Datadog configuration saves the experiment and its configuration in one transaction. For Datadog flag configuration, send name, subject_type_id, decision_metrics, variants, traffic_exposure, assignments_start_date, assignments_end_date, events_start_date, and events_end_date. The four date fields can be null. Inside datadog_flag_configuration, send feature_flag_id, environment_id, targeting_rules, and entry_point. Use targeting_rules: [] and entry_point: null when unused. This creates one saved draft allocation that does not serve traffic. Omit all configuration fields to create an experiment without an allocation. This endpoint is not idempotent.
OAuth apps require the product_analytics_experiments_write authorization scope to access this endpoint.
Request
Body Data (required)
data [required]Experiment resource to create.
attributes [required]Configuration and descriptive fields for the new experiment draft.
assignments_end_dateEnd of the window assignments are read from. Optional; must be after assignments_start_date.
assignments_start_dateStart of the window assignments are read from. Optional.
datadog_flag_configurationFeature flag, environment, and targeting configuration for a Datadog experiment.
entry_point [required]Datadog measure and filters used to select analyzed subjects.
filters [required]Complete Datadog OR-of-ANDs entry-point filter expression.
measure_id [required]Datadog measure UUID.
environment_id [required]Identifier of the feature flag environment.
feature_flag_id [required]Identifier of the Datadog feature flag used by the experiment.
reset_on_feature_flag_changeAccepted on create but has no effect.
targeting_rules [required]Use an empty array when no targeting rules apply.
conditions [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.
Object 1A condition that uses a saved filter. Inline fields must be omitted or null.
saved_filter_id [required]Saved-filter UUID.
Object 2An inline condition. The saved_filter_id field must be omitted or null.
attribute [required]Attribute to evaluate.
operator [required]Required with attribute and value for an inline condition; omit when saved_filter_id is set.
LT, LTE, GT, GTE, MATCHES, NOT_MATCHES, ONE_OF, NOT_ONE_OF, IS_NULL, EQUALSShow 6 more
SEMVER_EQ, SEMVER_NEQ, SEMVER_LT, SEMVER_LTE, SEMVER_GT, SEMVER_GTEvalue [required]Values used by the operator. Every operator requires at least one value.
decision_metricsMetrics selected to support the experiment decision.
is_primary [required]Whether this is the experiment primary metric.
metric_id [required]Decision metric UUID.
events_end_dateEnd of the window metric events are read from. Optional; must be after events_start_date.
events_start_dateStart of the window metric events are read from. Optional; must fall within the assignments window.
hypothesisWhat the experiment is expected to show. Optional and free-form.
migration_metadataMetadata associated with migration of this resource.
name [required]Display name for the experiment. The only required attribute: a request carrying nothing but a name is accepted.
protocol_idPublished protocol whose defaults create this draft. May be combined with hypothesis, tags, teams, related links, and date overrides. Omit subject_type_id, decision_metrics, variants, warehouse_exposure_configuration, datadog_flag_configuration, traffic_exposure, and structured_metadata.
related_linksExternal links associated with the experiment.
idLink ID. Omit it when adding a link.
titleOptional display title.
url [required]Absolute URL.
split_by_propertiesComplete Datadog split-by selection. Identify each property by column_name. Omit this field to copy organization defaults.
column_name [required]Exposure field that identifies the property.
column_typeData type of the column evaluated by the entry-point filter.
varchar, int, double, boolean, varchar_array, int_array, double_array, rawnameOptional display name. Defaults to column_name for a new property.
structured_metadataCustom metadata fields and their values for the experiment.
enum_valuesSelected values for an enumerated metadata field.
field_key [required]Key that identifies the metadata field.
freetext_valueText value for a free-text metadata field.
subject_type_idCanonical ID of an existing subject type. Optional; defaults to the organization default.
summarySummary of the experiment. Optional and free-form.
tagsNon-team tag names to apply. Optional.
teamsTeam handles that own the experiment. Optional.
traffic_exposureTraffic exposure fraction or schedule configured for the experiment.
fractionSTATIC exposure fraction. Draft experiments can change this value. After start only warehouse experiments without a Datadog flag can change a STATIC fraction through the public API.
mode [required]Whether exposure uses a fixed fraction or a sequence of steps.
STATIC, STEPSstepsConfigured exposure plan rather than wall-clock history. At least two steps must have strictly increasing fractions and no gaps. Warehouse steps start at assignments_start_date and can use different durations. New Datadog plans have at most five steps and a first fraction above zero. Their nonfinal durations must be equal and exclude time paused. Datadog steps start with the experiment. Running warehouse experiments can replace step fractions, durations, and the exposure mode. After start, Datadog exposure plans cannot change through the public API. The final duration is null and its fraction holds until assignment ends.
duration_ms [required]Positive step duration in milliseconds. Datadog durations exclude pauses. Send null for the final step.
fraction [required]Fraction of traffic exposed during this step.
variantsVariants selected for the experiment and their traffic allocations.
feature_flag_variant_idStable backing flag variant ID. Required for Datadog-backed experiments and omitted for Warehouse-only experiments.
is_activeWhether this variant participates in the experiment. Responses always include this field. On writes an included variant defaults to active; omit its row to remove or unselect it. Explicit false supports sending an unchanged response back.
is_control [required]Whether this is the single control variant.
key [required]Assignment value. Datadog flag variant keys are server-owned.
nameDisplay name. Datadog flag variant names are server-owned.
weight [required]Traffic allocation percentage. Existing variant weights cannot change through the public API after the experiment starts.
warehouse_exposure_configurationWarehouse model and experiment key used to read assignment data.
entry_point [required]Optional Warehouse measure that scopes analyzed subjects.
filters [required]Complete ordered Warehouse entry-point filter set.
operation [required]Comparison applied by the warehouse entry-point filter.
IS, IS_NOTproperty_id [required]Warehouse property UUID.
values [required]Ordered values used by the filter.
measure_id [required]Warehouse measure UUID.
experiment_key [required]Warehouse experiment key. Must not be blank.
exposure_sql_model_id [required]ID of the exposure SQL model that provides assignment data.
idOptional JSON:API resource identifier field.
type [required]Experiments resource type.
experimentsexperiments{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}Response
Created
Response containing an experiment and its configuration.
data [required]Experiment resource with its identifier and configuration.
attributesDetails of the experiment.
assignments_end_dateEnd of the time window for experiment assignments.
assignments_start_dateStart of the time window for experiment assignments.
concluded_atTime when the experiment was concluded.
conclusionOutcome and supporting text recorded when the experiment is concluded.
decision_reasonReason for the recorded decision.
outcomeRecorded experiment outcome.
POSITIVE, NEGATIVE, NEUTRAL, INCONCLUSIVE, MISCONFIGURED, UNKNOWNsummarySummary of the experiment conclusion.
created_atTime when this resource was created.
datadog_flag_configurationFeature flag, environment, and targeting configuration for the experiment.
allocation_keyKey of the feature flag allocation linked to the experiment.
entry_point [required]Datadog measure and filters used to select analyzed subjects.
filters [required]Complete Datadog OR-of-ANDs entry-point filter expression.
measure_id [required]Datadog measure UUID.
environment_idID of the feature flag environment used by the experiment.
feature_flag_idID of the feature flag linked to the experiment.
targeting_rulesRules that select subjects for the experiment.
conditions [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.
Object 1A condition that uses a saved filter. Inline fields must be omitted or null.
saved_filter_id [required]Saved-filter UUID.
Object 2An inline condition. The saved_filter_id field must be omitted or null.
attribute [required]Attribute to evaluate.
operator [required]Required with attribute and value for an inline condition; omit when saved_filter_id is set.
LT, LTE, GT, GTE, MATCHES, NOT_MATCHES, ONE_OF, NOT_ONE_OF, IS_NULL, EQUALSShow 6 more
SEMVER_EQ, SEMVER_NEQ, SEMVER_LT, SEMVER_LTE, SEMVER_GT, SEMVER_GTEvalue [required]Values used by the operator. Every operator requires at least one value.
decision_metricsMetrics used to decide the experiment outcome.
is_primary [required]Whether this is the experiment primary metric.
metric_id [required]Decision metric UUID.
decision_variant_keyKey of the variant selected in the experiment decision.
events_end_dateEnd of the time window for metric events.
events_start_dateStart of the time window for metric events.
experiment_typeKind of experiment. STANDARD is an ordinary experiment. Other values, such as CANARY and HOLDOUT, identify experiments owned by another workflow. New kinds may be added; treat unknown values as non-standard.
hypothesisExpected effect that the experiment is intended to test.
migration_metadataMetadata retained for resources imported from another system.
nameDisplay name of the experiment.
pipeline_table_suffixSuffix used to identify the experiment's pipeline output table.
protocol_idID of the protocol associated with the experiment.
related_linksLinks to supporting material for the experiment.
idLink ID. Omit it when adding a link.
titleOptional display title.
url [required]Absolute URL.
results_last_updatedTime of the most recent update to the experiment's results.
split_by_propertiesProperties used to split the experiment results into groups.
column_name [required]Exposure field or Warehouse column used for the analysis dimension.
column_type [required]Type of the Datadog exposure field or Warehouse column.
varchar, int, double, boolean, varchar_array, int_array, double_array, raw, STRING, INTEGERShow 4 more
FLOAT, BOOLEAN, DATE, TIMESTAMPid [required]Read-only property ID. Omit it from POST and PATCH; writes identify properties by column_name.
name [required]Display name for the analysis dimension.
statusCurrent stage in the experiment lifecycle.
DRAFT, SCHEDULED, IN_PROGRESS, READY_FOR_DECISION, DECISION_MADE, CANCELLED, UNKNOWNstructured_metadataValues of structured metadata fields attached to the experiment.
enum_valuesSelected values for an enumerated metadata field.
field_display_nameDisplay name of the metadata field.
field_key [required]Key that identifies the metadata field.
field_typeType of value stored in the structured metadata field.
FREETEXT, ENUMfreetext_valueText value for a free-text metadata field.
subject_type_idID of the subject type used by this configuration.
summarySummary text recorded for the experiment.
tagsTags attached to the experiment.
teamsTeams associated with the experiment.
traffic_exposureTraffic exposure fraction or schedule configured for the experiment.
fractionSTATIC exposure fraction. Draft experiments can change this value. After start only warehouse experiments without a Datadog flag can change a STATIC fraction through the public API.
mode [required]Whether exposure uses a fixed fraction or a sequence of steps.
STATIC, STEPSstepsConfigured exposure plan rather than wall-clock history. At least two steps must have strictly increasing fractions and no gaps. Warehouse steps start at assignments_start_date and can use different durations. New Datadog plans have at most five steps and a first fraction above zero. Their nonfinal durations must be equal and exclude time paused. Datadog steps start with the experiment. Running warehouse experiments can replace step fractions, durations, and the exposure mode. After start, Datadog exposure plans cannot change through the public API. The final duration is null and its fraction holds until assignment ends.
duration_ms [required]Positive step duration in milliseconds. Datadog durations exclude pauses. Send null for the final step.
fraction [required]Fraction of traffic exposed during this step.
updated_atTime when this resource was last updated.
variantsVariants configured for the experiment.
feature_flag_variant_idBacking feature flag variant ID. Present for Datadog feature flag experiments and omitted for Warehouse experiments.
is_active [required]Whether this variant participates in the experiment.
is_control [required]Whether this is the single control variant.
key [required]Value recorded in exposure data for this variant.
nameDisplay name of the experiment variant.
weight [required]Traffic allocation percentage.
warehouse_exposure_configurationWarehouse exposure model and settings used to identify experiment assignments.
entry_point [required]Optional Warehouse measure that scopes analyzed subjects.
filters [required]Complete ordered Warehouse entry-point filter set.
operation [required]Comparison applied by the warehouse entry-point filter.
IS, IS_NOTproperty_id [required]Warehouse property UUID.
values [required]Ordered values used by the filter.
measure_id [required]Warehouse measure UUID.
experiment_key [required]Warehouse experiment key. Reads can return null for incomplete configuration; configuration writes require a value.
exposure_sql_model_id [required]ID of the exposure SQL model that provides assignment data.
id [required]Identifier of the experiment.
type [required]Experiments resource type.
experimentsexperiments{
"data": {
"attributes": {
"assignments_end_date": "2026-08-15T00:00:00Z",
"assignments_start_date": "2026-08-01T00:00:00Z",
"concluded_at": "2026-08-05T09:30:00Z",
"conclusion": {
"decision_reason": "The primary metric improved without material regressions",
"outcome": "POSITIVE",
"summary": "The treatment improved conversion"
},
"created_at": "2026-08-01T12:00:00Z",
"datadog_flag_configuration": null,
"decision_metrics": [
{
"is_primary": true,
"metric_id": "b1a2c3d4-0000-0000-0000-000000000000"
}
],
"decision_variant_key": "treatment",
"events_end_date": "2026-08-22T00:00:00Z",
"events_start_date": "2026-08-01T00:00:00Z",
"experiment_type": "STANDARD",
"hypothesis": "A clearer checkout button increases purchase conversion",
"name": "Checkout button test",
"pipeline_table_suffix": "a1b2c3d4",
"protocol_id": "e4d5f6a7-0000-0000-0000-000000000000",
"related_links": [
{
"id": "d1d2d3d4-0000-0000-0000-000000000000",
"title": "Experiment design",
"url": "https://docs.example.com/checkout-experiment"
}
],
"results_last_updated": "2026-08-05T09:25:00Z",
"split_by_properties": [],
"status": "DECISION_MADE",
"structured_metadata": [
{
"enum_values": [
"beta"
],
"field_display_name": "Launch stage",
"field_key": "launch_stage",
"field_type": "ENUM"
},
{
"field_display_name": "Notes",
"field_key": "notes",
"field_type": "FREETEXT",
"freetext_value": "Checkout redesign"
}
],
"subject_type_id": "c2b3d4e5-0000-0000-0000-000000000000",
"summary": "The treatment improved conversion",
"tags": [
"growth"
],
"teams": [
"growth"
],
"traffic_exposure": {
"fraction": 1,
"mode": "STATIC"
},
"updated_at": "2026-08-05T09:30:00Z",
"variants": [
{
"is_active": true,
"is_control": true,
"key": "control",
"name": "Control",
"weight": 50
},
{
"is_active": true,
"is_control": false,
"key": "treatment",
"name": "Treatment",
"weight": 50
}
],
"warehouse_exposure_configuration": {
"entry_point": null,
"experiment_key": "checkout_button_test",
"exposure_sql_model_id": "f5e6a7b8-0000-0000-0000-000000000000"
}
},
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "experiments"
}
}Invalid request body: missing required field, malformed variants or decision_metrics, or an unresolvable analysis configuration.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Missing or invalid authentication (dd-api-key + dd-application-key headers, or a valid user session).
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Authenticated caller lacks the product_analytics_experiments_write permission.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}The supplied protocol_id does not identify a protocol in this organization.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}The requested configuration is incompatible with the experiment (code: unsupported_configuration).
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Request body sent with a media type other than application/json or application/vnd.api+json.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}The supplied protocol is a draft or archived protocol and cannot be applied to a new experiment.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Code Example
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X POST "https://api.${DD_SITE}/api/v2/experiments" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"type": "experiments",
"attributes": {
"name": "ex-14bb9543f523edde"
}
}
}
EOF// Create experiment returns "Created" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.ExperimentsCreateExperimentV2Request{
Data: datadogV2.ExperimentsCreateExperimentV2RequestData{
Type: datadogV2.EXPERIMENTSPATCHEXPERIMENTV2RESPONSEDATATYPE_EXPERIMENTS,
Attributes: datadogV2.ExperimentsCreateExperimentV2RequestDataAttributes{
Name: "ex-14bb9543f523edde",
},
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewExperimentsApi(apiClient)
resp, r, err := api.CreateExperiment(ctx, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.CreateExperiment`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.CreateExperiment`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// Create experiment returns "Created" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ExperimentsApi;
import com.datadog.api.client.v2.model.ExperimentsCreateExperimentV2Request;
import com.datadog.api.client.v2.model.ExperimentsCreateExperimentV2RequestData;
import com.datadog.api.client.v2.model.ExperimentsCreateExperimentV2RequestDataAttributes;
import com.datadog.api.client.v2.model.ExperimentsExperimentV2DTO;
import com.datadog.api.client.v2.model.ExperimentsPatchExperimentV2ResponseDataType;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
ExperimentsApi apiInstance = new ExperimentsApi(defaultClient);
ExperimentsCreateExperimentV2Request body =
new ExperimentsCreateExperimentV2Request()
.data(
new ExperimentsCreateExperimentV2RequestData()
.type(ExperimentsPatchExperimentV2ResponseDataType.EXPERIMENTS)
.attributes(
new ExperimentsCreateExperimentV2RequestDataAttributes()
.name("ex-14bb9543f523edde")));
try {
ExperimentsExperimentV2DTO result = apiInstance.createExperiment(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ExperimentsApi#createExperiment");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Create experiment returns "Created" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.experiments_api import ExperimentsApi
from datadog_api_client.v2.model.experiments_create_experiment_v2_request import ExperimentsCreateExperimentV2Request
from datadog_api_client.v2.model.experiments_create_experiment_v2_request_data import (
ExperimentsCreateExperimentV2RequestData,
)
from datadog_api_client.v2.model.experiments_create_experiment_v2_request_data_attributes import (
ExperimentsCreateExperimentV2RequestDataAttributes,
)
from datadog_api_client.v2.model.experiments_patch_experiment_v2_response_data_type import (
ExperimentsPatchExperimentV2ResponseDataType,
)
body = ExperimentsCreateExperimentV2Request(
data=ExperimentsCreateExperimentV2RequestData(
type=ExperimentsPatchExperimentV2ResponseDataType.EXPERIMENTS,
attributes=ExperimentsCreateExperimentV2RequestDataAttributes(
name="ex-14bb9543f523edde",
),
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = ExperimentsApi(api_client)
response = api_instance.create_experiment(body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Create experiment returns "Created" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::ExperimentsAPI.new
body = DatadogAPIClient::V2::ExperimentsCreateExperimentV2Request.new({
data: DatadogAPIClient::V2::ExperimentsCreateExperimentV2RequestData.new({
type: DatadogAPIClient::V2::ExperimentsPatchExperimentV2ResponseDataType::EXPERIMENTS,
attributes: DatadogAPIClient::V2::ExperimentsCreateExperimentV2RequestDataAttributes.new({
name: "ex-14bb9543f523edde",
}),
}),
})
p api_instance.create_experiment(body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Create experiment returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_experiments::ExperimentsAPI;
use datadog_api_client::datadogV2::model::ExperimentsCreateExperimentV2Request;
use datadog_api_client::datadogV2::model::ExperimentsCreateExperimentV2RequestData;
use datadog_api_client::datadogV2::model::ExperimentsCreateExperimentV2RequestDataAttributes;
use datadog_api_client::datadogV2::model::ExperimentsPatchExperimentV2ResponseDataType;
#[tokio::main]
async fn main() {
let body =
ExperimentsCreateExperimentV2Request::new(ExperimentsCreateExperimentV2RequestData::new(
ExperimentsCreateExperimentV2RequestDataAttributes::new(
"ex-14bb9543f523edde".to_string(),
),
ExperimentsPatchExperimentV2ResponseDataType::EXPERIMENTS,
));
let configuration = datadog::Configuration::new();
let api = ExperimentsAPI::with_config(configuration);
let resp = api.create_experiment(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run