Overview

Using the Predict API

2min

API Endpoint

The primary function of the Predict endpoint is to generate an RTO risk score based on order details. Refer to the table below for the list of parameters.

Parameter

Data Type

Description

Example

cl*

string

The registered client name with Delhivery.

ABC SURFACE

order_id

string

Unique identifier of the order being placed or already placed.

abc-126-fba

order_date*

string

Date of when the order was already placed or is being placed.

12-05-2023

order_value*

number($float)

Total value if the order in rs including discount.

1024

total_discount*

number($float)

Discount given on the purchase.

200

total_line_item_quantity*

number($float)

Quantity of all line items in the order.

2

line_items*

list

All line items in an list.



line_items.item_id*

string

The id of the item.

ajio-smh-smj

line_items.product_description*

string

The product description of the line item.

green_tshirt

line_items.item_colour

string

The colour of the item.

green

line_items.item_quantity*

integer

Quantity of a particular line_item in the order.

1

line_items.item_discount

number($float)

Discount of the item.

0

line_items.item_price

number($float)

Price of the item.

524

seller_origin_city

string

Pickup city of the order.

bhiwandi

seller_origin_pincode

string

Pickup pincode of the seller.

410889

seller_pickup_location

string

The pickup_location of the order.



promised_delivery_date

string

Promised delivery date by Logistics partner.

22-08-2023

shipping_address*

dictionary

The dictionary of details for the shipping address.



first_name

string

First name of the consignee.

First Name

last_name

string

Last name of the consignee.

Last Name

address1*

string

Address line 1 of the consignee.

plt4 sec44

address2

string

Address line 2 of the consignee.



city

string

City of the consignee.

ggn

state

string

State of the consignee.

Haryana

pincode*

string

Pincode of the consignee.

122003

billing_address

Dictionary

The dictionary of details for the billing address.



first_name

string

First name of the consignee.

First Name

last_name

string

Last name of the consignee.

Last Name

address1

string

Address line 1 of the consignee.

plt4 sec44

address2

string

Address line 2 of the consignee.



city

string

City of the consignee.

ggn

state

string

State of the consignee.

Haryana

pincode

string

Pincode of the consignee.

122003

ph_no*

string

Phone number of the consignee.

9999999999

customer

Dictionary

The dictionary of details for the customer.



customer_ip

string

Ip of the customer.

192.168.0.1

customer_browser

string

Browser used by the customer.

Chrome

new_customer

string

Whether the order is from a new customer or an existing customer.

1

device_type

string

Whether the order has been placed via a mobile, tab or laptop.

laptop

gender

string

Gender of the customer.

f

Please refer to the table below while inferring the API Response.

Field

Type

Description

status_code

number

Status code of the request.

request_id

String

The unique id for the request.

message

String

Information about the processed request.

data

Object

The object that contains the Predict API results. 

data.rto_score

Float

Risk score which indicates the likelihood of RTO. 

data.additional_info

dict

Additional info which will help in contextualizing the RTO score. This would include relative RTO risk, probable reason for RTO. This will be populated in later versions of the API.

error

Object

Will include the error details in case of unsuccessful response. 

error.type

String 

Type of error encountered.

error.message 

String

Message detailing the error.

The following example request returns an RTO score of 0.43.

/
POST /predict
JSON