| Time | Status | User Agent |  |
| :-- | :-- | :-- | :-- |
| Make a request to see history. |

#### URL Expired

The URL for this request expired after 30 days.

Search group dispatch request input

Search parameters for the search dispatches endpoints

### Request Parameters
- **market_group_ids**: array of uuids  (length ≥ 1)
  - Market group ids to get group dispatches for

- **market_group_event_ids**: array of uuids (length ≥ 1)
  - Market group event ids to get group dispatches for

- **start_date**: date-time (required)
  - Start datetime range to get dispatches for (inclusive)

- **end_date**: date-time (required)
  - End datetime range to get dispatches for (exclusive). End date must be max 31 days after the start date

- **exclude_real_time_events**: boolean (Defaults to true)
  - Exclude dispatches for CAISO 5 minute real time events in the response.

- **exclude_voluntary_events**: boolean (Defaults to false)
  - Exclude dispatches for voluntary events in the response.

- **page_token**: uuid  
  - Token of the page to request. Max results per page is 500. Null to request a new batch of results

### Responses

#### 200 
- The group dispatches that match the search input

#### Response Structure 
- **next_page_token**: uuid 
    - Token to be used in a subsequent request to get the next batch of results. Max results per page is 500. Null when the last page of results has been reached

- **results**: array of objects  (required)  
    - A list of market-group dispatches.

#### Result Structure 
- **market_group_id**: uuid  (required)  
    - The id of the market group that received dispatches from the market.

- **meter_ids**: array of uuids  (required)  
    - Ids of the meters that received dispatches from the market

- **partner_references**: array of strings  
    - The partner-supplied reference IDs to help identify the customer or site that a Leap meter correlates to a partner’s internal systems.

- **timeslots**: array of objects  (required, length ≥ 1)  
    - List with timeslots and quantities that contains dispatches for this market group.

#### Timeslot Structure
- **communication_test**: boolean  
    - Indicates whether the dispatch is a communication test.

- **market_group_event_id**: uuid  (required)  
    - Unique identifier of the market group dispatch event

- **start_time**: date-time  (required)  
    - Start time of dispatch

- **end_time**: date-time  (required)  
    - End time of dispatch

- **cancelled**: boolean  (required)  
    - 'true' if this event has been cancelled

- **energy_kw**: double  
    - The awarded kW for the dispatch.

- **nomination_kw**: double  
    - The nomination in kW.

- **performance_compensation_cap**: string (enum, required)
    - This field can be used to automate a dispatch response that is aligned with the event’s settlement structure.
    - Values: `up-to-nomination`, `up-to-site-load`, `grid-exports-allowed`

- **priority**: integer (required)
    - The priority of the dispatch compared to other dispatches for the same meter.

- **is_voluntary**: boolean (required)
    - Indicates whether the dispatch is voluntary or a commitment.

- **dispatch_event_types**: array of objects (required, length ≥ 1)
    - Used for programs that have different compensation structures for different types of dispatch events.

- **programs**: array of objects (required, length ≥ 1)
    - Programs associated with the dispatch.

### Example Request
```bash
curl --request POST \
     --url https://api.staging.leap.energy/v2/dispatch/group/search \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "market_group_ids": [],
  "market_group_event_ids": [],
  "exclude_real_time_events": true,
  "exclude_voluntary_events": false
}
'
```

### Example Response
```json
{
  "next_page_token": "a946dfb9-5dc9-41f4-b9f2-4e5ac8fb5447",
  "results": [
    {
      "market_group_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
      "meter_ids": [
        "a946dfb9-5dc9-41f4-b9f2-4e5ac8fb5447",
        "74a2444d-7b49-45d1-93f7-dd8c24b33130"
      ],
      "timeslots": [
        {
          "market_group_event_id": "904751e8-c0df-4d69-8a4f-9e7cebef1f84",
          "start_time": "2023-01-23T01:00:00.000Z",
          "end_time": "2023-01-23T02:00:00.000Z",
          "energy_kw": 95,
          "nomination_kw": 100,
          "cancelled": false,
          "programs": [
            "CCA"
          ],
          "priority": 2,
          "is_voluntary": false,
          "performance_compensation_cap": "up-to-site-load",
          "dispatch_event_types": [
            "day-ahead"
          ]
        },
        {
          "market_group_event_id": "3d1394e4-3f4a-4ee0-bd86-bf653ba29537",
          "start_time": "2023-01-23T02:00:00.000Z",
          "end_time": "2023-01-23T03:00:00.000Z",
          "energy_kw": 115,
          "nomination_kw": 120,
          "cancelled": false,
          "programs": [
            "CCA"
          ],
          "priority": 2,
          "is_voluntary": false,
          "performance_compensation_cap": "up-to-site-load",
          "dispatch_event_types": [
            "day-ahead"
          ]
        }
      ]
    }
  ]
}
```
