# Fetch Schedule Test Run Group IDs Endpoint

Below, we’ve listed out the existing route, the new route, and the functionality for the changed routes:-

The following parameters are required to trigger the schedule in Sofy:

- **x-sofy-auth-key**: To retrieve your subscription key, navigate to **Account > Account Settings > API Key**.
- **scheduledRunGuid**: To retrieve your scheduledRunGuid as per the new route, navigate to **Automation > Runs & Results** and click on the **CI/CD Settings** integration icon next to the schedule name to capture the scheduledRunGuid.

#### Functionality

Fetch test run group IDs for a scheduled automated test run.

#### Route

```bash
curl --location "https://public.sofy.ai/scheduler-microservice/scheduled-runs/:scheduledRunGuid/test-run-groups" `
--header "x-sofy-auth-key: XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
```

Replace the placeholder ScheduleRunGUID and authentication key values with the actual values.

Response:

```json
{
    "data": [\
        {\
  "testRunGroupId": "XXXXX",\
  "executedAt": "2023-10-24T06:14:39.200Z",\
  "status": "Stopped by User"\
        },\
        {\
  "testRunGroupId": "XXXXX",\
  "executedAt": "2023-10-20T10:59:10.290Z",\
  "status": "Complete With Errors"\
        }\
    ],
    "message": "Fetched 2 record(s)."
}
```

Error Response:

```json
{
    "error": {
        "message": "Error message.",
        "details": "Error details.",
        "timestamp": "2023-10-23T09:23:51.845Z"
    }
}
```

#### Schedule Test Runs Group ID Statuses

Different ScheduleTestRunsGroupStatuses possibly returned by the API are:

- **Queued**: The schedule has been submitted to the scheduler and is awaiting device acquisition.
- **Running**: The device was acquired and test execution has kicked off.
- **Complete**: Test execution completed successfully. Test case results may be _Pass_ or _Fail_.
- **Complete with errors**: Test execution is completed but with statuses other than _Pass_ or _Fail_ for individual test runs. This includes—but is not limited to— _Not Executed_ or _Incomplete_.
