Skip to content

Create a new experiment in a space. Storyblok creates new experiments in draft status. Optionally, include variants and associate stories with the experiment in the same request.

POST
https://mapi.storyblok.com/v1/spaces/:space_id/experiments
  • :space_id required number

    Numeric ID of a space.

  • experiment required object

    The experiment to create.

    Show child properties
    • name required string

      Technical name of the experiment. Lowercase letters, numbers, and underscores only. Immutable after creation.

    • display_name required string

      Human-readable display name of the experiment.

    • description string

      Description of the experiment.

    • story_ids number[]

      Array of story IDs to associate with the experiment.

    • experiment_variants_attributes object[]

      Array of variants to create with the experiment. The sum of all variant weights must equal 100.

      Show child properties
      • name required string

        Technical name of the variant. Lowercase letters, numbers, and underscores only.

      • display_name required string

        Human-readable display name of the variant.

      • weight number

        Traffic weight of the variant in percent (0–100).

      • is_control boolean

        true if the variant is the control (baseline). One variant per experiment must be the control.

curl "https://mapi.storyblok.com/v1/spaces/288868932106293/experiments/" \
-X POST \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"experiment\":{\"description\":\"A short description for a simple test\",\"display_name\":\"A simple test\",\"experiment_variants_attributes\":[{\"display_name\":\"Control\",\"is_control\":true,\"name\":\"control\",\"weight\":60},{\"display_name\":\"Test\",\"is_control\":false,\"name\":\"test\",\"weight\":40}],\"name\":\"a_simple_test\",\"story_ids\":[176024833123843]}}"

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window) . Terms of Service (opens in a new window) apply.