# Find optimizations

GET http://localhost:5173/api/v1/private/optimizations

Find optimizations

Reference: https://www.comet.com/docs/opik/reference/rest-api/optimizations/find-optimizations

## OpenAPI Specification

```yaml
openapi: 3.1.1
info:
  title: Find optimizations
  version: endpoint_optimizations.findOptimizations
paths:
  /v1/private/optimizations:
    get:
      operationId: find-optimizations
      summary: Find optimizations
      description: Find optimizations
      tags:
        - - subpackage_optimizations
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
        - name: size
          in: query
          required: false
          schema:
            type: integer
            default: 10
        - name: dataset_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: query
          required: false
          schema:
            type: string
        - name: dataset_deleted
          in: query
          required: false
          schema:
            type: boolean
        - name: filters
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Optimizations resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptimizationPage_Public'
        '400':
          description: Bad Request
          content: {}
components:
  schemas:
    OptimizationPublicStatus:
      type: string
      enum:
        - value: running
        - value: completed
        - value: cancelled
        - value: initialized
        - value: error
    JsonListStringPublicOneOf1Items:
      type: object
      properties: {}
    JsonListStringPublic1:
      type: array
      items:
        $ref: '#/components/schemas/JsonListStringPublicOneOf1Items'
    JsonListString_Public:
      oneOf:
        - type: object
          additionalProperties:
            description: Any type
        - $ref: '#/components/schemas/JsonListStringPublic1'
        - type: string
    StudioMessage_Public:
      type: object
      properties:
        role:
          type: string
        content:
          type: string
      required:
        - role
        - content
    StudioPrompt_Public:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/StudioMessage_Public'
      required:
        - messages
    JsonNode_Public:
      type: object
      properties: {}
    StudioLlmModel_Public:
      type: object
      properties:
        model:
          type: string
        parameters:
          $ref: '#/components/schemas/JsonNode_Public'
      required:
        - model
    StudioMetric_Public:
      type: object
      properties:
        type:
          type: string
        parameters:
          $ref: '#/components/schemas/JsonNode_Public'
      required:
        - type
    StudioEvaluation_Public:
      type: object
      properties:
        metrics:
          type: array
          items:
            $ref: '#/components/schemas/StudioMetric_Public'
      required:
        - metrics
    StudioOptimizer_Public:
      type: object
      properties:
        type:
          type: string
        parameters:
          $ref: '#/components/schemas/JsonNode_Public'
      required:
        - type
    OptimizationStudioConfig_Public:
      type: object
      properties:
        dataset_name:
          type: string
        prompt:
          $ref: '#/components/schemas/StudioPrompt_Public'
        llm_model:
          $ref: '#/components/schemas/StudioLlmModel_Public'
        evaluation:
          $ref: '#/components/schemas/StudioEvaluation_Public'
        optimizer:
          $ref: '#/components/schemas/StudioOptimizer_Public'
      required:
        - dataset_name
        - prompt
        - llm_model
        - evaluation
        - optimizer
    FeedbackScoreAverage_Public:
      type: object
      properties:
        name:
          type: string
        value:
          type: number
          format: double
      required:
        - name
        - value
    Optimization_Public:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        dataset_name:
          type: string
        objective_name:
          type: string
        status:
          $ref: '#/components/schemas/OptimizationPublicStatus'
        metadata:
          $ref: '#/components/schemas/JsonListString_Public'
        studio_config:
          $ref: '#/components/schemas/OptimizationStudioConfig_Public'
        dataset_id:
          type: string
          format: uuid
        num_trials:
          type: integer
          format: int64
        feedback_scores:
          type: array
          items:
            $ref: '#/components/schemas/FeedbackScoreAverage_Public'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        last_updated_at:
          type: string
          format: date-time
        last_updated_by:
          type: string
      required:
        - dataset_name
        - objective_name
        - status
    OptimizationPage_Public:
      type: object
      properties:
        page:
          type: integer
        size:
          type: integer
        total:
          type: integer
          format: int64
        content:
          type: array
          items:
            $ref: '#/components/schemas/Optimization_Public'
        sortableBy:
          type: array
          items:
            type: string

```

## SDK Code Examples

```python
import requests

url = "http://localhost:5173/api/v1/private/optimizations"

response = requests.get(url)

print(response.json())
```

```javascript
const url = 'http://localhost:5173/api/v1/private/optimizations';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:5173/api/v1/private/optimizations"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:5173/api/v1/private/optimizations")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
```

```java
HttpResponse<String> response = Unirest.get("http://localhost:5173/api/v1/private/optimizations")
  .asString();
```

```php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:5173/api/v1/private/optimizations');

echo $response->getBody();
```

```csharp
var client = new RestClient("http://localhost:5173/api/v1/private/optimizations");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5173/api/v1/private/optimizations")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```