Skip to content

Minimum Items

The MIN_ITEMS error occurs when an array field in the request does not meet the minimum required number of items.

Handling error for the Track endpoint

This error specifically arises when the trips array is sent empty. The API requires at least one trip object within the trips array to process the event correctly.

Request Body (Incorrect)

This payload will trigger the MIN_ITEMS error because the trips array is empty.

{
"event_name": "payment_failed",
"event_data": {
"insurance": false,
"coupon": "SUMMER10",
"passenger_count": 2,
"payment_type": "credit_card",
"trips_count": 1,
"tickets": 2,
"total": 31.00,
"product": "web",
"distinct_id": "1234567890",
"email": "john.doe@example.com",
"phone": "+12154567890",
"trips": []
}
}

Response

{
"errors": [
{
"error_type": "MIN_ITEMS",
"field": "trips",
"message": "Field trips must have at least 1 item and got 0.",
"suggestion": "Ensure the trips field has at least one item."
}
],
"message": "Validation failed. See details for more information.",
"status": "error"
}

Request Body (Corrected)

To resolve this error, ensure the trips array contains at least one valid trip object, as shown below.

{
"event_name": "payment_failed",
"event_data": {
"insurance": false,
"coupon": "SUMMER10",
"passenger_count": 2,
"payment_type": "credit_card",
"trips_count": 1,
"tickets": 2,
"total": 31.00,
"product": "web",
"distinct_id": "1234567890",
"email": "john.doe@example.com",
"phone": "+12154567890",
"trips": [
{
"departure_arrival": "2025-04-25T10:30:00-05:00",
"departure_destination": "Boston",
"departure_destination_terminal": "South Station",
"departure_line": "Coastal Express",
"departure_origin": "New York",
"departure_origin_terminal": "Port Authority",
"departure_price": 15.50,
"departure_route": "NY-BOS",
"departure_stop_cities": "New Haven",
"departure_stops": 1,
"departure_time": "2025-04-25T15:30:00-05:00",
"departure_transporter": "East Coast Bus Company",
"departure_transport_type": "bus",
"bus_categories": "general"
}
]
}
}