Sonic API Documentation Overview
Sonic API Documentation Overview
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
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
URL
https://sonic.pk/api/pickup_address/add
HEADERS
Input Description
BODY
i.e.,03001234567
Email address of the
3 Email_address coordinator for Mandatory Email [email protected]
pickup
RESULT
{
"status": 0,
"message": "Pickup Address has been added",
"id": 3015
}
2.List of Pickup Addresses
URL
https://sonic.pk/api/pickup_addresses
HEADERS
Input Description
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
URL
https://sonic.pk/api/cities
HEADERS
Input Description
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
URL
https://sonic.pk/api/shipment/book
HEADERS
Input Description
BODY
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
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"
Optional
25 pieces_quantity To book a Integer Integer 1 to 10
shipment for between 1 to
multiple pieces. 10
Character
limit: 100
Character
limit: 100
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
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).
URL
https://sonic.pk/api/shipment/status
HEADERS
Input Description
PARAMS
RESULT
{
"status": 0,
"message": "Status of Shipment#101101000392",
"current_status”:”Replacement-Exchanged”
}
6. Tracking of a Shipment
URL
https://sonic.pk/api/shipment/track
HEADERS
Input Description
PARAMS
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
}
]
}
}
{
"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
URL
https://sonic.pk/api/shipment/charges
HEADERS
Input Description
PARAMS
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
URL
https://sonic.pk/api/shipment/payment_status
HEADERS
Input Description
PARAMS
RESULT
{
"status": 0,
"message": "Payment Status of Shipment #144154365851",
"current_payment_status": "Payment - Processed"
}
9. Payment Details of a Shipment [Multiple]
URL
https://sonic.pk/api/payments
HEADERS
Input Description
PARAMS
Add these variables and their values as ‘Params’ in the API. You can add multiple tracking numbers in array.
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]
URL
https://sonic.pk/api/invoice
HEADERS
Input Description
PARAMS
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
URL
https://sonic.pk/api/shipment/payments
HEADERS
Input Description
PARAMS
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
URL
https://sonic.pk/api/shipment/air_waybill
HEADERS
Input Description
PARAMS
RESULT
12. Cancelling a Booked Shipment
URL
https://sonic.pk/api/shipment/cancel
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "Shipment #202202366396 is Cancelled"
}
13. Calculating the Rates for a Destination
URL
https://sonic.pk/api/charges_calculate
HEADERS
Input Description
BODY
{
"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
URL
https://sonic.pk/api/receiving_sheet/create
HEADERS
Input Description
BODY
Add these variables and their values as ‘Body’ in the API. You have to add multiple tracking numbers in array.
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
URL
https://sonic.pk/api/receiving_sheet/view
HEADERS
Input Description
PARAMS
RESULT
16. Order ID Tracking
URL
https://sonic.pk/api/shipment/track/order_id
HEADERS
Input Description
PARAMS
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
URL
https://sonic.pk/api/shipment/status/order_id
HEADERS
Input Description
PARAMS
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
URL
https://sonic.pk/api/request/rcp
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "Shipment successfully marked as Shipment - Return Confirm"
}
19. Re-attempted Requested Status
URL
https://sonic.pk/api/request/rcp
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "Shipment successfully updated as (Re-Attempt - Requested)"
}
20. Intercept/Rebook Request
URL
HEADERS
https://sonic.pk/api/request/rcp
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "Intercept/Re-Book request submitted against Tracking Number:
2022021723441"
}
21. CRM Request (Complaint)
URL
https://sonic.pk/api/request/crm
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
22. CRM Request (Service Request)
URL
https://sonic.pk/api/request/crm
HEADERS
Input Description
BODY
RESULT
{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
23. CRM Request (Claim)
URL
https://sonic.pk/api/request/crm
HEADERS
Input Description
BODY
{
"status": 0,
"message": "CRM Request has been added",
"id": 533
}
24. Shipment Status Webhooks
Click on the toggle to get start and enter the URL of your website.
Important Points:
Click on the toggle to get start and enter the URL of your website.
Important Points:
Click on the toggle to get start and enter the URL of your website.
Click on the toggle to get start and enter the URL of your website.
Important Points:
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
20 Athletics and Fitness Items
22 Marketplace
24 Other
ID Description
1 Rush
2 Saver plus
3 Swift
4 Same day
ID Description
1 COD
2 CCD
4 Prepaid
ID Description
0 Shipper-related tracking (includes weight and payment
statuses)
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)
ID Description
1 Doorstep
2 Hub to Hub
ID Description
1 Complaint
2 Service Request
4 Claim
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
14 2 Urgent Delivery
15 1 Flyers
16 1 Product/Quality Issue
17 2 Intercept
18 1 Short Contents
19 1 Wrong Delivery/Misroute
21 4 Shipment Damage
22 4 Content Short
23 4 Lost
25 4 Tariff
26 4 Weight Disputes
27 1 Open Parcel
31 1 Sales Lead
ID Description
1 Return Confirm
2 Re-Attempt Request
3 Intercept / Rebook
ID Description
1 Same Consignee
2 Different Consignee