> This page is for Gateway.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Trigger run

POST https://api-gateway.merge.dev/v1/evals/suites/{suite_id}/runs
Content-Type: application/json

Trigger a run of the suite (single-call).

201 with the created run; execution is asynchronous — poll
`GET /v1/evals/runs/{id}` until a terminal status, then branch on
`passed`. An `idempotency_key` that already exists for the suite
returns the original run with 200 instead of creating a duplicate. 409
`run_in_flight` once the suite's concurrent-run cap is reached.

Reference: https://docs.merge.dev/merge-gateway/evals-api/runs/trigger-run

## Authentication

- `Authorization` header (bearer token, required) — Your gateway API key (mg_ prefix), the same key used for /v1/responses

## Request

### Path parameters

- `suite_id` (string, required)

### Body (application/json)

This endpoint expects a RunTriggerV1In.

- `target_model` (string, required)
- `trials` (integer, optional, default: 1)
- `mode` (enum, optional, default: gateway)
  - Allowed values: `gateway`, `external`
- `outputs` (list of ExternalOutputIn, optional, nullable)
- `metadata` (map from string to string, optional, nullable)
- `idempotency_key` (string, optional, nullable)
- `request_overrides` (RequestOverridesIn, optional, nullable) — Run-level request configuration applied to every case. ``system`` is prepended as the first message of each case (the mechanism behind "eval prompt v14 against the same dataset"); ``params`` win over per-case request_params and pass the same allowlist.

## Response

### 201

Successful Response

- `id` (string, required)
- `suite_id` (string, required)
- `target_model` (string, required)
- `status` (string, required)
- `trigger_source` (string, required)
- `suite_config_snapshot` (map from string to any, required)
- `pass_count` (integer, required)
- `fail_count` (integer, required)
- `error_count` (integer, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `execution_mode` (string, optional, default: gateway)
- `metadata` (map from string to any, optional, nullable)
- `migration_id` (string, optional, nullable)
- `triggered_by` (string, optional, nullable)
- `passed` (boolean, optional, nullable)
- `total_cost_usd` (double, optional, nullable)
- `judge_cost_usd` (double, optional, nullable)
- `estimated_cost_usd` (double, optional, nullable)
- `trace_id` (string, optional, nullable)
- `error` (string, optional, nullable)
- `trials` (integer, optional, default: 1)
- `started_at` (datetime, optional, nullable)
- `completed_at` (datetime, optional, nullable)
- `total_cases` (integer, optional, default: 0)
- `completed_cases` (integer, optional, default: 0)
- `pass_rate` (double, optional, nullable)
- `ci_low` (double, optional, nullable)
- `ci_high` (double, optional, nullable)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ExternalOutputIn

One caller-produced output for grading (external runs).

- `external_id` (string, optional, nullable)
- `name` (string, optional, nullable)
- `output_text` (string, optional, nullable)
- `tool_calls` (list of map from string to any, optional, nullable)

### RequestOverridesIn

Run-level request configuration applied to every case. ``system`` is prepended as the first message of each case (the mechanism behind "eval prompt v14 against the same dataset"); ``params`` win over per-case request_params and pass the same allowlist.

- `system` (string, optional, nullable)
- `params` (map from string to any, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

- string
- integer

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "target_model": "string"
}
```

**Response**

```json
{
  "id": "string",
  "suite_id": "string",
  "target_model": "string",
  "status": "string",
  "trigger_source": "string",
  "suite_config_snapshot": {},
  "pass_count": 1,
  "fail_count": 1,
  "error_count": 1,
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "execution_mode": "gateway",
  "metadata": {},
  "migration_id": "string",
  "triggered_by": "string",
  "passed": true,
  "total_cost_usd": 1.1,
  "judge_cost_usd": 1.1,
  "estimated_cost_usd": 1.1,
  "trace_id": "string",
  "error": "string",
  "trials": 1,
  "started_at": "2024-01-15T09:30:00Z",
  "completed_at": "2024-01-15T09:30:00Z",
  "total_cases": 0,
  "completed_cases": 0,
  "pass_rate": 1.1,
  "ci_low": 1.1,
  "ci_high": 1.1
}
```

**SDK Code**

```python
import requests

url = "https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs"

payload = { "target_model": "string" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"target_model":"string"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs"

	payload := strings.NewReader("{\n  \"target_model\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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("https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"target_model\": \"string\"\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"target_model\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs', [
  'body' => '{
  "target_model": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"target_model\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["target_model": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-gateway.merge.dev/v1/evals/suites/suite_id/runs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```