# Get experiment

- Operation ID: `FindExperimentV2`
- HTTP method: `GET`
- Path: `/optimizer/v2/experiments/{id}`
- [Human-readable API reference](https://hub.synerise.com/api-reference/ai-suite#tag/Experiments/operation/FindExperimentV2)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /optimizer/v2/experiments/{id}:
    get:
      summary: Get experiment
      description: |
        Retrieve the details of an experiment.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=profileLogin" target="_blank" rel="noopener">Workspace (Business Profile)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **API key permission required:** `OPTIMIZER_MANAGER_TESTOPTIMIZER_READ`

        **User role permission required:** `campaigns_test_optimizer: read`
      operationId: FindExperimentV2
      tags:
        - Experiments
      security:
        - JWT: []
      parameters:
        - in: path
          required: true
          name: id
          description: ID of the experiment
          schema:
            type: integer
      responses:
        "200":
          description: Extended experiment returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  experimentId:
                    type: integer
                    description: ID of the experiment
                  name:
                    type: string
                    description: Experiment name
                  author:
                    type: integer
                    description: Author of the experiment
                  description:
                    type: string
                    description: Experiment description
                  experimentKind:
                    type: string
                    description: The type of the experiment
                    enum:
                      - ITEMS_SEARCH
                      - RECOMMENDATION_CAMPAIGN
                  variantsAllocationMethod:
                    type: string
                    enum:
                      - Manual
                    description: The variant allocation method. Currently, only `Manual` is available.
                  status:
                    type: string
                    enum:
                      - NotStarted
                      - Running
                      - Paused
                      - Finished
                    description: Current status of the experiment. A finished experiment cannot be started again.
                  startedAt:
                    type: string
                    format: date-time
                    description: Time when the experiment was started
                  stoppedAt:
                    type: string
                    format: date-time
                    description: Time when the experiment was stopped
                  createdAt:
                    type: string
                    format: date-time
                    description: Creation time
                  updatedAt:
                    type: string
                    format: date-time
                    description: Last update time
                  variants:
                    type: array
                    description: An array of variants
                    items:
                      type: object
                      properties:
                        variantId:
                          type: integer
                          description: ID of the variant
                        externalId:
                          type: string
                          description: |
                            Identifier of the resource to request with this variant.

                            - For recommendations, this is the recommendation campaign ID.
                            - For items/suggestion search, this is the search/suggestion index ID.
                        name:
                          type: string
                          description: Variant name
                        weight:
                          type: integer
                          maximum: 10000
                          description: |
                            Importance of the variant. Higher value means higher importance.  
                            The total weight of all variants must be <= 10000.
                        metadata:
                          type: string
                          description: Additional data
                        isBaseline:
                          type: boolean
                          description: "`true` if this is the baseline variant. When making a search/recommendation request, you will use the ID of the baseline index/recommendation and then the system will return a result from one of the variants."
                      required:
                        - variantId
                        - externalId
                        - weight
                required:
                  - experimentId
                  - name
                  - experimentKind
                  - variantsAllocationMethod
                  - status
                  - createdAt
                  - variants
                  - goals
        "404":
          description: Experiment not found. Check error message for more details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Description of the error
                  errorCode:
                    type: string
                    description: Synerise error code. See [Error Code Reference](https://developers.synerise.com/errors.html).
                  help:
                    type: string
                    description: Link to the error reference page for this error
                  httpStatus:
                    type: integer
                    description: HTTP code of the error
                  message:
                    type: string
                    description: Description of the error
                  path:
                    type: string
                    description: Path of the resource which returned the error
                  requestId:
                    type: string
                    description: Unique request ID
                  status:
                    type: integer
                    description: Internal code for troubleshooting
                  timestamp:
                    type: string
                    format: date-time
                    description: Time when the error occurred
                  traceId:
                    type: string
                    description: Trace ID for troubleshooting
      x-snr-doc-urls:
        - /api-reference/ai-suite#tag/Experiments/operation/FindExperimentV2
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request GET \
              --url https://api.synerise.com/optimizer/v2/experiments/%7Bid%7D \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            headers = { 'Authorization': "Bearer REPLACE_BEARER_TOKEN" }

            conn.request("GET", "/optimizer/v2/experiments/%7Bid%7D", headers=headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = null;

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("GET", "https://api.synerise.com/optimizer/v2/experiments/%7Bid%7D");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "GET",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/optimizer/v2/experiments/%7Bid%7D",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/optimizer/v2/experiments/%7Bid%7D');
            $request->setMethod(HTTP_METH_GET);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN'
            ]);

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.get("https://api.synerise.com/optimizer/v2/experiments/%7Bid%7D")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Experiments
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
