# Estimations (beta)

# Introduction

To provide users with a convenient solution, we've implemented an endpoint designed to offer estimations for both time and fees. This allows users to gauge potential costs and delivery times without the need to initiate the order creation process.

# Note

# Estimation based on real-time driver location

This request will return the estimation based on the actual locations of the drivers that are near the branch.

To try the estimation, you will need to make an HTTP POST request to the following endpoint:

https://staging.armadadelivery.com/v0/deliveries/estimate
https://api.armadadelivery.com/v0/deliveries/estimate

The body of the request should be in JSON format and include the following parameters:

  • branch: Branch ID, The origin point String - Required
  • destination: Customer destination Object - Required
    • latitude: Float - Required
    • longitude: Float - Required

# Request Example

curl --location --request POST 'https://api.armadadelivery.com/v0/deliveries/estimate' \
--header 'Authorization: Key [YOUR API KEY]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "branch": "5eef2043bfa02f001c17b229",
    "destination": {
        "latitude": 29.3300,
        "longitude": 47.9085,
    }
}'
fetch('https://api.armadadelivery.com/v0/deliveries/estimate', {
    method: 'POST',
    headers: {
        'Authorization': 'Key [YOUR API KEY]',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        branch: "5eef2043bfa02f001c17b229",
        destination: {
            latitude: 29.3300,
            longitude: 47.9085,
        }
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
func main() {
	url := "https://api.armadadelivery.com/v0/deliveries/estimate"
	requestBody, err := json.Marshal(map[string]interface{}{
		"branch": "5eef2043bfa02f001c17b229",
		"destination": map[string]float64{
			"latitude":  29.3300,
			"longitude": 47.9085,
		},
	})
	if err != nil {
		fmt.Println("Error in JSON marshal:", err)
		return
	}

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Key [YOUR API KEY]")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response body:", err)
		return
	}

	fmt.Println(string(body))
}

# Response Schema

{
	deliveryFee: Number,
	pickupEta: ISODATE || null,
	deliveryEta: ISODATE || null,
}
deliveryFee pickupEta* deliveryEta*
The cost of the trip in your country's currency Expected time for the driver to pick up the order Expected time for the driver to deliver the order

Eta: Estimated Arrival time

# Response Example

{
	deliveryFee: 17,
	pickupEta: "2024-01-18T14:48:00.000Z",
	deliveryEta: "2024-01-18T15:39:00.000Z"
}

# Timeless Estimation

This request will return the estimation not based on real-time driver locations.

To try the estimation, you will need to make an HTTP POST request to the following endpoint:

https://staging.armadadelivery.com/v0/deliveries/timelessEstimate
https://api.armadadelivery.com/v0/deliveries/timelessEstimate

The body of the request should be in JSON format and include the following parameters:

  • branch: Branch ID, The origin point String - Required
  • destination: Customer destination Object - Required
    • latitude: Float - Required
    • longitude: Float - Required

# Request Example

curl --location --request POST 'https://api.armadadelivery.com/v0/deliveries/timelessEstimate' \
--header 'Authorization: Key [YOUR API KEY]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "branch": "5eef2043bfa02f001c17b229",
    "destination": {
        "latitude": 29.3300,
        "longitude": 47.9085,
    }
}'
fetch('https://api.armadadelivery.com/v0/deliveries/timelessEstimate', {
    method: 'POST',
    headers: {
        'Authorization': 'Key [YOUR API KEY]',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        branch: "5eef2043bfa02f001c17b229",
        destination: {
            latitude: 29.3300,
            longitude: 47.9085,
        }
    })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
func main() {
	url := "https://api.armadadelivery.com/v0/deliveries/timelessEstimate"
	requestBody, err := json.Marshal(map[string]interface{}{
		"branch": "5eef2043bfa02f001c17b229",
		"destination": map[string]float64{
			"latitude":  29.3300,
			"longitude": 47.9085,
		}
	})
	if err != nil {
		fmt.Println("Error in JSON marshal:", err)
		return
	}

	req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Key [YOUR API KEY]")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error reading response body:", err)
		return
	}

	fmt.Println(string(body))
}

# Response Schema

{
	deliveryFee: Number,
	totalDeliveryDuration: Number,
	durationToPickup: Number
}
deliveryFee totalDeliveryDuration durationToPickup
The cost of the trip in your country's currency Total duration of delivery from acceptance to drop-off in seconds Duration from order creation to driver pickup in seconds

# Response Example

{
	deliveryFee: 17,
	totalDeliveryDuration: 1950,
	durationToPickup: 975
}