Delivery
Create and manage trips and courses.
List Trips
Returns list of your trips matching the given conditions.
Server might not have or decide not to send you as many result items as limit but it never sends you more than that.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
query Parameters
area_idFilter: The ID of the area of the pickup location. You can find list of available areas in the List Areas endpoint
stateFilter: The state of the trip. Should be one of the states specified in Trip definition
is_round_tripFilter: Base on is_round_trip of trip
bill_numberFilter: The bill_number of the courses in the trips.
from_datetime^\d{4}-\d{2}-\d{2}T\…Filter: Minimum acceptable value for trip's created_at field. This filter is inclusive
Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
to_datetime^\d{4}-\d{2}-\d{2}T\…Filter: Maximum acceptable value for trip's created_at field. This filter is inclusive
Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
offsetGive results excluding the first offset number of objects
limitGive at most limit number of results. The default value is 100
List Trips › Responses
Successful response.
nextNext page URL, or null.
previousPrevious page URL, or null.
total_countCreate Trip
Creates a new trip and puts it in the assign queue.
Round-trip creation is available only to accounts enabled by Miare, not to all clients. Contact Miare to request enablement for your account. Until enabled, course return requirements in the create request are ignored and the trip is created without a requested return.
Each course can independently require a return to the pickup location.
If any course has is_round_course: true, the trip requires one final return after all
deliveries; a false value on another course does not cancel that requirement.
This does not require a separate return after each course or add another delivery course.
The trip-level response field is_round_trip is true when any course
requires a return. To change the trip's return requirement after creation, use the
Round Trip endpoint.
Setting is_round_course is supported only in Create Trip. Add Course ignores this
field, and Update Trip cannot change it.
Trip creation will fail if you don't have enough concurrency limit in the area of the pickup location of the given trip in the deadline shift.
For clients with proxy invoicing enabled, register the seller through the
Register or Update Seller endpoint before creating a
trip. For these clients, pickup.seller_id is required.
The maximum declared package value is checked separately for each course using
payment.price, in Tomans (IRT). A value equal to the limit is allowed.
If any course exceeds the effective limit, the entire request is rejected and no trip is created.
The default cap applies unless a client-specific cap has been configured by Miare.
Contact the commercial team to configure a client-specific cap.
The mixed-course example above applies to clients that can create multi-course trips. Clients with auto-batching enabled can still send only one course per trip.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| concurrency_limit | Client does not have enough concurrency in the area of the pickup location in the shift specified by deadline |
| service_level_order | Based on the current environmental state, your service level is too low to receive services from Miare. Service limitation error mostly happens due to whether conditions or special occasions. In order to increase your service level or if you need more details about this limitation please contant sales team. |
| duplicated_bill_number | There is already a course related to trip with states of (assign_queue, pickup, dropoff) with this bill number. |
| delivery_code_required | delivery_code is required for each course when the client/source proof_of_delivery_policy is third_party. |
| delivery_code_invalid | delivery_code was provided but is not a valid 5-digit code. Leading/trailing whitespace is ignored before validation. |
| seller_not_registered | Proxy invoicing is enabled and pickup.seller_id is missing or is not registered for the authenticated client. Register the seller before creating the trip. |
| invalid_boost_level | This level is not among the current valid levels. Refer to the valid boost levels. |
| declared_package_value_too_high | HTTP 400. A course's payment.price exceeds the effective declared-value cap for the client. The entire trip-creation request is rejected. |
The course index in this example is zero-based (0 identifies the first course).
The cap shown is illustrative; use code for error handling, as detail may change.
Create Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Cancel Trip
Cancels one of your trips indicated by its ID.
Note that a trip cannot be canceled when it has passed 30 seconds since we’ve assigned it to a courier or the courier has already arrived at the source. In special cases that you still need to cancel the trip, please contact our support.
You can find ID of your trip in the response body of Create Trip request
The given trip ID must belong to your client.
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Successful calls to this endpoint will update the state of the trip to canceled_by_client.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
| canceling_after_deadline | The trip has been in assigned state for more than 30 seconds |
| canceling_arrived_trip | The trip's courier is already at the source location |
| canceling_ended_trip | The trip is already ended (delivered) |
| invalid_state_change | Changing the trip's state from its current state to canceled is not possible |
path Parameters
trip_idThe trip id belonging to the authenticated client.
Cancel Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Round Trip
Enable or remove the return requirement for the trip indicated by its ID. This endpoint requires account enablement by Miare.
The return requirement can be changed while the trip is in assign_queue,
pickup, dropoff, or returning state.
Completed or canceled trips cannot be changed.
You can find ID of your trip in the response body of Create Trip request
The given trip ID must belong to your client.
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Requiring a return does not immediately change the trip state to returning.
The trip enters returning after all deliveries are complete and a return is still
required. Removing the last return requirement after deliveries are complete can end the trip.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
| invalid_state_change | The trip is already completed or canceled, so its return requirement cannot be changed. |
path Parameters
trip_idThe trip id belonging to the authenticated client.
Round Trip › Request Body
is_round_tripRequire or remove one final return to the pickup location.
Round Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Boost Trip
Add, cancel, or update a trip's boost level by its ID.
You can only update trip in the assign_queue state.
You can find ID of your trip in the response body of Create Trip request
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
| invalid_boost_level | This level is not among the current valid levels. Refer to the valid boost levels. |
| invalid_trip_state | The boost cannot be added, changed, or cancelled because the trip is no longer in assign_queue. |
path Parameters
trip_idThe trip id belonging to the authenticated client.
Boost Trip › Request Body
levelA current boost level, or 0 to cancel. Fetch valid levels periodically.
Boost Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Get Trip
Returns information about one of your trips indicated by its ID.
You can find ID of your trip in the response body of Create Trip request
The given trip ID must belong to your client.
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
path Parameters
trip_idThe trip id belonging to the authenticated client.
Get Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Update Trip
Updates an existing trip and it's courses.
This endpoint cannot change requires_box. Existing course values are preserved, including when
requires_box is supplied in the update request.
This endpoint cannot change is_round_course. Use Round Trip to change the
return requirement after creation.
This endpoint is deprecated. Please refer to other endpoints.
You can only update trip in the assign_queue or pickup states.
The required boost field can only be changed or cancelled while the trip is in the
assign_queue state.
Please note that in this request, the boost field is required, in contrast to the Create Trip request.
You can find ID of your trip in the response body of Create Trip request
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
| too_late | Trip's state is later than pickup |
| duplicated_bill_number | There is already a course related to trip with states of (assign_queue, pickup, dropoff) with this bill number |
| invalid_boost_level | This level is not among the current valid levels. Refer to the valid boost levels. |
| invalid_trip_state | The boost cannot be changed or cancelled because the trip is no longer in assign_queue. |
path Parameters
trip_idThe trip id belonging to the authenticated client.
Update Trip › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Add Course
Adds a new course to the courses of a trip.
This endpoint ignores is_round_course. Use Round Trip to change the return
requirement after creation.
When box requirements are enabled, adding a course with requires_box: true to an assigned
trip requires the currently assigned courier to be compatible. Otherwise the request is rejected with
HTTP 409 (driver_box_required); the course is not added and the existing assignment is unchanged.
You can only add a course to a trip in the assign_queue or pickup states.
The new course's payment.price is checked against the same per-course declared-value
limit described in Create Trip. If it exceeds the limit, the request
is rejected and the course is not added. A value equal to the limit is allowed.
You can find ID of your trip in the response body of Create Trip request
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A trip with the given ID does not belong to your client or doesn't exist at all |
| too_late | Trip's state is later than pickup |
| duplicated_bill_number | There is already a course related to trip with states of (assign_queue, pickup, dropoff) with this bill number |
| delivery_code_required | delivery_code is required when the client/source proof_of_delivery_policy is third_party |
| delivery_code_invalid | delivery_code was provided but is not a valid 5-digit code. Leading/trailing whitespace is ignored before validation |
| driver_box_required | HTTP 409. The assigned courier cannot carry a course requiring a box. The course is not added and the existing assignment is unchanged. |
| declared_package_value_too_high | HTTP 400. The new course's payment.price exceeds the effective declared-value cap for the client. The course is not added. |
The cap shown is illustrative; use code for error handling, as detail may change.
path Parameters
trip_idThe trip id belonging to the authenticated client.
Add Course › Request Body
bill_numberAn string field left for you to store sort of a human readable bill number in it which will be used as a reference point among our support team, you and the pickup staffs
nameName of the dropp-off
phone_numberThe phone number associated with the drop-off which will be used by courier and support staffs in order to contact to them if necessary
addressThe human readable drop-off address, preferably down to every necessary detail for a human to find it quickly
delivery_code^\s*[0-9]{5}\s*$Required only when the client/source proof_of_delivery_policy is third_party. Must be exactly 5 digits. Leading/trailing whitespace is ignored before validation and storage. When accepted, this code is stored as the course PoD code and will be used later for delivery verification by the driver. For clients whose PoD policy is none or miare, this field is not required.
The contents of the package to be delivered to the drop-off
requires_boxOptional; defaults to false. When box requirements are enabled, true requires a car or a motorcycle courier with a box for the whole trip, even if only one course requires it. Existing client service-level restrictions still apply. Confirm availability with Miare: while disabled, true is accepted but stored as false and course-level box requirements are not enforced. Enabling later does not restore ignored requirements. The value cannot be edited after creation; unrelated updates preserve it.
Add Course › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Remove Course
Removes the course indicated by the given ID from the courses of its trip.
You can only remove courses from a trip in the assign_queue or pickup states which has at least two courses.
You can find ID of your course in the response body of Create Trip or Add Course requests.
The given course ID must belong to your client.
Response body is a serialized trip. For a detailed version of it take a look at the response body of Create Trip request.
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
| parse_error | The request body is not a valid JSON string (has syntax error) |
| invalid_request_body | Request body does not follow the valid format |
| record_not_found | A course with the given ID does not belong to your client or doesn't exist at all |
| single_course | The course belongs to a trip that has only one course |
path Parameters
course_idThe course id belonging to the authenticated client.
Remove Course › Responses
Successful response.
is_round_tripWhether this trip requires a return to the pickup location. On creation, true when any course has is_round_course set to true. This is a response field, not a root-level Create Trip request field.
rounded_at^\d{4}-\d{2}-\d{2}T\…For accounts with round-trip creation enabled, null until return completion, then the recorded return-completion time. For a batched order, this is the completion time of the shared return. Cancellation or an aborted trip does not count as return completion.
idUnique ID of this trip
stateCurrent state of this trip. Advanced states depend on account configuration.
All of the different courses at which parts of this trip should be dropped off
created_at^\d{4}-\d{2}-\d{2}T\…The exact moment at which this trip is created for the first time
assigned_at^\d{4}-\d{2}-\d{2}T\…The time this trip was assigned to its current courier
picked_up_at^\d{4}-\d{2}-\d{2}T\…The time at which the courier picked up the items from pickup location
couriertest_modeWhether or not this trip was created in test mode
batch_idCurrent batch identifier; equals id before batching and may change while the trip is in progress.
delivery_costFinal delivery cost in Tomans (IRT); null until available.
arrived_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
departed_at^\d{4}-\d{2}-\d{2}T\…Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.
Boost Levels
Returns the current valid boosting levels along with the corresponding price increase for each level in Tomans (IRT).
Please note that boosting levels are dynamic and set by the commercial team, though they change infrequently. It is essential to periodically fetch them from this endpoint.
Boost levels always start at 1 and are continuous. If you see a level 3, levels 1 and 2 are also available.
Level 0 is not included in this list but can be used in requests and updates to cancel a boost.
Boost availability is configured separately for each account. Receiving this list does not mean that Boosting is enabled for your account; Boost requests from accounts without access are rejected.
The response is an array of all the current available levels.
The details of the properties for each object are as follows:
Errors
| Code | Description |
|---|---|
| not_authenticated | Token is missing or invalid |
Boost Levels › Responses
Successful response.
levelamountPrice increase in Tomans (IRT).