0% found this document useful (0 votes)
331 views58 pages

Sonic API Documentation Overview

This API documentation provides information on booking shipments, retrieving shipment statuses, tracking shipments, and other logistics functions using the SONIC API. It includes sections on adding pickup addresses, listing pickup addresses, retrieving a list of cities and their logistics information, parameters for booking a regular shipment, booking a replacement shipment, and more. The documentation provides the required headers, endpoints, request bodies, and example response formats for each API call.

Uploaded by

hamza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
331 views58 pages

Sonic API Documentation Overview

This API documentation provides information on booking shipments, retrieving shipment statuses, tracking shipments, and other logistics functions using the SONIC API. It includes sections on adding pickup addresses, listing pickup addresses, retrieving a list of cities and their logistics information, parameters for booking a regular shipment, booking a replacement shipment, and more. The documentation provides the required headers, endpoints, request bodies, and example response formats for each API call.

Uploaded by

hamza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

API Documentation-SONIC

Sonic
By

Version 2.0
April 18, 2022
Table of Contents
Sonic ......................................................................................................................................... 1
(a) Pre-Requisites: ................................................................................................................... 3
1. Add a Pickup Address ......................................................................................................... 4
2.List of Pickup Addresses ..................................................................................................... 5
3. City List and Information ..................................................................................................... 6
4. Book a Shipment .................................................................................................................. 8
5. Current Status of a Shipment .............................................................................................20
6. Tracking of a Shipment.......................................................................................................21
7.Charges of a Shipment ........................................................................................................26
9. Payment Details of a Shipment [Multiple] .........................................................................28
9. Payment Details of a Shipment [Invoice] ..........................................................................29
10. Payment Details of a Shipment ........................................................................................31
11.Printing Air waybill (Consignment Note) of a Shipment ..................................................32
12. Cancelling a Booked Shipment ........................................................................................33
13. Calculating the Rates for a Destination ...........................................................................34
14. Creating a Receiving Sheet ..............................................................................................36
15. View/Print a Receiving Sheet ...........................................................................................37
16. Order ID Tracking ..............................................................................................................38
17. Shipment Status by Order ID............................................................................................40
18. Return Confirmation Pending Status...............................................................................41
19. Re-attempted Requested Status ......................................................................................42
20. Intercept/Rebook Request ................................................................................................43
21. CRM Request (Complaint) ................................................................................................45
22. CRM Request (Service Request) ......................................................................................46
23. CRM Request (Claim) .......................................................................................................47
24. Shipment Status Webhooks .............................................................................................49
25. Payment Status Webhooks ..............................................................................................50
26. Initial Charges Webhooks ................................................................................................51
27. Final Charges Webhooks .................................................................................................52
(a) Pre-Requisites:

TESTING URL

Live: http://sonic.pk
Testing: http://app.sonic.pk

HOW TO GET API AUTHORIZATION KEY

Fig 1: Profile option

On the header section of the portal, go for the profile option at the top-right (by clicking on the company name).

Fig 2: API Key field in the profile screen

Upon clicking, the profile screen will be opened, where the API key can be seen at the bottom row, which you can
copy to use for authorization purposes.
1. Add a Pickup Address

METHOD -> POST

URL
https://sonic.pk/api/pickup_address/add

HEADERS

Input Description

Authorization API Key to be provided individually

BODY

Add these variables and their values as ‘Body’ in the API.

S.no. Variable Description Condition Validation Format Sample

Name of the person


1 person_of who will be Mandatory Character String Ali Baba
_contact coordinating for limit:100
pickup
Phone Number of
phone_number the coordinator for Mandatory The phone Integer 0300-1234567
2 pickup number is bound
on this format

i.e.,03001234567
Email address of the
3 Email_address coordinator for Mandatory Email [email protected]
pickup

The address from Shahra-e-Faisal,


4 address which the shipment Mandatory Character limit: String Karachi, Pakistan.
will be Picked 190
Float ID of the city
5 city_id from where the Mandatory City IDs can be Integer 202
shipment viewed
will be picked From City List API

RESULT

{
"status": 0,
"message": "Pickup Address has been added",
"id": 3015
}
2.List of Pickup Addresses

METHOD -> GET

URL
https://sonic.pk/api/pickup_addresses

HEADERS

Input Description

Authorization API Key to be provided individually

RESULT

{
"status": 0,
"message": "Pickup Addresses",
"pickup_addresses": [
{
"id": 3012,
"person_of_contact": "Sahban",
"phone_number": "0349-1330874",
"Email_address": "[email protected]",
"address": "Gulshan-e-Iqbal",
"status": 1,
"default": false,
"city": {
"id": 202,
"name": "Karachi"
}
},
{
"id": 3015,
"person_of_contact": "ali baba",
"phone_number": "03001234567",
"Email_address": "[email protected]",
"address": "shahra e faisal",
"status": 1,
"default": false,
"city": {
"id": 202,
"name": "Karachi"
}
}
]
}
3. City List and Information

METHOD -> GET

URL
https://sonic.pk/api/cities

HEADERS

Input Description

Authorization API Key to be provided individually

RESULT

{
"status": 0,
"message": "Pickup and Delivery Information of Cities",
"cities": [
{
"id": 101,
"name": "Abbottabad",
"hub": {
"id": 101,
"name": "Abbottabad"
},
"zone": {
"id": 3,
"name": "North"
},
"pickup": true,
"delivery": {
"Regular": [
"Rush",
"Saver Plus"
],
"Replacement": [
"Rush"
]
}
},
{
"id": 102,
"name": "Abdul Hakim",
"hub": {
"id": 251,
"name": "Multan"
},
"zone": {
"id": 2,
"name": "Central"
},
"pickup": false,
"delivery": {
"Regular": [
"Rush",
"Saver Plus"
],
"Replacement": [
"Rush"
]
}
},
4. Book a Shipment

METHOD -> POST

URL
https://sonic.pk/api/shipment/book

HEADERS

Input Description

Authorization API Key to be provided individually

BODY

Add these variables and their values as ‘Body’ in the API.

FOR REGULAR SHIPMENTS

S.n Variable Description Condition Validation Forma Sample


o t
Defines the
1 service_type_id service that Mandatory Check Integer 1
you are Appendix A
going to use
i.e., Regular
Replacemen
t, or Try &
Buy.

The address
pickup_address_id from which Mandatory Address IDs Integer 123
2 the can be
shipment viewed from
will be Addresses
picked API

Option to
3 information_display show or hide Mandatory To hide enter Integer 0
your contact "0", to show
details on enter “1”
the air
waybill
Float ID of City IDs can
4 consignee_city_id the city Mandatory be viewed Integer 202
where the from City List
shipment API . Only
will be cities allotted
delivered for the
subjected
service can
be added
Name of the
5 consignee_name receiver to Mandatory Character String Abdullah
whom the limit: 100
shipment
will be
delivered

6 consignee_address Address Mandatory Character String Shahra-e-


where the limit 190 Faisal, Karachi,
shipment Pakistan.
will be
delivered

7 consignee_phone_number_ Phone Mandatory The Phone Phone 0300-1234567


1 Number of Number is Numbe
the receiver bound on this r
format i.e.,
03001234567

8 consignee_phone_number_ Another Optional The Phone Phone


2 Phone Number is Numbe 0300-1234567
Number of bound on this r
the receiver format i.e.,
0300-
1234567

9 consignee_email_address Email Mandatory Email [email protected]


address of
the
coordinator
for pickup

10 order_id Shipper’s Optional It must be String A-148


own unique for
reference ID one shipper.
Character
Limit: 100

11 item_product_type_id Category of Mandatory Check Integer 12


the item(s) Appendix B
in the order
to be
delivered

12 item_description Nature and Mandatory Character String One black t-


details of the limit: 190 shirt medium
item(s) in
the order to
be delivered

13 item_quantity Number of Mandatory Integer 2


item(s)
14 item_insurance Provision to Mandatory This will only Integer 0
opt be valid for
Insurance customers
claim in whose
case of loss insurance is
of item authorized at
the time of
account
opening, to
deselect enter
"0", to select
enter "1"

15 item_price Value of the Optional Subjected to Integer 1000


item(s) in selecting
the order item_insuranc
e

16 pickup_date Date at Mandatory YYYY-MM- Date 2018-08-07


which the DD
order is
requested to
be picked

17 special_instructions Any reference or Optional String Please call


remarks before delivery
regarding the
delivery

18 estimated_weight Estimated Mandatory Float 1.05


mass of the Please note
shipment that this will
not be the
final weight
of the
shipment
and no
charges will
be
calculated
based on
this value

19 shipping_mode_id The method of Mandatory Check Integer 1


shipping Appendix C
through which
the shipment
will be
delivered

For same-day
20 same_day_timing_id shipping mode, For "6 Integer 1
define the Optional hours" enter
timeline in "1",
which the For "Same-
shipment will day" enter
be delivered "2"

21 amount The amount to Mandatory Do not use Integer 1000


be collected at commas or
the time of dots for this
delivery Parameter

22 payment_mode_id How the Mandatory Check Integer 1


amount will be Appendix C
collected, either
COD, card or
mobile wallet

23 charges_mode_id How the Mandatory Check Integer 2 or 4 for


shipper would Appendix F Reimburseme
want TRAX to nt Account
collect their type, 2 or 3 for
service Invoicing
charges, either Account type
from the
shipper or from
their
consignees via
2Pay option

24 open_shipment Customer allows Optional To open box Integer


0 and 1
to open the "1"
shipment at the
time of delivery

Optional
25 pieces_quantity To book a Integer Integer 1 to 10
shipment for between 1 to
multiple pieces. 10

be picked Optional be picked String Abdullah 1122


respect to his
26 shipper_reference_number shipment
_1

If Shipper Optional Character String Abdullah 1122


wants to add Limit: 190
27 shipper_reference_number any reference
_2 with respect to
his shipment

If Shipper wants Optional Character String Abdullah 1122


to add any Limit: 190
28 shipper_reference_number reference with
_3 respect to his
shipment
If Shipper wants Optional Character String Abdullah 1122
to add any Limit: 190
29 shipper_reference_number reference with
_4 respect to his
shipment

If Shipper Optional Character String Abdullah 1122


wants to add Limit: 190
30 shipper_reference_number any reference
_5 with respect to
his shipment

FOR REPLACEMENT SHIPMENTS

S.no Variable Description Condition Validation Format Sample


.
1 service_type_id Defines the service Mandatory Check Integer 2
that you are going to Appendix A
use i.e. Regular,
Replacement, or Try
& Buy

2 pickup_address_id The address from Mandatory Address Integer 123


which the shipment IDs can be
will be picked viewed
from
Addresses
API

3 information_display Option to show or Mandatory To hide Integer 0


hide your contact enter "0", to
details on the air show enter
waybill "1"

4 consignee_city_id Float ID of the city Mandatory City IDs Integer 202


where the shipment can be
will be delivered viewed
from City
List API .
Only cities
allotted for
the
subjected
service can
be added

5 consignee_name Name of the receiver Mandatory Character String Abdullah


to whom the limit: 100
shipment will be
delivered

6 consignee_address Address where the Mandatory Character String Shahra-e-


shipment delivered limit: 190 Faisal,
Karachi
7 consignee_phone_nu Phone Number of the Mandatory The Phone Phone 0300-
mber_1 receiver Number is Number 1234567
bound on
this format
i.e. 0300-
1234567

8 consignee_phone_nu Another Phone Optional The Phone Phone 0300-


mber_2 Number of the Number is Number 1234567
receiver bound on
this format
i.e. 0300-
1234567

9 consignee_email_add Email address of the Mandatory Email hello@trax.


ress coordinator for pickup pk

10 order_id Shipper's own Optional It must be String A-148


reference ID unique for
one
shipper.

Character
limit: 100

11 item_product_type_id Category of the Mandatory Check Integer 12


item(s) in the order to Appendix B
be delivered

12 item_description Nature and details of Mandatory Character String one black t


the item(s) in the limit: 190 shirt
order to be delivered medium

13 item_quantity Number of item(s) Mandatory Integer 2

14 item_insurance Provision to opt Mandatory This will Integer 0


Insurance claim in only be
case of loss of items valid for
customers
whose
insurance is
authorized
at the time
of account
opening, to
deselect
enter "0, to
select enter
"1"

15 item_price Value of the item(s) Mandatory Subjected Integer 100


in the ordesr to selecting
item_insura
nce

16 replacement_item_pr Category of the Mandatory Check Integer 11


oduct_type_id item(s) in the order to Appendix B
be exchanged
17 replacement_item_de Nature and details of Mandatory Character String one blue t
scription the item(s) in the limit: 190 shirt
order to be medium
exchanged

18 replacement_item_qu Number of item(s) Mandatory Integer 1


antity

19 Replacement_item_i Add replacement Optional Image Png,


mage image format Jpeg
required

20 special_instructions Any reference or Optional Character String Please call


remarks regarding limit: 250 before
the delivery Delivery

21 estimated_weight Estimated mass of Mandatory Please note Float 1.00


the shipment that this will
not be the
final weight
of the
shipment
and no
charges will
be
calculated
based on
this value

22 shipping_mode_id The method of Mandatory Check Integer 1


shipping through Appendix C
which the shipment
will be delivered

23 amount The amount to be Mandatory Do not use Integer 1000


collected at the time commas or
of delivery dots for this
parameter

24 charges_mode_id How the shipper Mandatory Check Integer 2 or 4 for


would want TRAX to Appendix F Reimburse
collect their service ment
charges, either from Account
the shipper or from type, 2 or 3
their consignees via for
2Pay option Invoicing
Account
type

25 payment_mode_id How the amount will Mandatory Check Integer 1


be collected, either Appendix D
COD, card or mobile
wallet

26 open_shipment Customer allows to Optional To open box Integer 0 and 1


open the shipment at
the time of delivery "1"

27 shipper_reference_nu If Shipper wants to Optional Character String Abdullah 11


mber_1 add any reference Limit: 190 22
with respect to his
shipment

28 shipper_reference_nu If Shipper wants to Optional Character String Abdullah 11


mber_2 add any reference Limit: 190 22
with respect to his
shipment

29 shipper_reference_nu If Shipper wants to Optional Character String Abdullah 11


mber_3 add any reference Limit: 190 22
with respect to his
shipment

30 shipper_reference_nu If Shipper wants to Optional Character String Abdullah 11


mber_4 add any reference Limit: 190 22
with respect to his
shipment

31 shipper_reference_nu If Shipper wants to Optional Character String Abdullah 11


mber_5 add any reference Limit: 190 22
with respect to his
shipment

FOR TRY & BUY SHIPMENTS

S.no Variable Description Condition Validation Format Sample


.
1 service_type_id Defines the service Mandatory Check Integer 3
that you are going Appendix A
to use i.e. Regular,
Replacement, or
Try & Buy

2 pickup_address_id The address from Mandatory Address Integer 123


which the shipment IDs can be
will be picked viewed
from
Addresses
API

3 information_display Option to show or Mandatory To hide Integer 0


hide your contact enter "0", to
details on the air show enter
waybill "1"
4 consignee_city_id Float ID of the city Mandatory City IDs Integer 202
where the shipment can be
will be delivered viewed
from City
List API .
Only cities
allotted for
the
subjected
service can
be added

5 consignee_name Name of the Mandatory Character String Abdullah


receiver to whom limit: 100
the shipment will be
delivered

6 consignee_address Address where the Mandatory Character String Shahra e


shipment will be limit: 190 Faisal,
delivered Karachi,
Pakistan

7 consignee_phone_n Phone Number of Mandatory The Phone Phone 0300-


umber_1 the receiver Number is Number 1234567
bound on
this format
i.e., 0300-
1234567

8 consignee_phone_n Another Phone Optional The Phone Phone 0300-


umber_2 Number of the Number is Number 1234567
receiver bound on
this format
i.e. 0300-
1234567

9 consignee_email_a Email address of Mandatory "@" is Email [email protected]


ddress the coordinator for mandatory k
pickup to add

10 order_id Shipper's own Optional It must be String A-148


reference ID unique for
one
shipper.

Character
limit: 100

11.1 items[n][item_produ Category of the Mandatory Check Integer 10


ct_type_id] item no. "n" in the Appendix B
order to be
delivered, where "n"
is any no. of items
in a Try & Buy
Shipment

11.2 items[n][item_descri Nature and details Mandatory Character String one black t
ption] of the item no. "n" limit: 190 shirt medium
in the order to be
delivered

11.3 items[n][item_quanti Number of item(s) Mandatory Integer 1


ty]

11.4 items[n][item_insura Provision to opt Mandatory This will Integer 1


nce] Insurance claim in only be
case of loss of valid for
items customers
whose
insurance is
authorized
at the time
of account
opening, to
deselect
enter "0", to
select enter
"1"

11.5 Items[n]product_val Put the value of Mandatory Integer 1000


ue each product

11.6 items[n][item_price] Value of the item Mandatory Subjected Integer 1000


no. "n" in the order to selecting
item_insura
nce

12 package_type Defines either the Mandatory For Integer 1


Try & Buy will be complete
complete i.e. all the enter "1",
items will be for partial
delivered or enter "2"
returned, or partial
i.e. some of the
items will be
delivered and
remaining will be
returned

13 pickup_date Date at which the Mandatory YYYY-MM- date 2018-08-07


order is requested DD
to be picked

15 try_and_buy_fess Fess that will Mandatory Integer 1000


charges consignee

16 special_instructions Any reference or Optional Character String Please call


remarks regarding limit: 190 before
the delivery delivery
17 estimated_weight Estimated mass of Mandatory Please note Float 1.05
the shipment that this will
not be the
final weight
of the
shipment
and no
charges will
be
calculated
based on
this value

18 shipping_mode_id The method of Mandatory Check Integer 1


shipping through Appendix C
which the shipment
will be delivered

19 amount The amount to be Mandatory Do not use Integer 1000


collected at the time commas or
of delivery dots for this
parameter

20 charges_mode_id How the shipper Mandatory Check Integer 2 or 4 for


would want TRAX Appendix F Reimbursem
to collect their ent Account
service charges, type, 2 or 3
either from the for Invoicing
shipper or from Account type
their consignees via
2Pay option

21 open_shipment Customer allows to Optional To open Integer 0 and 1


open the shipment box "1"
at the time of
delivery

22 payment_mode_id How the amount Mandatory Check Integer 1


will be collected, Appendix D
either COD, card or
mobile wallet

23 shipper_reference_ If Shipper wants to Optional Character String Abdullah 11


number_1 add any reference Limit: 190 22
with respect to his
shipment

24 shipper_reference_ If Shipper wants to Optional Character String Abdullah 11


number_2 add any reference Limit: 190 22
with respect to his
shipment

25 shipper_reference_ If Shipper wants to Optional Character String Abdullah 11


number_3 add any reference Limit: 190 22
with respect to his
shipment

26 shipper_reference_ If Shipper wants to Optional Character String Abdullah 11


number_4 add any reference Limit: 190 22
with respect to his
shipment

27 shipper_reference_ If Shipper wants to Optional Character String Abdullah 11


number_5 add any reference Limit: 190 22
with respect to his
shipment

RESULT
{
"status": 0,
"message": "Shipment has been Booked!",
"tracking number": “101101000405
}

NOTE
If you are using Corporate Invoicing Account. Please be informed that you have to provide the type of
delivery (Door-Step/Hub to Hub).

S.no. Variable Description Condition Validation Format Sample


Define the type of delivery
01 delivery_type_id that you are going to use Mandatory Input can be 1 Integer 1
• delivery_type_id = 1 OR 2
(Door
Step)
• delivery_type_id =
2 (Hub to Hub)
5. Current Status of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/status

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API.

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number generated Mandatory All digits Integer 101101000405


upon booking of the to be
shipment entered
2 type Defines the type of Mandatory Check Integer 0
status tracking, either for Appendix
shipper or general E

RESULT
{
"status": 0,
"message": "Status of Shipment#101101000392",
"current_status”:”Replacement-Exchanged”
}
6. Tracking of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/track

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

FOR SHIPPERS TRACKING

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number generated Mandatory All digits to Integer 202202366397


upon booking of the be entered
shipment
2 type Defines the type of status Mandatory Check Integer 0
tracking, either for Appendix E
shipper or general

RESULT

{
"status": 0,
"message": "Tracking of Shipment #202202366397",
"details": {
"tracking_number": "202202366397",
"order_id": null,
"shipper": {
"name": "SGK Enterprises",
"account_number": 10374,
"phone_number_1": "0349-1663481",
"phone_number_2": null,
"Email": "[email protected]",
"city": "Karachi"
},
"pickup": {
"origin": "Karachi",
"person_of_contact": "Sahban",
"phone_number": "0349-1330874",
"Email": "[email protected]",
"address": "Gulshan-e-Iqbal"
},
"consignee": {
"name": "saltanat",
"phone_number_1": "0312-2222222",
"phone_number_2": null,
"destination": "Karachi",
"address": "asfjkgasfkjh"
},
"order_information": {
"items": [
{
"order_id": null,
"product_type": "Personal Electronics (Mobile Phones, Laptops, etc
)",
"description": "1223xqw",
"quantity": 1
}
],
"weight": 2,
"shipping_mode": "Rush",
"amount": 0,
"instructions": null
},
"tracking_history": [
{
"date_time": "05/04/2022 12:44 PM",
"timestamp": 1649144698,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "05/04/2022 12:44 PM",
"timestamp": 1649144698,
"status": "Shipment - Delivery Unsuccessful",
"status_reason": "Address Incomplete"
},
{
"date_time": "01/04/2022 11:03 AM",
"timestamp": 1648793031,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "01/04/2022 11:03 AM",
"timestamp": 1648793031,
"status": "Shipment - Delivery Unsuccessful",
"status_reason": "Address Closed"
},
{
"date_time": "31/03/2022 02:41 PM",
"timestamp": 1648719671,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "31/03/2022 02:31 PM",
"timestamp": 1648719107,
"status": "Shipment - Arrived at Origin",
"status_reason": null
},
{
"date_time": "31/03/2022 02:31 PM",
"timestamp": 1648719071,
"status": "Shipment - Arrival Service Center",
"status_reason": null
},
{
"date_time": "31/03/2022 10:56 AM",
"timestamp": 1648706190,
"status": "Shipment - Booked",
"status_reason": null
}
]
}
}

FOR CONSIGNEES’ AND GENERAL TRACKING

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number generated Mandatory All digits to Integer 202202366397


upon booking of the be entered
shipment

2 type Defines the type of Mandatory Check Integer 1


status tracking, either Appendix E
for shipper or general
RESULT

{
"status": 0,
"message": "Tracking of Shipment #202202366397",
"details": {
"tracking_number": "202202366397",
"order_id": null,
"shipper": {
"name": "SGK Enterprises"
},
"pickup": {
"origin": "Karachi"
},
"consignee": {
"name": "saltanat",
"phone_number_1": "0312-2222222",
"phone_number_2": null,
"destination": "Karachi",
"address": "asfjkgasfkjh"
},
"order_information": {
"items": [
{
"order_id": null,
"product_type": "Personal Electronics (Mobile Phones, Laptops, etc
)",
"description": "1223xqw",
"quantity": 1
}
]
},
"tracking_history": [
{
"date_time": "05/04/2022 12:44 PM",
"timestamp": 1649144698,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "05/04/2022 12:44 PM",
"timestamp": 1649144698,
"status": "Shipment - Delivery Unsuccessful",
"status_reason": "Address Incomplete"
},
{
"date_time": "01/04/2022 11:03 AM",
"timestamp": 1648793031,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "01/04/2022 11:03 AM",
"timestamp": 1648793031,
"status": "Shipment - Delivery Unsuccessful",
"status_reason": "Address Closed"
},
{
"date_time": "31/03/2022 02:41 PM",
"timestamp": 1648719671,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "31/03/2022 02:31 PM",
"timestamp": 1648719107,
"status": "Shipment - Arrived at Origin",
"status_reason": null
},
{
"date_time": "31/03/2022 02:31 PM",
"timestamp": 1648719071,
"status": "Shipment - Arrival Service Center",
"status_reason": null
},
{
"date_time": "31/03/2022 10:56 AM",
"timestamp": 1648706190,
"status": "Shipment - Booked",
"status_reason": null
}
]
}
}
7.Charges of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/charges

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number generated Mandatory All digits to be Integer 202202366397


upon booking of the entered
shipment

RESULT

{
"status": 0,
"message": "Charges of Shipment #202202366397",
"charges": {
"weight_charges": "250.00",
"fuel_surcharge": "32.50",
"cash_handling_charges": "0.00",
"net_payable": "-319.23",
"total_charges": "282.50",
"gst": "36.73"
}
}
8. Payment Status of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/payment_status

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

S.no. Variable Description Condition Validation Format Sample

1 Tracking_number The number generated Mandatory All digits to be Integer 144154365851


upon booking of the entered
shipment

RESULT
{
"status": 0,
"message": "Payment Status of Shipment #144154365851",
"current_payment_status": "Payment - Processed"
}
9. Payment Details of a Shipment [Multiple]

METHOD -> GET

URL
https://sonic.pk/api/payments

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API. You can add multiple tracking numbers in array.

S.no. Variable Description Condition Validation Format Sample

1 tracking_number[] Input multiple Mandatory All digits to Integer 144154365851


tracking numbers be entered

RESULT

{
"status": 0,
"payments": {
"144154365851": [
{
"payment_status": "Processed",
"billing_method": "Reimbursement Account",
"payment_date": "2022-04-14 11:10:47",
"payment_method": "IBFT",
"payment_type": "Delivered",
"payment_id": 5463
}
]
}
}
9. Payment Details of a Shipment [Invoice]

METHOD -> GET

URL
https://sonic.pk/api/invoice

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

S.no. Variable Description Condition Validation Format Sample

All digits to be
1 id Invoice id and payment id Mandatory entered Integer 930

1 for invoice
2 type For Invoice 1 and for payment 2 Mandatory 2 for payment Integer 1, 2

RESULT

{
"status": 0,
"payments": {
"billing_method": "Corporate Invoicing Account",
"invoice_date": "2021-06-21 00:00:00",
"shipments": [
{
"202202360876": {
"payment_type": "Delivered",
"weight_charges": "500.00",
"cash_handling_charges": "0.00",
"insurance_charges": null,
"return_charges": 0,
"fuel_surcharge": "50.00",
"replacement_charges": null,
"try_and_buy_charges": null,
"intercept_charges": null,
"osa_charges": null,
"adjustment_charges": 0,
"total_charges": "550.00",
"gst": "71.50",
"invoice_amount": "621.50"
}
},
{
"202223364138": {
"payment_type": "Delivered",
"weight_charges": "999999.99",
"cash_handling_charges": null,
"insurance_charges": null,
"return_charges": 0,
"fuel_surcharge": null,
"replacement_charges": null,
"try_and_buy_charges": null,
"intercept_charges": null,
"osa_charges": null,
"adjustment_charges": 0,
"total_charges": "999999.99",
"gst": "130000.00",
"invoice_amount": "1129999.99"
}
}
]
}
}
10. Payment Details of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/payments

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number Mandatory All digits to Integer 202202364291


generated upon be entered
booking of the
shipment

RESULT

{
"status": 0,
"message": "Payment(s) of Shipment #202202364291",
"charges": {
"cash_handling_charges": "0.00"
},
"current_payment_status": "Payment - Processed",
"payments": [
{
"id": 5457,
"datetime": "2022-01-07 13:04:58",
"type": 0,
"amount": 1020,
"charges": "0.00",
"gst": "0.00",
"payable": "1020.00"
}
]
11.Printing Air waybill (Consignment Note) of a Shipment

METHOD -> GET

URL
https://sonic.pk/api/shipment/air_waybill

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API.

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number Mandatory All digits to be Integer 202202366396


generated upon entered
booking of the
shipment

2 type Type of print, whether Mandatory for jpeg, enter Integer 0


pdf or jpeg type=0, for pdf
enter type=1

RESULT
12. Cancelling a Booked Shipment

METHOD -> POST

URL
https://sonic.pk/api/shipment/cancel

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API.

S.no. Variable Description Condition Validation Format Sample

1 tracking_number The number generated Mandatory All digits to be Integer 202202366396


upon booking of the entered
shipment

RESULT

{
"status": 0,
"message": "Shipment #202202366396 is Cancelled"
}
13. Calculating the Rates for a Destination

METHOD -> POST

URL
https://sonic.pk/api/charges_calculate

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API.

S.no. Variable Description Condition Validation Format Sample

1 service_type_id Defines the service Mandatory Check Appendix A Integer 1


that you are going to
use i.e., Regular,
Replacement, or Try
& Buy
2 origin_city_id Float ID of the city Mandatory City IDs can be viewed Integer 202
from where the from City List API
shipment will be
picked
3 destination_city_id Float ID of the city Mandatory City IDs can be viewed Integer 202
from where the from City List API
shipment will be
picked
4 estimated_weight Estimated mass of Mandatory Please note that this Float 1.05
the shipment will not be the final
weight of the shipment
and no charges will be
calculated based on
this value
5 shipping_mode_id The method of Mandatory Check Appendix C Integer 1
shipping through
which the shipment
will be delivered
6 amount The amount to be Mandatory Do not use commas or Integer 1000
collected at the time dots for this parameter
of delivery
RESULT

{
"status": 0,
"message": "Charges Calculated",
"information": {
"origin": {
"city": "Karachi",
"zone": "South"
},
"destination": {
"city": "Karachi",
"class": "Local"
},
"charges": {
"weight": 250,
"cash_handling": 0,
"fuel_surcharge": 57.5,
"total_charges": 307.5,
"gst": 39.97,
"net_payable": 652.53
},
"chargeable_weight": 2
}
}
14. Creating a Receiving Sheet

METHOD -> POST

URL
https://sonic.pk/api/receiving_sheet/create

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API. You have to add multiple tracking numbers in array.

S.no. Parameter Description Condition Validation Format Sample

1 tracking_numbers[] The number generated Mandatory All digits to Integer 202202366396


upon booking of the be entered
shipment

2 tracking_numbers[] The number generated Mandatory All digits to Integer 202202366396


upon booking of the be entered
shipment

NOTE: Here, tracking numbers will be entered in an array i.e., multiple tracking numbers can be added

RESULT

{
"status": 0,
"message": "Receiving Sheet has been Created",
"receiving_sheet_id": 6158
}
15. View/Print a Receiving Sheet

METHOD -> GET

URL
https://sonic.pk/api/receiving_sheet/view

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API.

S.no. Variable Description Condition Validation Format Sample

1 receiving_sheet_id The number generated Mandatory All digits to be Integer 405


upon the creation of entered
receiving sheet
2 type Type of print, whether Mandatory for jpeg, enter Integer 0
pdf or jpeg type=0,

for pdf enter type=1

RESULT
16. Order ID Tracking

METHOD -> GET

URL
https://sonic.pk/api/shipment/track/order_id

HEADERS

Input Description

Authorization Authentication key which will be used for security


purposes

PARAMS

Add these variables and their values as ‘Params’ in the API

S.no. Variable Description Condition Format Sample

1 order_id The serials generated by user Mandatory Integer 405

2 type Defines the type of status tracking, either for shipper or Mandatory Integer 0
general

RESULT

{
"status": 0,
"message": "Tracking of Shipment(s) - Order ID #000654",
"details": [
{
"tracking_number": 144154365854,
"order_id": "000654",
"shipper": {
"name": "Digikhata.pk Test",
"account_number": 10372,
"phone_number_1": "0313-7979999",
"phone_number_2": null,
"Email": "[email protected]",
"city": "Faisalabad"
},
"pickup": {
"origin": "Faisalabad",
"person_of_contact": "Kashif Mehmood",
"phone_number": "03007749150",
"Email": "[email protected]",
"address": "Main bazar road block 3"
},
"consignee": {
"name": "ali raza",
"phone_number_1": "0304-4470811",
"phone_number_2": null,
"destination": "Gojra",
"address": "gojra dawakhri"
},
"order_information": {
"items": [
{
"order_id": "000654",
"product_type": "Other",
"description": "Eggs",
"quantity": 1
}
],
"weight": 1,
"shipping_mode": "Rush",
"amount": 3000,
"instructions": "handle"
},
"tracking_history": [
{
"date_time": "24/03/2022 03:54 PM",
"timestamp": 1648119261,
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "24/03/2022 03:46 PM",
"timestamp": 1648118780,
"status": "Shipment - Arrived at Origin",
"status_reason": null
},
{
"date_time": "24/03/2022 03:35 PM",
"timestamp": 1648118122,
"status": "Shipment - Booked",
"status_reason": null
}
}
]
}
17. Shipment Status by Order ID

METHOD -> GET

URL
https://sonic.pk/api/shipment/status/order_id

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

PARAMS

Add these variables and their values as ‘Params’ in the API.

S.no. Variable Description Condition Format Sample


1 order_id The serials generated by user Mandatory Integer 405

2 type Defines the type of status tracking, either for shipper or Mandatory Integer 0
general

RESULT

{
"status": 0,
"message": "Status of Shipment(s) - Order ID #03057171238",
"details": [
{
"origin": "Karachi",
"destination": "Lahore",
"tracking_number": 20222315751328,
"status": "Shipment - Out for Delivery",
"reason": null,
"current_status_datetime": "07/04/2022 01:49 PM"
}
]
}
18. Return Confirmation Pending Status

METHOD -> POST

URL
https://sonic.pk/api/request/rcp

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

S.no. Variable Condition Format Sample


1 tracking_number Mandatory Integer 564864998

2 type Mandatory Integer Check Appendix J

3 remarks Optional String remarks

RESULT

{
"status": 0,
"message": "Shipment successfully marked as Shipment - Return Confirm"
}
19. Re-attempted Requested Status

METHOD -> POST

URL
https://sonic.pk/api/request/rcp

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

S.no. Variable Condition Format Sample

1 tracking_number Mandatory Integer 435231300

2 type Mandatory Integer Check Appendix J

3 remarks Optional String Remarks

RESULT

{
"status": 0,
"message": "Shipment successfully updated as (Re-Attempt - Requested)"
}
20. Intercept/Rebook Request

METHOD -> POST

URL
HEADERS
https://sonic.pk/api/request/rcp

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

Parameters for consignee_type = 1

S.no. Variable Condition Format Sample

1 tracking_number Mandatory Integer 54546464

2 type Mandatory Integer Check Appendix J

3 remarks Optional String Remarks

4 consignee_address Mandatory String Address

5 consignee_type Mandatory Integer Check Appendix K

6 consignee_phone_number_1 Mandatory Number Format number


Parameters for consignee_type = 2

S.no. Variable Condition Format Sample

1 tracking_number Mandatory Integer 64564871

2 type Mandatory Integer Check Appendix J

3 remarks Optional String Remarks

4 consignee_address Mandatory String Block/ area no

5 consignee_phone_number_1 Mandatory Number Format 030055443

6 consignee_city_id Mandatory String Karachi

7 consignee_type Mandatory Integer Check Appendix K

7 consignee_name Mandatory String Name

8 amount Mandatory Integer 5400

9 consignee_phone_number_2 Optional Number Format 0300254978

RESULT

{
"status": 0,
"message": "Intercept/Re-Book request submitted against Tracking Number:
2022021723441"
}
21. CRM Request (Complaint)

METHOD -> POST

URL
https://sonic.pk/api/request/crm

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

S.no. Variable Condition Format Sample

1 case_nature_id Mandatory Integer Check Appendix H

2 tracking_number Mandatory Integer 564674891

3 case_nature_type_id Mandatory Integer Check Appendix I

4 description Mandatory String Description

RESULT

{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
22. CRM Request (Service Request)

METHOD -> POST

URL
https://sonic.pk/api/request/crm

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

S.no. Variable Condition Format Sample

1 case_nature_id Mandatory Integer Appendix I

2 tracking_number Mandatory Integer 564674891

3 case_nature_type_id Mandatory Integer Appendix J

4 description Mandatory String Description

RESULT

{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
23. CRM Request (Claim)

METHOD -> POST

URL
https://sonic.pk/api/request/crm

HEADERS

Input Description

Authorization Authentication key which will be used for security purposes

BODY

Add these variables and their values as ‘Body’ in the API

S.no. Variable Condition Format Sample

1 case_nature_id Mandatory Integer Appendix H

2 tracking_number Mandatory Integer 5468779845

3 case_nature_type_id Optional Integer Appendix I

4 description Mandatory String description

5 product_picture Should be image Image Image

6 invoice_picture Should be image Image Image

7 product_cost Mandatory Integer 300

8 damage_product_price Mandatory Integer Image

9 actual_product_picture Should be image Image Image

10 product_packaging_picture Should be image Image Image

11 damage_product_picture Should be image Image Image

12 missing_product_picture Should be image Image Image

13 missing_product_price Mandatory Integer 1256


RESULT

{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
24. Shipment Status Webhooks

Follow the steps below...

Click on the toggle to get start and enter the URL of your website.

You will get the current status in response like


{
‘tracking_number’ => ‘2232231721462’,
‘status’ => ‘Shipment-Arrived at origin’,
‘date_time’ => ‘2021-06-11’, ‘17:29:36’,
}

Important Points:

• System will attempt the request 5 times.


• Request time out is 3 seconds.
• After 5 attempts your subscription will be blocked and then again you must activate the subscription.
• Your URL should be active when you are activating the subscription.
25. Payment Status Webhooks

Follow the steps below...

Click on the toggle to get start and enter the URL of your website.

You will get the current status in response like


{

'tracking_number' => ‘2232231721462’,


'status' => ‘Payment-Processed’
'date_time' => ‘2021-06-11’, ‘17:29:36’,
'payment_id' => ‘123456’

Important Points:

• System will attempt the request 5 times.


• Request time out is 3 seconds.
• After 5 attempts your subscription will be blocked and then again you must activate the subscription.
• Your URL should be active when you are activating the subscription.
26. Initial Charges Webhooks

Follow the steps below...

Click on the toggle to get start and enter the URL of your website.

You will get the current status in response like


{
'tracking_number' => ‘2232231721462’,
'origin' => ‘Lahore’,
'destination' => ‘Lahore’,
'cod_amount' => ‘1000’,
'actual_weight' => ‘1.0’
'chargeable_weight' => ‘1.0’
'weight_charges' => ‘120’
'cash_handling_charges' => ‘0’
'insurance_charges' => ‘0’
'fuel_surcharges' => ‘12’
'gst' => ’15.86’
'total_charges' => ‘137.86’
'net_payable' => ‘862.14’
Important Points:

• System will attempt the request 5 times.


• Request time out is 3 seconds.
• After 5 attempts your subscription will be blocked and then again you must activate the subscription.
• Your URL should be active when you are activating the subscription.

27. Final Charges Webhooks

Follow the steps below...

Click on the toggle to get start and enter the URL of your website.

You will get the current status in response like


{
'tracking_number' => ‘2232231721462’,
'origin' => ‘Lahore’,
'destination' => ‘Lahore’,
'cod_amount' => ‘1000’
'actual_weight' => ‘1.0’
'chargeable_weight' => ‘1.0’
'weight_charges' => ‘120’
'cash_handling_charges' => ‘0’
'insurance_charges' => ‘0’
'fuel_surcharges' => ‘12’
'packaging_charges' => ‘0’
'return_charges' => ‘0’
'replacement_charges' => ‘0’
'try_buy_charges' => ‘0’
'intercept_charges' => ‘0’
'nsa_charges' => ‘0’
'gst' => ’15.86’
'total_charges' => ‘137.86’
'net_payable' => ‘862.14’

Important Points:

• System will attempt the request 5 times.


• Request time out is 3 seconds.
• After 5 attempts your subscription will be blocked and then again you must activate the subscription.
• Your URL should be active when you are activating the subscription.
Appendix A- Service Type (service_type_id)

ID Description

1 Regular

2 Replacement

3 Try & Buy

Appendix B – Item Product Type (item_product_type_id)

ID Description

1 Apparel

2 Automotive Parts

3 Accessories

4 Personal Electronics (Mobile Phones, Laptops, etc.)

5 Electronics Accessories (Cases, Chargers, etc.)

6 Gadgets

7 Jewellery

8 Cosmetics

9 Stationery

10 Handicrafts

11 Home-made Items

12 Footwear

13 Watches

14 Leather Items

15 Organic and Health Products

16 Appliances and Consumer Electronics

17 Home Decor and Interior Items

18 Toys

19 Pet Supplies
20 Athletics and Fitness Items

21 Vouchers and Coupons

22 Marketplace

23 Documents and Letters

24 Other

Appendix C – Shipping Mode (shipping_mode_id)

ID Description

1 Rush

2 Saver plus

3 Swift

4 Same day

Appendix D – Payment Mode (payment_mode_id)

ID Description
1 COD

2 CCD

4 Prepaid

Appendix E – Status Type (type)

ID Description
0 Shipper-related tracking (includes weight and payment
statuses)

1 General Tracking (for consignees, excludes weight and


payment statuses)
Appendix F – Mode of collecting Shipping Charges (charges_mode_id)

ID Description
3 Invoicing; Note: This mode is only acceptable for a
Corporate Invoicing Account (the account type where
the charges are being invoiced to the shipper and the
shipper would pay the charges on that invoice
4 Reimbursement; Note: This mode is only acceptable
for Reimbursement Account (the account type where
the charges are being deducted during payment of
COD amounts)

Appendix G – Delivery Type (delivery_type_id)

ID Description

1 Doorstep

2 Hub to Hub

Appendix H – Case Nature(case_nature_id)

ID Description

1 Complaint

2 Service Request

4 Claim

Appendix I – Case Nature Type (case_nature_type_id)

ID Case Nature ID Case Nature Type

1 1 Payments

2 1 Delay in Delivery

3 1 Delay in Pickup

4 1 Incorrect COD

5 1 Return

6 1 Courier Misbehavior

7 1 Wrong COD
8 1 Booking Portal Issue

9 1 Other

10 1 Fake Reason

11 2 Address Change

12 2 COD Change

13 2 Alternate Contact Number

14 2 Urgent Delivery

15 1 Flyers

16 1 Product/Quality Issue

17 2 Intercept

18 1 Short Contents

19 1 Wrong Delivery/Misroute

20 2 Hold for Self-Collection

21 4 Shipment Damage

22 4 Content Short

23 4 Lost

24 4 Theft & Snatching

25 4 Tariff

26 4 Weight Disputes

27 1 Open Parcel

28 1 Open Parcel Complaint

29 4 Open Parcel Claim

30 1 Issue with Salesperson

31 1 Sales Lead

32 2 Allow to Open Shipment


Appendix J – Status Type (type)

ID Description

1 Return Confirm

2 Re-Attempt Request

3 Intercept / Rebook

Appendix K – Consignee Type (consignee_type)

ID Description

1 Same Consignee

2 Different Consignee

You might also like