# Estimation

# Introduction

Users can get estimates for the time and fees from the branch to the destination location through our endpoints, Allowing them to check potential costs and delivery times without starting the order process.

# Real-Time Driver Location Estimation

Get delivery estimates based on the current locations of nearby drivers.

To try it, send an HTTP POST request to this endpoint:

POST
https://api.armadadelivery.com/v1/deliveries/estimate

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

  • origin: Origin information Object - Required
    • branch: Branch ID String - Required
  • destination: Customer destination Object - Required
    • location: Location information Object - Required
      • latitude: Float - Required
      • longitude: Float - Required

# Request Example

curl --location --request POST 'https://api.armadadelivery.com/v1/deliveries/estimate' \
--header 'Armada-Access-Token: [YOUR ACCESS TOKEN]' \
--header 'Content-Type: application/json' \
--data-raw '{
  "origin": {
    "branch": "6757fe0ecc4d918c80f71256"
  },
  "destination": {
    "location": {
      "latitude": 29.3300,
      "longitude": 47.9085
    }
  }
}'
fetch('https://api.armadadelivery.com/v1/deliveries/estimate', {
    method: 'POST',
    headers: {
        'Armada-Access-Token': '[YOUR ACCESS TOKEN]',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        origin: {
            branch: "6757fe0ecc4d918c80f71256"
        },
        destination: {
            location: {
                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/v1/deliveries/estimate"
	requestBody, err := json.Marshal(map[string]interface{}{
		"origin": map[string]string{
			"branch": "6757fe0ecc4d918c80f71256",
		},
		"destination": map[string]interface{}{
			"location": 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("Armada-Access-Token", "[YOUR ACCESS TOKEN]")

	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,
}
Field Description
deliveryFee The cost of the trip in your country's currency
pickupEta* Expected time for the driver to pick up the order
deliveryEta* Expected time for the driver to deliver the order

# Response Example

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

# Timeless Estimation

Get delivery estimates without relying on real-time driver locations.

To try it, send an HTTP POST request to this endpoint:

POST
https://api.armadadelivery.com/v1/timeless_estimate

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

  • origin: Origin information Object - Required
    • branch: Branch ID String - Required
  • destination: Customer destination Object - Required
    • location: Location information Object - Required
      • latitude: Float - Required
      • longitude: Float - Required

# Request Example

curl --location --request POST 'https://api.armadadelivery.com/v1/timeless_estimate' \
--header 'Armada-Access-Token: [YOUR ACCESS TOKEN]' \
--header 'Content-Type: application/json' \
--data-raw '{
  "origin": {
    "branch": "6757fe0ecc4d918c80f71256"
  },
  "destination": {
    "location": {
      "latitude": 29.3300,
      "longitude": 47.9085
    }
  }
}'
fetch('https://api.armadadelivery.com/v1/timeless_estimate', {
    method: 'POST',
    headers: {
        'Armada-Access-Token': '[YOUR ACCESS TOKEN]',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        origin: {
            branch: "6757fe0ecc4d918c80f71256"
        },
        destination: {
            location: {
                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/v1/timeless_estimate"
	requestBody, err := json.Marshal(map[string]interface{}{
		"origin": map[string]string{
			"branch": "6757fe0ecc4d918c80f71256",
		},
		"destination": map[string]interface{}{
			"location": 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("Armada-Access-Token", "[YOUR ACCESS TOKEN]")

	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
}
Field Description
deliveryFee The cost of the trip in your country's currency
totalDeliveryDuration Total duration of delivery from acceptance to drop-off in seconds
durationToPickup Duration from order creation to driver pickup in seconds

# Response Example

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