> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erdo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateExperimentAPI mirrors erdo_create_experiment.




## OpenAPI

````yaml /api/openapi.json post /v1/experiments
openapi: 3.0.0
info:
  title: Erdo API
  description: >-
    Erdo's REST API: query and write datasets, run agents, manage threads,
    integrations, pages, evals, workstreams, and experiments. Authenticate with
    a Bearer API key (erdo_api_...) or scoped token (erdo_token_...).
  version: '2026-07-25'
servers:
  - url: https://api.erdo.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/experiments:
    post:
      summary: |
        CreateExperimentAPI mirrors erdo_create_experiment.
      operationId: POST:mcp.CreateExperimentAPI
      requestBody:
        content:
          application/json:
            schema:
              properties:
                decision_rule_markdown:
                  type: string
                evidence_datasets:
                  items:
                    $ref: '#/components/schemas/mcp.ExperimentEvidenceDatasetInput'
                  type: array
                guardrail_metrics:
                  items:
                    type: string
                  type: array
                hypothesis_markdown:
                  type: string
                primary_metric:
                  type: string
                project_slug:
                  type: string
                scope:
                  type: string
                slug:
                  type: string
                title:
                  type: string
                variants:
                  items:
                    $ref: '#/components/schemas/mcp.ExperimentVariantInput'
                  type: array
                workstream_slug:
                  type: string
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  evidence_datasets:
                    items:
                      $ref: '#/components/schemas/types.ExperimentEvidenceDataset'
                    type: array
                  experiment_run:
                    $ref: '#/components/schemas/types.ExperimentRun'
                  policy_state:
                    $ref: '#/components/schemas/types.ExperimentPolicyState'
                  variants:
                    items:
                      $ref: '#/components/schemas/types.ExperimentVariant'
                    type: array
                type: object
          description: Success response
        default:
          $ref: '#/components/responses/APIError'
components:
  schemas:
    mcp.ExperimentEvidenceDatasetInput:
      properties:
        dataset_slug:
          type: string
        role:
          type: string
      type: object
    mcp.ExperimentVariantInput:
      properties:
        allocation_percent:
          format: int32
          maximum: 2147483647
          minimum: -2147483648
          type: integer
        is_control:
          type: boolean
        key:
          type: string
        label:
          type: string
        treatment_class:
          type: string
        treatment_resource_id:
          type: string
        treatment_resource_type:
          type: string
        treatment_url:
          type: string
      type: object
    types.ExperimentEvidenceDataset:
      properties:
        created_at:
          format: date-time
          type: string
        dataset_id:
          format: uuid
          type: string
        dataset_slug:
          type: string
        experiment_run_id:
          format: uuid
          type: string
        id:
          format: uuid
          type: string
        role:
          type: string
      title: |
        ExperimentEvidenceDataset binds an experiment to a measurement dataset.
      type: object
    types.ExperimentRun:
      description: |
        Sibling to Workstream, can be hosted by a workstream or standalone.
      properties:
        created_at:
          format: date-time
          type: string
        decided_at:
          format: date-time
          type: string
        decision:
          type: string
        decision_rule_markdown:
          type: string
        guardrail_metrics:
          items:
            type: string
          type: array
        hypothesis_markdown:
          type: string
        id:
          format: uuid
          type: string
        organization_id:
          format: uuid
          type: string
        outcome_markdown:
          type: string
        primary_metric:
          type: string
        primary_thread_id:
          format: uuid
          type: string
        project_id:
          format: uuid
          type: string
        scope:
          type: string
        slug:
          type: string
        started_at:
          format: date-time
          type: string
        status:
          type: string
        title:
          type: string
        updated_at:
          format: date-time
          type: string
        workstream_id:
          format: uuid
          type: string
      title: |
        ExperimentRun is a structured test with hypothesis, variants, decision.
      type: object
    types.ExperimentPolicyState:
      description: >
        experiment: what it believes about each variant, how it split the
        traffic, and where each variant sits against the stop thresholds. It is
        READ from the last allocation\_step (action\_taken) and posterior\_stop
        (decision\_check) observations the policy wrote — never recomputed on
        read.
      properties:
        calibration_pairs:
          format: int64
          title: >
            CalibrationPairs / CalibrationZTestPassed report the gate state at
            step time.
          type: integer
        calibration_z_test_passed:
          type: boolean
        decision_reason:
          type: string
        effects:
          items:
            $ref: '#/components/schemas/types.ExperimentPolicyEffect'
          type: array
        large_step:
          type: boolean
        primary_metric:
          type: string
        prior_pseudo_sessions:
          description: |
            prediction carried into the priors (0 when the gate was closed).
          title: |
            PriorPseudoSessions is n₀ — the calibration-gated weight the panel
          type: number
        recommended_decision:
          description: >
            stop | inconclusive. RecommendedVariant names the variant to ship,
            if any.
          title: >
            RecommendedDecision is the stopping evaluator's call: continue |
            ship |
          type: string
        recommended_variant:
          type: string
        stepped_at:
          description: |
            observed\_at). Zero when only a stop reading exists.
          format: date-time
          title: >
            SteppedAt is when the policy last ran (the allocation_step
            observation's
          type: string
        total_movement:
          description: |
            LargeStep flags a step past the attention threshold.
          format: int64
          title: >
            TotalMovement is the sum of absolute allocation changes the last
            step made;
          type: integer
        variants:
          items:
            $ref: '#/components/schemas/types.ExperimentPolicyVariant'
          type: array
      title: >
        ExperimentPolicyState is the decision policy's most recent reading for
        an
      type: object
    types.ExperimentVariant:
      properties:
        allocation_percent:
          format: int32
          maximum: 2147483647
          minimum: -2147483648
          type: integer
        created_at:
          format: date-time
          type: string
        experiment_run_id:
          format: uuid
          type: string
        id:
          format: uuid
          type: string
        is_control:
          type: boolean
        key:
          type: string
        label:
          type: string
        treatment_class:
          description: >
            (TreatmentClassTaxonomy) — DECLARED by the producing agent, never
            derived from content. It is the privacy boundary the cross-customer
            prior distiller aggregates on. Nil for the control and for
            treatments that carry no class.
          title: >
            TreatmentClass is the variant's structural class from the fixed
            taxonomy
          type: string
        treatment_resource_id:
          format: uuid
          type: string
        treatment_resource_type:
          type: string
        treatment_url:
          description: >
            page resource — the wind-tunnel persona panel can visit either. Set
            for variants whose page is not an Erdo artifact (an agency's client
            landing page); mutually exclusive with TreatmentResourceType/ID.
            Public http(s) URLs only, never a signed-in Erdo workspace URL.
          title: >
            TreatmentURL is an external page URL this variant tests INSTEAD OF
            an Erdo
          type: string
      title: |
        ExperimentVariant is one variant in an experiment.
      type: object
    types.ExperimentPolicyEffect:
      description: |
        control — reported, never gating. Both estimates carry a 95% CI.
      properties:
        augmented_ci_high:
          type: number
        augmented_ci_low:
          type: number
        augmented_effect:
          type: number
        naive_ci_high:
          type: number
        naive_ci_low:
          type: number
        naive_effect:
          type: number
        variant_key:
          type: string
      title: >
        ExperimentPolicyEffect is the HAIPW readout for one treatment variant vs
        the
      type: object
    types.ExperimentPolicyVariant:
      properties:
        allocation:
          format: int64
          type: integer
        expected_loss:
          type: number
        guardrail_veto:
          type: boolean
        is_control:
          type: boolean
        key:
          type: string
        kill_eligible:
          type: boolean
        posterior_alpha:
          type: number
        posterior_beta:
          type: number
        posterior_mean_rate:
          type: number
        predicted_rate:
          type: number
        prob_beat_control:
          title: >
            ProbBeatControl / ExpectedLoss are the stopping stats (0 for the
            control).
          type: number
        ship_eligible:
          type: boolean
        stopped:
          type: boolean
        successes:
          type: number
        trials:
          type: number
        win_frequency:
          type: number
      title: >
        ExperimentPolicyVariant is one variant's belief + allocation + stop
        stats.
      type: object
  responses:
    APIError:
      content:
        application/json:
          schema:
            externalDocs:
              url: https://pkg.go.dev/encore.dev/beta/errs#Error
            properties:
              code:
                description: Error code
                example: not_found
                externalDocs:
                  url: https://pkg.go.dev/encore.dev/beta/errs#ErrCode
                type: string
              details:
                description: Error details
                type: object
              message:
                description: Error message
                type: string
            title: APIError
            type: object
      description: Error response
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An Erdo API key (erdo_api_...) or scoped token (erdo_token_...).

````