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

# Execute Multiple Comparisons

> Execute a batch of comparisons as part of an agent run.

<ParamField header="Authorization" type="string" required>
  Bearer token. Format: `Bearer <api-key>`
</ParamField>

<ParamField header="Workspace-Id" type="string" required>
  Your workspace UUID.
</ParamField>

<ParamField body="agent_run_id" type="string" required>
  UUID of the agent run this batch belongs to.
</ParamField>

<ParamField body="comparison_agent_configs" type="array" required>
  List of comparison configurations to execute.

  <Expandable title="comparison_agent_configs[]">
    <ParamField body="id" type="integer" required>
      Config ID used to map results back to the original configuration.
    </ParamField>

    <ParamField body="configuration" type="object" required>
      Full comparison configuration. See [Create Comparison](/api-reference/comparisons/create) for the `configuration` schema.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="message" type="string">Status message.</ResponseField>

<ResponseField name="mapped_run_ids" type="object">
  Map of config ID to job run ID. Use the run IDs to monitor progress via the Jobs API.
</ResponseField>

<RequestExample>
  ```curl cURL theme={null}
  curl -X POST "https://YOUR_BASE_URL/comparisons/execute_multiple" \
    -H "Authorization: Bearer <api-key>" \
    -H "Workspace-Id: <workspace-id>" \
    -H "Content-Type: application/json" \
    -d '{
      "agent_run_id": "aaaaaaaa-1111-2222-3333-444444444444",
      "comparison_agent_configs": [
        {
          "id": 1,
          "configuration": {
            "name": "orders comparison",
            "source_datasource_id": "aaaaaaaa-0000-0000-0000-000000000001",
            "target_datasource_id": "bbbbbbbb-0000-0000-0000-000000000002",
            "source_dataset_id": "cccccccc-0000-0000-0000-000000000003",
            "target_dataset_id": "dddddddd-0000-0000-0000-000000000004",
            "configuration": {
              "source_columns": ["order_id", "total"],
              "target_columns": ["order_id", "total"],
              "primary_keys_source": ["order_id"],
              "primary_keys_target": ["order_id"]
            }
          }
        }
      ]
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://YOUR_BASE_URL/comparisons/execute_multiple"
  headers = {
      "Authorization": "Bearer <api-key>",
      "Workspace-Id": "<workspace-id>",
  }
  payload = {
      "agent_run_id": "aaaaaaaa-1111-2222-3333-444444444444",
      "comparison_agent_configs": [
          {
              "id": 1,
              "configuration": {
                  "name": "orders comparison",
                  "source_datasource_id": "aaaaaaaa-0000-0000-0000-000000000001",
                  "target_datasource_id": "bbbbbbbb-0000-0000-0000-000000000002",
                  "source_dataset_id": "cccccccc-0000-0000-0000-000000000003",
                  "target_dataset_id": "dddddddd-0000-0000-0000-000000000004",
                  "configuration": {
                      "source_columns": ["order_id", "total"],
                      "target_columns": ["order_id", "total"],
                      "primary_keys_source": ["order_id"],
                      "primary_keys_target": ["order_id"],
                  },
              },
          }
      ],
  }

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

  ```javascript JavaScript theme={null}
  const payload = {
    agent_run_id: "aaaaaaaa-1111-2222-3333-444444444444",
    comparison_agent_configs: [
      {
        id: 1,
        configuration: {
          name: "orders comparison",
          source_datasource_id: "aaaaaaaa-0000-0000-0000-000000000001",
          target_datasource_id: "bbbbbbbb-0000-0000-0000-000000000002",
          source_dataset_id: "cccccccc-0000-0000-0000-000000000003",
          target_dataset_id: "dddddddd-0000-0000-0000-000000000004",
          configuration: {
            source_columns: ["order_id", "total"],
            target_columns: ["order_id", "total"],
            primary_keys_source: ["order_id"],
            primary_keys_target: ["order_id"],
          },
        },
      },
    ],
  };

  const response = await fetch(
    "https://YOUR_BASE_URL/comparisons/execute_multiple",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer <api-key>",
        "Workspace-Id": "<workspace-id>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify(payload),
    }
  );
  const data = await response.json();
  console.log(data);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Comparisons submitted for execution",
    "mapped_run_ids": {
      "1": 1043
    }
  }
  ```
</ResponseExample>
