Professional Documents
Culture Documents
Sonic
By
Version 1.8
October 11 , 2019
Table of Contents
(a) Pre Requisites:
Testing URL
How to get API Authorization Key
1. Add a Pickup Address
Method
Headers
Parameters
Result
2. List of Pickup Addresses
Method
Headers
Result
3. City List and Information
Method
Headers
Result
4. Book a Shipment
Method
Headers
Parameters
For Regular Shipments
For Replacement Shipments
For Try & Buy Shipments
Result
5. Current Status of a Shipment
Method
Headers
Parameters
Result
6. Tracking of a Shipment
Method
Headers
Parameters
For Shippers' Tracking
Result
For Consignees' and general tracking
Result
7. Charges of a Shipment
Method
Headers
Parameters
Result
8. Payment Status of a Shipment
Method
Headers
Parameters
Result
9. Payment Details of a Shipment
Method
Headers
Parameters
Result
10. Printing Air waybill(Consignment Note) of a Shipment
Method
Headers
Parameters
Result
11. Cancelling a booked shipment
Method
Headers
Parameters
Result
12. Calculating the rates for a destination
Method
Headers
Parameters
Result
13. Creating a Receiving Sheet
Method
Headers
Parameters
Result
14. View/Print a Receiving Sheet
Method
Headers
Parameters
Result
15. Public Tracking
Method
Parameters
Result
Appendix A - Service Type (service_type_id)
Appendix B - Item Product Type (item_product_type_id)
Appendix C - Shipping Mode (shipping_mode_id)
Appendix D - Payment Mode (payment_mode_id)
Appendix E - Status Type (type)
Appendix F - Mode of collecting Shipping Charges (charges_mode_id)
(a) Pre Requisites:
TESTING URL
Live: https://sonic.pk
Testing: https://app.sonic.pk
On the header section of the portal, go for the profile option at the top-right (by clicking on the company name).
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
PARAMETERS
1 person_of_contact Name of the person who will be Mandatory Character limit: 100 string Ali baba
coordinating for pickup
2 phone_number Phone number of the coordinator for Mandatory The phone number is phone number 0300-1234567
pickup bound on this format
i.e. 0300-1234567
4 address The address from which the shipment will Mandatory Character limit: 190 string Shahrae Faisal,
be picked Karachi, Pakistan
5 city_id float ID of the city from where the Mandatory City IDs can be viewed integer 202
shipment will be picked from City List API
RESULT
{
"status": 0,
"message": "Pickup Address has been added",
"id": 487
}
METHOD
GET
URL
https://sonic.pk/api/pickup_addresses
HEADERS
Input Description
RESULT
{
"status": 0,
"message": "Pickup Addresses",
"pickup_addresses": [
{
"id": 469,
"person_of_contact": "Maynard Hackett",
"phone_number": "(239) 424-8817 x537",
"email_address": "jabshire@harvey.com",
"address": "6878 Brennon Brooks\nTeresafurt, LA 14236",
"city": {
"id": 202,
"name": "Karachi"
}
},
{
"id": 476,
"person_of_contact": "Ali Zafar",
"phone_number": "0347-2400094",
"email_address": "danish.zahid@hotmail.com",
"address": "B-13 Block 13",
"city": {
"id": 174,
"name": "Islamabad"
}
}
}
3. City List and Information
METHOD
GET
URL
https://sonic.pk/api/cities
HEADERS
Input Description
RESULT
{
"status": 0,
"message": "Pickup and Delivery Information of Cities",
"cities": [
{
"id": 100,
"name": "Karachi",
"pickup": true,
"delivery": {
"Regular": [
"Overnight",
"Overland",
"Detain",
"Same-day"
]
}
},
{
"id": 101,
"name": "Abbottabad",
"pickup": true,
"delivery": {
"Regular": [
"Overnight"
],
"Replacement": [
"Overland"
],
"Try & Buy": [
"Overnight"
]
}
},
}
4. Book a Shipment
METHOD
POST
URL
https://sonic.pk/api/shipment/book
HEADERS
Input Description
PARAMETERS
1 service_type_id Defines the service that you are going to Mandatory Check Appendix A integer 1
use i.e. Regular, Replacement, or Try &
Buy
2 pickup_address_id The address from which the shipment will Mandatory Address IDs can be viewed integer 123
be picked from Addresses API
3 information_display Option to show or hide your contact Mandatory To hide enter "0", to show integer 0
details on the air waybill enter "1"
4 consignee_city_id float ID of the city where the shipment will Mandatory City IDs can be viewed integer 202
be delivered from City List API . Only
cities allotted for the
subjected service can be
added
5 consignee_name Name of the receiver to whom the Mandatory Character limit: 100 string Abdullah
shipment will be delivered
6 consignee_address Address where the shipment will be Mandatory Character limit: 190 string Shahrae Faisal,
delivered Karachi, Pakistan
7 consignee_phone_number_1 Phone number of the receiver Mandatory The phone number is phone 0300-1234567
bound on this format number
i.e. 0300-1234567
8 consignee_phone_number_2 Another phone number of the receiver Optional The phone number is phone 0300-1234567
bound on this format number
i.e. 0300-1234567
10 order_id Shipper's own reference ID Optional It must be unique for one string A-148
shipper.
11 item_product_type_id Category of the item(s) in the order to be Mandatory Check Appendix B integer 12
delivered
12 item_description Nature and details of the item(s) in the Mandatory Character limit: 190 string one black t shirt
order to be delivered medium
14 item_insurance Provision to opt Insurance claim in case Mandatory This will only be valid for integer 0
of loss of items 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) in the order Optional Subjected to selecting integer 1000
item_insurance
16 pickup_date Date at which the order is requested to Mandatory YYYY-MM-DD date 2018-08-07
be picked
17 special_instructions Any reference or remarks regarding the Optional string Please call before
delivery delivery
18 estimated_weight Estimated mass of the shipment Mandatory Please note that this will float 1.05
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 shipping through which Mandatory Check Appendix C integer 1
the shipment will be delivered
20 same_day_timing_id For same-day shipping mode, define the Optional For "6 hours" enter "1", integer 1
timeline in which the shipment will be
delivered For "Same-day" enter "2"
21 amount The amount to be collected at the time of Mandatory Do not use commas or integer 1000
delivery dots for this parameter
22 payment_mode_id How the amount will be collected, either Mandatory Check Appendix D integer 1
COD, card or mobile wallet
23 charges_mode_id How the shipper would want TRAX to Mandatory Check Appendix F integer 2 or 4 for
collect their service charges, either from Reimbursement
the shipper or from their consignees via Account type, 2 or
2Pay option 3 for Invoicing
Account type
1 service_type_id Defines the service that you are Mandatory Check Appendix A integer 2
going to use i.e. Regular,
Replacement, or Try & Buy
2 pickup_address_id The address from which the Mandatory Address IDs can be integer 123
shipment will be picked viewed from Addresses
API
3 information_display Option to show or hide your contact Mandatory To hide enter "0", to show integer 0
details on the air waybill enter "1"
4 consignee_city_id float ID of the city where the Mandatory City IDs can be viewed integer 202
shipment will be delivered from City List API . Only
cities allotted for the
subjected service can be
added
5 consignee_name Name of the receiver to whom the Mandatory Character limit: 100 string Abdullah
shipment will be delivered
6 consignee_address Address where the shipment will be Mandatory Character limit: 190 string Shahrae Faisal,
delivered Karachi, Pakistan
7 consignee_phone_number_1 Phone number of the receiver Mandatory The phone number is phone 0300-1234567
bound on this format number
i.e. 0300-1234567
8 consignee_phone_number_2 Another phone number of the Optional The phone number is phone 0300-1234567
receiver bound on this format number
i.e. 0300-1234567
9 consignee_email_address Email address of the coordinator for Mandatory email hello@trax.pk
pickup
10 order_id Shipper's own reference ID Optional It must be unique for one string A-148
shipper.
11 item_product_type_id Category of the item(s) in the order to Mandatory Check Appendix B integer 12
be delivered
12 item_description Nature and details of the item(s) in Mandatory Character limit: 190 string one black t shirt
the order to be delivered medium
14 item_insurance Provision to opt Insurance claim in Mandatory This will only be valid for integer 0
case of loss of items 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) in the order Mandatory Subjected to selecting integer 100
item_insurance
16 replacement_item_product_type_id Category of the item(s) in the order to Mandatory Check Appendix B integer 11
be exchanged
17 replacement_item_description Nature and details of the item(s) in Mandatory Character limit: 190 string one blue t shirt
the order to be exchanged medium
19 pickup_date Date at which the order is requested Mandatory YYYY-MM-DD date 2018-08-07
to be picked
20 special_instructions Any reference or remarks regarding Optional Character limit: 250 string Please call before
the delivery Delivery
21 estimated_weight Estimated mass of the shipment Mandatory Please note that this will float 1.00
not be the final weight of
the shipment and no
charges will be calculated
based on this value
23 amount The amount to be collected at the Mandatory Do not use commas or integer 1000
time of delivery dots for this parameter
24 charges_mode_id How the shipper would want TRAX to Mandatory Check Appendix F integer 2 or 4 for
collect their service charges, either Reimbursement
from the shipper or from their Account type, 2
consignees via 2Pay option or 3 for Invoicing
Account type
25 payment_mode_id How the amount will be collected, Mandatory Check Appendix D integer 1
either COD, card or mobile wallet
1 service_type_id Defines the service that you are going to Mandatory Check Appendix A integer 3
use i.e. Regular, Replacement, or Try &
Buy
2 pickup_address_id The address from which the shipment Mandatory Address IDs can be integer 123
will be picked viewed from Addresses
API
3 information_display Option to show or hide your contact Mandatory To hide enter "0", to show integer 0
details on the air waybill enter "1"
4 consignee_city_id float ID of the city where the shipment Mandatory City IDs can be viewed integer 202
will be delivered from City List API . Only
cities allotted for the
subjected service can be
added
5 consignee_name Name of the receiver to whom the Mandatory Character limit: 100 string Abdullah
shipment will be delivered
6 consignee_address Address where the shipment will be Mandatory Character limit: 190 string Shahrae Faisal,
delivered Karachi, Pakistan
7 consignee_phone_number_1 Phone number of the receiver Mandatory The phone number is phone 0300-1234567
bound on this format number
i.e. 0300-1234567
8 consignee_phone_number_2 Another phone number of the receiver Optional The phone number is phone 0300-1234567
bound on this format number
i.e. 0300-1234567
9 consignee_email_address Email address of the coordinator for Mandatory "@" is mandatory to add email hello@trax.pk
pickup
10 order_id Shipper's own reference ID Optional It must be unique for one string A-148
shipper.
11.1 items[n][item_product_type_id] Category of the item no. "n" in the order Mandatory Check Appendix B integer 10
to be delivered, where "n" is any no. of
items in a Try & Buy Shipment
11.2 items[n][item_description] Nature and details of the item no. "n" in Mandatory Character limit: 190 string one black t shirt
the order to be delivered medium
11.4 items[n][item_insurance] Provision to opt Insurance claim in case Mandatory This will only be valid for integer 1
of loss of items customers whose
insurance is authorized at
the time of account
opening, to deselect enter
"0", to select enter "1"
11.5 items[n][item_price] Value of the item no. "n" in the order Mandatory Subjected to selecting integer 1000
item_insurance
12 package_type Defines either the Try & Buy will be Mandatory For complete enter "1", for integer 1
complete i.e. all the items will be partial enter "2"
delivered or returned, or partial i.e.
some of the items will be delivered and
remaining will be returned
13 pickup_date Date at which the order is requested to Mandatory YYYY-MM-DD date 2018-08-07
be picked
14 special_instructions Any reference or remarks regarding the Optional Character limit: 190 string Please call before
delivery delivery
15 estimated_weight Estimated mass of the shipment Mandatory Please note that this will float 1.05
not be the final weight of
the shipment and no
charges will be calculated
based on this value
16 shipping_mode_id The method of shipping through which Mandatory Check Appendix C integer 1
the shipment will be delivered
17 amount The amount to be collected at the time Mandatory Do not use commas or integer 1000
of delivery dots for this parameter
18 charges_mode_id How the shipper would want TRAX to Mandatory Check Appendix F integer 2 or 4 for
collect their service charges, either from Reimbursement
the shipper or from their consignees via Account type, 2 or
2Pay option 3 for Invoicing
Account type
19 payment_mode_id How the amount will be collected, either Mandatory Check Appendix D integer 1
COD, card or mobile wallet
RESULT
{
"status": 0,
"message": "Shipment has been Booked!",
"tracking_number": "101101000405"
}
METHOD
GET
URL
https://sonic.pk/api/shipment/status
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
2 type Defines the type of status tracking, either for shipper or Mandatory Check Appendix E integer 0
general
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
PARAMETERS
1 tracking_number The number generated upon booking of the Mandatory All digits to be entered integer 101101000405
shipment
2 type Defines the type of status tracking, either for Mandatory Check Appendix E integer 1
shipper or general
RESULT
{
"status": 0,
"message": "Tracking of Shipment #101101000392",
"details": {
"tracking_number": "101101000392",
"shipper": {
"name": "Reinger LLC",
"account_number": 99,
"phone_number_1": "0347-2400094",
"phone_number_2": "727.986.0699 x14725",
"address": "1700 Johnnie Pass Suite 867\nTrentonside, NH 90273-5120",
"origin": "Karachi"
},
"consignee": {
"name": "danish",
"phone_number_1": "0347-2400094",
"phone_number_2": null,
"destination": "Abbottabad",
"address": "Home"
},
"order_information": {
"items": [
{
"product_type": "Electronics Accessories (Cases, Chargers etc)",
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"quantity": 10
},
{
"product_type": "Accessories",
"description": null,
"quantity": 3
}
],
"weight": 2,
"instructions": "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
},
"tracking_history": [
{
"date_time": "13/08/2018 04:30 PM",
"status": "Shipment - Booked",
"status_reason": null
},
{
"date_time": "13/08/2018 04:31 PM",
"status": "Shipment - Arrived at Origin Center",
"status_reason": null
},
{
"date_time": "13/08/2018 04:33 PM",
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "13/08/2018 04:34 PM",
"status": "Replacement - Exchanged",
"status_reason": null
},
{
"date_time": "13/08/2018 04:45 PM",
"status": "Payment - Processed",
"status_reason": null
},
{
"date_time": "13/08/2018 04:46 PM",
"status": "Payment - Adjusted",
"status_reason": null
}
]
}
}
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
2 type Defines the type of status tracking, either for shipper or general Mandatory Check Appendix E integer 1
RESULT
{
"status": 0,
"message": "Tracking of Shipment #101101000392",
"details": {
"tracking_number": "101101000392",
"shipper": {
"name": "Reinger LLC",
"origin": "Karachi"
},
"consignee": {
"name": "danish",
"phone_number_1": "0347-2400094",
"phone_number_2": null,
"destination": "Abbottabad",
"address": "Home"
},
"order_information": {
"items": [
{
"product_type": "Electronics Accessories (Cases, Chargers etc)",
"description": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"quantity": 10
},
{
"product_type": "Accessories",
"description": null,
"quantity": 3
}
]
},
"tracking_history": [
{
"date_time": "13/08/2018 04:30 PM",
"status": "Shipment - Booked",
"status_reason": null
},
{
"date_time": "13/08/2018 04:31 PM",
"status": "Shipment - Arrived at Origin Center",
"status_reason": null
},
{
"date_time": "13/08/2018 04:33 PM",
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "13/08/2018 04:34 PM",
"status": "Replacement - Exchanged",
"status_reason": null
}
]
}
}
7. Charges of a Shipment
METHOD
GET
URL
https://sonic.pk/api/shipment/charges
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
RESULT
{
"status": 0,
"message": "Charges of Shipment #223174000568",
"charges": {
"weight_charges": "580.00",
"cash_handling_charges": "0.00"
}
}
8. Payment Status of a Shipment
METHOD
GET
URL
https://sonic.pk/api/shipment/payment_status
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
RESULT
{
"status": 0,
"message": "Payment Status of Shipment #223174000568",
"current_payment_status": "Payment - Processed"
}
METHOD
GET
URL
https://sonic.pk/api/shipment/payments
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
RESULT
{
"status": 0,
"message": "Payment(s) of Shipment #202202004594",
"charges": {
"cash_handling_charges": "50",
"fuel_surcharge": "40"
},
"current_payment_status": "Payment - Processed",
"payments": [
{
"id": 14,
"datetime": "2019-04-16 11:52:58",
"type": 0,
"amount": 600,
"charges": "90",
"gst": "19",
"payable": "709.00"
}
]
}
METHOD
GET
URL
https://sonic.pk/api/shipment/air_waybill
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
2 type type of print, whether pdf or jpeg Mandatory for jpeg, enter type=0, Integer 0
RESULT
11. Cancelling a booked shipment
METHOD
POST
URL
https://sonic.pk/api/shipment/cancel
HEADERS
Input Description
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
RESULT
{
"status": 0,
"message": "Shipment #202101000084 is Cancelled"
}
METHOD
POST
URL
https://sonic.pk/api/charges_calculate
HEADERS
Input Description
PARAMETERS
5 origin_city_id float ID of the city from where the shipment will be Mandatory City IDs can be viewed integer 202
picked from City List API
5 destination_city_id float ID of the city from where the shipment will be Mandatory City IDs can be viewed integer 202
picked from City List API
18 estimated_weight Estimated mass of the shipment Mandatory Please note that this float 1.05
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 shipping through which the shipment Mandatory Check Appendix C integer 1
will be delivered
21 amount The amount to be collected at the time of delivery Mandatory Do not use commas or integer 1000
dots for this parameter
RESULT
{
"status": 0,
"message": "Charges Calculated",
"information": {
"origin": {
"city": "Karachi",
"zone": "South"
},
"destination": {
"city": "Vehari",
"class": "C"
},
"charges": {
"weight": 0,
"cash_handling": 0,
"fuel_surcharge": 0
},
"chargeable_weight": "1"
}
}
METHOD
POST
URL
https://sonic.pk/api/receiving_sheet/create
HEADERS
Input Description
Authorization Authentication key which will be used for security purposes
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
n tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
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": 7
}
METHOD
GET
URL
https://sonic.pk/api/receiving_sheet/view
HEADERS
Input Description
PARAMETERS
1 receiving_sheet_id The number generated upon the creation of receiving sheet Mandatory All digits to be entered integer 405
2 type type of print, whether pdf or jpeg Mandatory for jpeg, enter type=0, Integer 0
RESULT
15. Public Tracking
METHOD
GET
URL
https://sonic.pk/api/shipment/track/public
PARAMETERS
1 tracking_number The number generated upon booking of the shipment Mandatory All digits to be entered integer 101101000405
RESULT
{
"status": 0,
"message": "Tracking of Shipment #223251357322",
"details": {
"tracking_number": "223251357322",
"shipper": {
"name": "Cross Stitch"
},
"pickup": {
"origin": "Lahore"
},
"consignee": {
"name": "Testing 2",
"phone_number_1": "0345-2109312",
"phone_number_2": null,
"destination": "Multan",
"address": "Testing 2"
},
"order_information": {
"items": [
{
"order_id": null,
"product_type": "Apparel",
"description": "No",
"quantity": 1
}
]
},
"tracking_history": [
{
"date_time": "16/04/2019 06:09 PM",
"status": "Return - Confirm",
"status_reason": null
},
{
"date_time": "16/04/2019 06:07 PM",
"status": "Intercept Requested",
"status_reason": null
},
{
"date_time": "16/04/2019 05:45 PM",
"status": "Return - Confirmation Pending",
"status_reason": null
},
{
"date_time": "16/04/2019 05:43 PM",
"status": "Shipment - Out for Delivery",
"status_reason": null
},
{
"date_time": "16/04/2019 05:43 PM",
"status": "Shipment - Arrived at Destination",
"status_reason": null
},
{
"date_time": "16/04/2019 05:41 PM",
"status": "Shipment - In Transit",
"status_reason": null
},
{
"date_time": "16/04/2019 05:17 PM",
"status": "Shipment - Arrived at Origin",
"status_reason": null
},
{
"date_time": "16/04/2019 05:12 PM",
"status": "Shipment - Booked",
"status_reason": null
}
]
}
}
Appendix A - Service Type (service_type_id)
ID Description
1 Regular
2 Replacement
ID Description
1 Apparel
2 Automotive Parts
3 Accessories
6 Gadgets
7 Jewellery
8 Cosmetics
9 Stationery
10 Handicrafts
11 Home-made Items
12 Footwear
13 Watches
14 Leather Items
18 Toys
19 Pet Supplies
22 Marketplace
24 Other
ID Description
1 Overnight
2 Overland
3 Detain
4 Same-day
ID Description
1 COD
2 Card
3 Mobile
ID Description
ID Description
2 2Pay i.e. from the consignee (which would be added with the COD amount)
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)