# Run dataset tester

`POST /v1/destinations/{destinationId}/sendSampleDataset`

Available as MCP tool `run-dataset-tester` (Write).

Destination endpoints allow you to review and manage destinations in a specified environment. 

You must be a member of the environment and be assigned to an engineer role to manage destinations. [Learn about roles](https://docs.redoxengine.com/permalink/1OBel3inQAjAnDbgd9QLzM). 

### Run dataset tester

Send a sample dataset to one of your configured destinations. We currently support sending one of these dataset types to one of your configured destinations:

- HL7v2 ADT
- C-CDA
- X12 835
- X12 837

This verifies that your destination can receive expected data from sources in your subscription(s). In other words, this simulates the entire source-to-destination flow. 

> **Test source**
>
> Running <u>**Dataset Tester**</u> automatically generates a test source in the given environment. A new test source is created for each dataset type and destination combo you select. This occurs in both <u>**development**</u> and <u>**staging**</u> environments. 
>
> Keep in mind the following when new sources are created: 
>
> - Once you have multiple sources, you must include the source ID in outgoing API requests. [Learn about including source details](/basics/data-exchange-with-redox/Managing-source-details-in-outgoing-requests). 
> - You may see details of these test sources when you retrieve all sources for a given environment using the Redox Platform API. [Review the Get sources spec](https://docs.redoxengine.com/permalink/e7d2a75e-db15-5c0b-9690-dd785b4cfd1e-get-sources).

## Request parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `destinationId` | path | string | Yes | Contains the unique identifier of the destination where a dataset should be sent. |

## Request body

Contains the fields that are required when using dataset tester.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `datasetId` | string | Yes | Defines the type of dataset to send with dataset tester. Value: hl7v2-adt |

## Request example

_Generated from the schema: the values are placeholders, not a real payload._

```bash
curl 'https://api.redoxengine.com/platform/v1/destinations/{destinationId}/sendSampleDataset' \
--request POST \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
  "datasetId": "hl7v2-adt"
}'
```

## Responses

### 200

Contains a payload object describing the subscription where the dataset was successfully sent.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `meta` | object | No |  |
| `meta.version` | string | No | Lists the major and minor version number for the format of the returned payload. The payload format or shape may change between minor versions, like including additional or extended fields in later versions. We include the version data in each response so that you have the option to handle the signaled differences. |
| `payload` | object | No | Contains the payload with details about the requested destination. |
| `payload.sourceId` | string (uuid) | No | Contains the unique identifier of the test source that initiated the dataset test. |
| `payload.destinationId` | string (uuid) | No | Displays the unique identifier of the endpoint that will receive messages from Redox. |
| `payload.dataModels` | Array of string | No | Includes a list of supported data models when using dataset tester. |

_Generated from the schema: the values are placeholders, not a real payload._

```json
{
  "meta": {
    "version": "1.0.0"
  },
  "payload": {
    "sourceId": "797f5a94-3689-4ac8-82fd-d749511ea2b2",
    "destinationId": "d0a0ebc7-d6b4-4f3c-a5af-5761a8148e3a",
    "dataModels": [
      "FHIR.Event.PatientAdmin"
    ]
  }
}
```

### 400

Bad Request

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.id` | string | No | Contains a unique identifier for the given error instance. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Bad Request`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Bad Request",
      "code": "validation.error.bad.request",
      "detail": "Error details",
      "status": 400,
      "transient": false
    }
  }
}
```

### 403

Forbidden

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.errors` | Array of object | No |  |
| `payload.errors[].title` | string | No | Displays the high-level error message, typically something succinct like `Forbidden`. |
| `payload.errors[].code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |

```json
{
  "payload": {
    "errors": [
      {
        "title": "Forbidden",
        "code": "authorization.forbidden"
      }
    ]
  }
}
```

### 500

Internal Server Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Failed in step X`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Internal Server Error",
      "code": "failed.db.lookup",
      "detail": "Error details",
      "status": 500,
      "transient": true
    }
  }
}
```
