> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Map suite variables onto an app

POST https://apps.sarvam.ai/api/evals/v1/{org_id}/{workspace_id}/test-suites/{test_suite_id}/mappings
Content-Type: application/json

Binds the suite's variables to an app version's variables so a run can supply them.

Reference: https://docs.sarvam.ai/conversations/api/tests/mappings/create

## Request

### Path parameters

- `org_id` (string, required) — Organization ID
- `workspace_id` (string, required) — Workspace ID
- `test_suite_id` (string, required)

### Headers

- `X-API-Key` (string, required) — Your workspace API key.

### Body (application/json)

This endpoint expects an object.

- `app_id` (string, required)
- `app_version` (integer, required)
- `variable_mapping` (map from string to string, required) — Agent variable name -> suite variable name.

## Response

### 201

Successful Response

- `map_id` (string, required)

## Errors

### 401 Unauthorized Error

No Bearer token or X-API-Key was supplied, or it is invalid.

- `error` (object, required) — Details of the error that occurred.
  - `code` (string, required) — A service-specific error code.
  - `message` (string, required) — A human-readable description of the error.

### 403 Forbidden Error

The credential is not valid for this org or workspace.

- `error` (object, required) — Details of the error that occurred.
  - `code` (string, required) — A service-specific error code.
  - `message` (string, required) — A human-readable description of the error.

### 404 Not Found Error

No such resource in this org and workspace.

- `error` (object, required) — Details of the error that occurred.
  - `code` (string, required) — A service-specific error code.
  - `message` (string, required) — A human-readable description of the error.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of object, optional)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)

### 429 Too Many Requests Error

Rate limit exceeded for this caller.

- `error` (object, required) — Details of the error that occurred.
  - `code` (string, required) — A service-specific error code.
  - `message` (string, required) — A human-readable description of the error.

## Examples

**Request**

```json
{
  "app_id": "clinic-front-desk",
  "app_version": 4,
  "variable_mapping": {
    "business_name": "clinic_name",
    "customer_name": "patient_name"
  }
}
```

**Response**

```json
{
  "map_id": "01K5TA1FQ6WS8ZC3VY2JEN9RDK"
}
```

**SDK Code**

```python
import requests

url = "https://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings"

payload = {
    "app_id": "clinic-front-desk",
    "app_version": 4,
    "variable_mapping": {
        "business_name": "clinic_name",
        "customer_name": "patient_name"
    }
}
headers = {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<your-api-key>', 'Content-Type': 'application/json'},
  body: '{"app_id":"clinic-front-desk","app_version":4,"variable_mapping":{"business_name":"clinic_name","customer_name":"patient_name"}}'
};

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://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings"

	payload := strings.NewReader("{\n  \"app_id\": \"clinic-front-desk\",\n  \"app_version\": 4,\n  \"variable_mapping\": {\n    \"business_name\": \"clinic_name\",\n    \"customer_name\": \"patient_name\"\n  }\n}")

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

	req.Header.Add("X-API-Key", "<your-api-key>")
	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://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<your-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"app_id\": \"clinic-front-desk\",\n  \"app_version\": 4,\n  \"variable_mapping\": {\n    \"business_name\": \"clinic_name\",\n    \"customer_name\": \"patient_name\"\n  }\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://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings")
  .header("X-API-Key", "<your-api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"app_id\": \"clinic-front-desk\",\n  \"app_version\": 4,\n  \"variable_mapping\": {\n    \"business_name\": \"clinic_name\",\n    \"customer_name\": \"patient_name\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings', [
  'body' => '{
  "app_id": "clinic-front-desk",
  "app_version": 4,
  "variable_mapping": {
    "business_name": "clinic_name",
    "customer_name": "patient_name"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<your-api-key>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<your-api-key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"app_id\": \"clinic-front-desk\",\n  \"app_version\": 4,\n  \"variable_mapping\": {\n    \"business_name\": \"clinic_name\",\n    \"customer_name\": \"patient_name\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<your-api-key>",
  "Content-Type": "application/json"
]
let parameters = [
  "app_id": "clinic-front-desk",
  "app_version": 4,
  "variable_mapping": [
    "business_name": "clinic_name",
    "customer_name": "patient_name"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://apps.sarvam.ai/api/evals/v1/org_id/workspace_id/test-suites/test_suite_id/mappings")! 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()
```