Introduction

This page will guide you on how to start your Journey as Blinkco developer

To integrate with our API, you will need to obtain a username and password from our company, Blink. These credentials will serve as your authentication information for making API requests.

Follow these steps to acquire the necessary credentials:

  1. Contact our company, Blink, to express your interest in integrating with our API. You can reach out to our support team or designated API contact for assistance.
  2. Provide the required details about your application and the purpose of integration. This information will help us understand your specific needs and ensure a smooth integration process.
  3. Once your request is approved, we will provide you with a unique username and password. These credentials will be associated with your account and grant you access to our API.
  4. Safeguard your username and password as confidential information. Treat them with the same level of security as you would for other sensitive credentials associated with your application.
  5. You are now ready to proceed with integrating our API into your application. Include the provided username and password in your API requests as part of the authentication process. This will validate your identity and allow you to access the desired API endpoints.

Note: It is important to keep your credentials secure and avoid sharing them with unauthorized individuals. If you suspect any compromise or unauthorized access to your credentials, contact our support team immediately to take appropriate actions.

Base_url For Live/Sandbox

  • Production API Base URL: api.blinkco.io
  • Sandbox API Base URL: stg-api.blinkco.io

Autorization API

The Autorization API allows you to interact with Blink API's.

Endpoint

POST /interface/v1/login

Requesting Access Token

Parameter Type Required Description
username string required Blink will provide the required username.
password string required Blink will provide the required password.

Sample Payload

    {
        "username": "xxxxxxxxx",
        "password": xxxxxxxxx
    }

Sample Response

    {
        "token_type": "Bearer",
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9....."
    }

If your request to get access token is valid, the authorization server will return an access token. If your request is invalid, the authorization server will return an error message

Sample Request with Authorization Header

    curl -X GET \
        URL/interface/v1/branches \
        -H 'Authorization: Bearer eyJ0eXAiOiJKV1Qi...' \
        -H 'Content-Type: application/json'

Import Menu

The Products API allows you to manage products in your restaurant's menu.

Create a Product

The Menu Sync API allows you to synchronize your local menu data with our system. By sending the menu data in the specified format, you can update, add, or remove menu items from your account.

Endpoint

POST /interface/v1/importMenu

Request Parameters

Parameter Type Required Description
products array required An array containing the details of the products.
products.id string required The ID of the product.
products.sku string required The SKU (Stock Keeping Unit) of the product.
products.name string required The name of the product.
products.description string nullable The description of the product.
products.tags string nullable The tags of the product help in searching.
products.uom string nullable The unit of measure of the product.
products.image string nullable The URL of the product image.
products.is_active boolean required Specifies whether the product is active or not.
products.price decimal required The price of the product.
products.branches array nullable An array containing the branches associated with the product.
products.branches.id string required The ID of the branch.
products.branches.is_active boolean required Specifies whether the branch is active or not.
products.branches.price decimal sometimes The price of the product in the specific branch (null if price is same).
products.branches.stock_qunatity integer sometimes The stock of the product in the specific branch.
products.category.id string required The ID of the category.
products.category.name string required The name of the category.
products.category.reference string nullable The reference of the category.
products.modifiers array nullable An array containing the modifiers associated with the product.
products.modifiers.id string required_with: products.modifiers The ID of the modifier.
products.modifiers.name string required_with: products.modifiers The name of the modifier.
products.modifiers.maximum_options integer required_with: products.modifiers The maximum number of options allowed for the modifier.
products.modifiers.priority integer required_with: products.modifiers The priority of the modifier.
products.modifiers.options array required_with: products.modifiers An array containing the options associated with the modifier.
products.modifiers.options.id string required_with: products.modifiers The ID of the option.
products.modifiers.options.name string required_with: products.modifiers The name of the option.
products.modifiers.options.is_active boolean required_with: products.modifiers Specifies whether the option is active or not.
products.modifiers.options.priority integer required_with: products.modifiers The priority of the option.
products.modifiers.options.branches array nullable An array containing the branches associated with the option.
products.modifiers.options.branches.id string required_with: products.modifiers. options.branches The ID of the branch.

Sample Payload

    {
        "products": [
            {
                "category": {
                    "id": "97358e65-33c9-400c-af7d-b43a95726e08",
                    "name": "pizza",
                    "reference": "2",
                    "image": null,
                    "deleted_at": null
                },
                "modifiers": [],
                "id": "97358ea0-242f-4ffa-818f-ab07c441c291",
                "sku": "sk-0004",
                "name": "ranch pizza",
                "description": null,
                "image": null,
                "is_active": true,
                "uom": "kg",
                "tags": "pizza,chicken,fast food",
                "is_stock_product": false,
                "price": 75,
                "deleted_at": null,
                "branches": []
            },
            {
                "category": {
                    "id": "97358e65-33c9-400c-af7d-b43a95726e08",
                    "name": "pizza",
                    "reference": "2",
                    "image": null,
                    "deleted_at": null
                },
                "branches": [
                    {
                        "id": "12345",
                        "is_active": true,
                        "price": 94.72,
                        "is_in_stock": 1
                    }
                ],
                "modifiers": [
                    {
                        "options": [
                            {
                                "id": "973593a5-46ba-4e4b-868f-f55d7987bdd7",
                                "name": "ranch",
                                "sku": "sk-0010",
                                "is_active": true,
                                "price": 223.33,
                                "priority": 1,
                                "deleted_at": null,
                                "branches": [
                                    {
                                        "id": 12345,
                                        "is_active": true,
                                        "price": 94.72,
                                        "is_in_stock": 1
                                    }
                                ]
                            },
                            {
                                "id": "973593d1-7078-4968-b5ee-fc1400d88b5e",
                                "name": "sweet chili",
                                "sku": "sk-0011",
                                "is_active": true,
                                "price": 11,
                                "priority": 2,
                                "deleted_at": null,
                                "branches": []
                            }
                        ],
                        "minimum_options": 1,
                        "maximum_options": 3,
                        "priority": 0,
                        "id": "97359318-210a-451d-8a1f-88e2e46bd566",
                        "name": "sauceeE",
                        "deleted_at": null
                    }
                ],
                "id": "97358ecc-06aa-4a8c-8249-6113261ac5a8",
                "sku": "sk-0005",
                "name": "BBQ PIzza 10",
                "description": null,
                "image": "https://s3-console-sandbox.s3./images/logo.jpg",
                "is_active": true,
                "is_stock_product": false,
                "price": 94.72,
                "deleted_at": null
            }
        ]
    }
    

Stock and Price Syncing

This API allows you to manage products stock & prices in your restaurant's menu.

Syncing a Product

The Stock Sync API allows you to synchronize your local menu data with our system. By sending the menu data in the specified format, you can update the stock and price.

Endpoint

POST /interface/v1/syncStockAndPrice

Request Parameters

Parameter Type Required Description
products array required An array containing the details of the products.
products.id string required The ID of the product.
products.price decimal required The price of the product.
products.discount_price decimal required The discount price of the product(send 0 if no discount).
products.branches array required An array containing the branches associated with the product.
products.branches.id string required The ID of the branch.
products.branches.price decimal sometimes The price of the product in the specific branch (null if price is same).
products.branches.discount_price decimal sometimes The discounted price of the product in the specific branch (null if price is same).
products.branches.stock_qunatity integer sometimes The stock of the product in the specific branch.

Sample Payload

    {
        "products": [
            {

                "id": "97358ecc-06aa-4a8c-8249-6113261ac5a8",
                "price": 94.72,
                "discount_price": 94.72,
                "branches": [
                    {
                        "id": "12345",
                        "is_active": true,
                        "price": 94.72,
                        "discount_price": 94.72,
                        "stock_quantity": 1
                    }
                ],
            }
        ]
    }
    

Order Webhook

The Order Webhook allows you to manage orders in your restaurant's system.

Receive an Order

A webhook is a mechanism used to inform external applications about specific events that they need to be aware of in real-time. Rather than requiring applications to constantly query the API for the latest data, Blink sends a webhook notification to the application whenever a particular event occurs. This allows applications to stay updated and receive timely information without the need for continuous manual requests.

Note: Please provide the webhook url to Blink, in order to receive real-time orders.

Webhook Timeout

Blink webhooks have a timeout of 5 seconds for requests. If your server fails to respond within this timeframe, the request will be terminated and not processed further.

Request Parameter

Field Type Description
blink_order_id string Represents the order id of blink's system.
order_key string The customers have this alphanumeric order no.
type string Represents the type of order i.e "PICK-UP"/"DINE-IN"/"DELIVERY".
channel string The channel from which order is received (e.g ANDROID, IOS, WEBSITE, CALL-IN ORDER, QR ORDER, FOODPANDA)
brand_id int The ID of the brand associated with the order.
branch_id string The ID of the branch associated with the order.
branch_latitude string The latitude of the branch associated with the order.
branch_longitude string The longitude of the branch associated with the order.
branch_address string The address of the branch associated with the order.
total_discount_amount integer The total amount of discount applied.
promo_code string The promotional code used, if any.
promo_discount integer The discount amount applied through the promotional code.
loyalty_amount float The loyalty amount applied on order.
wallet_amount float The wallet amount applied on order.
fbr_pos_charge float The fbr pos charge applied on order.
tax float The tax applied on order.
kitchen_notes string Additional notes or instructions for the kitchen.
due_at string The order place time in case of ASAP or due time in case of pre-order.
is_pre_order integer The is_pre_order will be either 0 or 1.
customer_name string The name of the customer placing the order.
customer_phone string The phone number of the customer.
customer_address_description string Description of the customer's address.
customer_address_latitude null The latitude of the customer's address.
customer_address_longitude null The longitude of the customer's address.
payment boolean The payment field will return true if it is paid else it will return false.
payment_type string The payment type is Cash or any other payment method that user have selected.
products array An array of products included in the order.
products[].product_id string The ID of the product.
products[].quantity integer The quantity of the product.
products[].name string The name of the product.
products[].unit_price string The unit price of the product.
products[].total_price integer The total price of the product.
products[].options array An array of options chosen for the product.
products[].options[].modifier_option_id string The ID of the selected modifier option.
products[].options[].unit_price string The unit price of the selected modifier option.
products[].options[].total_price string The total price of the selected modifier option.
products[].options[].name string The name of the selected modifier option.
products[].options[].quantity integer The quantity of the selected modifier option.

Webhook Payload

The following JSON represents the payload sent via the webhook:

    {
        "blink_order_id": "1236589",
        "order_key": "ABND-24234",
        "type": "PICK-UP",
        "channel": "IOS",
        "brand_id": 1,
        "branch_id": "12345",
        "branch_latitude": "27.4654584",
        "branch_longitude": "64.846548",
        "branch_address": "XYZ road street 13 Tonglong Paris France",
        "total_discount_amount": 0,
        "promo_code": "",
        "promo_discount": 0,
        "wallet_amount": 0,
        "loyalty_amount": 0,
        "tax": 0,
        "fbr_pos_charge": 1,
        "kitchen_notes": "",
        "due_at": "2024-06-26 09:26:04",
        "is_pre_order": 0,
        "customer_name": "Jhon Doe",
        "customer_phone": "+923300000000",
        "customer_address_description": "PICK-UP",
        "customer_address_latitude": null,
        "customer_address_longitude": null,
        "products": [
            {
            "product_id": "1c54bd7abe7b",
            "quantity": 1,
            "name": "Veg Breakfast Press  COMBO",
            "unit_price": "39.000",
            "total_price": 39,
            "options": [
                {
                "modifier_option_id": "cfeed7290c4c",
                "unit_price": "0.000",
                "total_price": "0.000",
                "name": "Tortilla (Wrap)",
                "quantity": 1
                },
                {
                "modifier_option_id": "cf9dc0cab4db",
                "unit_price": "0.000",
                "total_price": "0.000",
                "name": "Lays - Chilli",
                "quantity": 1
                },
                {
                "modifier_option_id": "a5350464a755",
                "unit_price": "4.000",
                "total_price": "4.000",
                "name": "Extra Diced Tomatoes",
                "quantity": 1
                },
                {
                "modifier_option_id": "3aa58f39e7dc",
                "unit_price": "4.000",
                "total_price": "4.000",
                "name": "Extra Paneer",
                "quantity": 1
                },
                {
                "modifier_option_id": "2a9ab643341e",
                "unit_price": "0.000",
                "total_price": "0.000",
                "name": "7up (500 ml)",
                "quantity": 1
                }
            ]
            }
        ],
        "payment": true,
        "payment_type": "Cash",
        "delivery_charges": "0",
        "subtotal": "59",
        "total_price": "66.67"
    }
        

Order Status Webhook

The Order Status Webhook allows you to manage orders status in your restaurant's system.

Receive Order Status Updates

A webhook is a mechanism used to inform external applications about specific events that they need to be aware of in real-time. Rather than requiring applications to constantly query the API for the latest data, Blink sends a webhook notification to the application whenever a particular event occurs. This allows applications to stay updated and receive timely information without the need for continuous manual requests.

Note: Please provide the webhook status update url to Blink, in order to receive real-time orders status updates.

Webhook Timeout

Blink webhooks have a timeout of 5 seconds for requests. If your server fails to respond within this timeframe, the request will be terminated and not processed further.

Request Parameter

Field Type Description
branch_id string Represents the branch id of blink's system.
blink_order_id string Represents the order id of blink's system.
status int Current status of order according to order status table above.
statusText string Represents the status text of order i.e "Accepted"/"Dispatched"/"Delivered" etc.
comment string Reason of order rejection

Order Status Updates Webhook Payload

The following JSON represents the payload sent via the webhook:

    {
        "blink_order_id": "1236589",
        "branch_id": "12345",
        "status": 4,
        "statusText": "Rejected",
        "comment": "TEST ORDER"
    }
        

Branches

The API allows you to fetch all branches from blink's system.

Endpoint

POST /interface/v1/branches

Sample Request

    curl -X GET \
        URL/interface/v1/branches \
        -H 'Authorization: Bearer eyJ0eXAiOiJKV1Qi...' \
        -H 'Content-Type: application/json'

Sample Response

The following JSON represents the reponse sent by blink:

    {
        "msg": "Success",
        "success": true,
        "error": null,
        "data": [
            {
                "id": 63,
                "blink_id": 60001,
                "branch": "Clifton-Block 4",
                "branch_address": "209 Bolvard center, caspian road beside Hollywood Cafe",
                "is_live": 1,
                "is_active": 1
            },
            {
                "id": 64,
                "blink_id": 60002,
                "branch": "SMCHS-12",
                "branch_address": "Plot#212 Rae Avenue road",
                "is_live": 1,
                "is_active": 1
            }
        ]
    }
                    

Customers

The API allows you to fetch all customers from blink's system.

Endpoint

POST /interface/v1/customers

Sample Request

    curl -X GET \
        URL/interface/v1/customers \
        -H 'Authorization: Bearer eyJ0eXAiOiJKV1Qi...' \
        -H 'Content-Type: application/json'

Sample Response

The following JSON represents the reponse sent by blink:

    {
        "msg": "Success",
        "success": true,
        "error": null,
        "data": {
            "current_page": 1,
            "data": [
                {
                    "full_name": "John Doe",
                    "phone": "+923368855221",
                    "email": "john.doe@example.com",
                    "total_orders": 23,
                    "signup_date": "2020-10-07 11:47:31"
                },
                {
                    "full_name": "Micheal Barak",
                    "phone": "+9663363752300",
                    "email": "micheal@example.com",
                    "total_orders": 1,
                    "signup_date": "2023-06-20 09:35:29"
                },
                {
                    "full_name": "Taco Ben",
                    "phone": "+903363752000",
                    "email": "t.ben@blinkco.io",
                    "total_orders": 1,
                    "signup_date": "2023-06-20 09:41:52"
                }
            ],
            "first_page_url": "URL/interface/v1/customers?page=1",
            "from": 1,
            "last_page": 1,
            "last_page_url": "URL/interface/v1/customers?page=1",
            "next_page_url": null,
            "path": "URL/interface/v1/customers",
            "per_page": 100,
            "prev_page_url": null,
            "to": 4,
            "total": 4
        }
    }
                    

Map Branches

By following steps you can map your branches with blinks system.

  1. Log in to your account and access the administration panel.
  2. Locate and click on the Branch Settings option in the side menu.
  3. In the Branch Settings page, you will see a list of your branches.
  4. Find the branch you want to map and click on the Edit button. This will take you to the Edit Branch Settings page, where you can configure branch-specific settings
  5. Look for the tab labeled Step 2 and click on it to proceed.
  6. Enter the branch code accurately in the Third Party Branches field.
  7. After completing all the required configurations, click on the Save Branch Settings button to save your changes.

By following these steps, you will successfully map your system branches with our system. If you encounter any issues or have further questions, please refer to the provided screenshots or contact our support team for assistance.

Order Status Syncing

The Order Status API allows you to update order status in blink's system.

Create a Product

The Menu Sync API allows you to synchronize your local menu data with our system. By sending the menu data in the specified format, you can update, add, or remove menu items from your account.

Endpoint

POST /interface/v1/syncOrderStatus

Order Status

Status Description
0 Pending When the order is created in Blink it will land in the PENDING status.
1 Accepted When the order is accepted in the blink application the status will be updated to ACCEPTED
2 Dispatched When the order is dispatched in the blink application the status will be updated to DISPACTCHED
3 Delivered when the order is delivered in Blink the status will be updated to DELIVERED
4 Rejected When the order is rejected from the Blink application the status will be updated to REJECTED

Request Parameters

Parameter Type Required Description
blink_order_id string required An order id that is provided by Blink at the time of order.
status int required Current status of order according to order status table above
comment int required if status is 4 Reason of order rejection

Sample Payload

1.
    {
        "blink_order_id": "123456",
        "status": 1
    }
2.
    {
        "blink_order_id": "123456",
        "status": 4,
        "comment": "Delivery area is too far"
    }

Introduction to Blink Logistics

To integrate with our API, you will need to obtain a token from our Blink Logistics Portal. This token will serve as your authentication information for making API requests.

Logistics base url For Live/Sandbox

  • Production API Base URL: https://api.delivery.blinkco.io
  • Sandbox API Base URL: https://stg-delivery.blinkco.io
NOTE:

It is important to keep your credentials secure and avoid sharing them with unauthorized individuals. If you suspect any compromise or unauthorized access to your credentials, contact our support team immediately to take appropriate actions.

Task Creation

The API allows you to send task to logistics portal.

Endpoint

POST /api/client/task

Authorization: Bearer Token

Provide your bearer token in the Authorization header when making requests to protected resources.

Example Authorization:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............

Request Parameters

Parameter Type Required Description
mappingKey string required Reference Task Id
mappingCode string required Reference Task Id
mappingBranchId string required The ID of the branch.
discountCode string optional The discount code used in the task.
tax decimal optional The tax value of the task.
taxPercent decimal optional The tax percentage of the task.
discount decimal optional The discount amount of the task.
deliveryCharges decimal optional The delivery charges of the task.
subTotal decimal optional The sub total of the task.
paymentType string required The payment method used for the task. (COD for Cash on Delivery/ONLINE for Online paid)
description string optional The task description.
instruction string optional The task instructions.
customerName string required The name of the customer.
customerEmail string optional The email of the customer.
customerAddress string required The address of the customer.
customerPhone string required The phone number of the customer.
lat string required The latitude of the customer's address.
lng string required The longitude of the customer's address.
pickUpTime datetime required The pickup time of the task. (UTC Format)
deliveryTime datetime required The delivery time of the task. (UTC Format)
type integer required The type of the task. (1 for normal task/2 for return task)

Sample Payload

   {
        "mappingKey": "12345678",
        "mappingCode": "12345678",
        "mappingBranchId": "12345",
        "discountCode": "",
        "tax": 0,
        "taxPercent": 0,
        "discount": 0,
        "deliveryCharges": 120,
        "subTotal": 2080,
        "paymentType": "COD",
        "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
        "instruction": "",
        "customerName": "Test Customer",
        "customerEmail": "user@blinkco.io",
        "customerAddress": "Tariq Road, PECHS Block 2",
        "customerPhone": "923001234567",
        "lat": "24.871641",
        "lng": "67.059906",
        "deliveryTime": "2024-06-06T04:29:15.000Z",
        "pickUpTime": "2024-06-06T03:29:15.000Z",
        "type": 1
    }

Sample Request

    curl --location --request POST '/api/client/task' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............' \
    --data-raw '{
        "mappingKey": "12345678",
        "mappingCode": "12345678",
        "mappingBranchId": "12345",
        "discountCode": "",
        "tax": 0,
        "taxPercent": 0,
        "discount": 0,
        "deliveryCharges": 120,
        "subTotal": 2080,
        "paymentType": "COD",
        "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
        "instruction": "",
        "customerName": "Test Customer",
        "customerEmail": "user@blinkco.io",
        "customerAddress": "Tariq Road, PECHS Block 2",
        "customerPhone": "923001234567",
        "lat": "24.871641",
        "lng": "67.059906",
        "deliveryTime": "2024-06-06T04:29:15.000Z",
        "pickUpTime": "2024-06-06T03:29:15.000Z",
        "type": 1
    }'
    $client = new Client();
    $headers = [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
    ];
    $body = '{
        "mappingKey": "12345678",
        "mappingCode": "12345678",
        "mappingBranchId": "12345",
        "discountCode": "",
        "tax": 0,
        "taxPercent": 0,
        "discount": 0,
        "deliveryCharges": 120,
        "subTotal": 2080,
        "paymentType": "COD",
        "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
        "instruction": "",
        "customerName": "Test Customer",
        "customerEmail": "user@blinkco.io",
        "customerAddress": "Tariq Road, PECHS Block 2",
        "customerPhone": "923001234567",
        "lat": "24.871641",
        "lng": "67.059906",
        "deliveryTime": "2024-06-06T04:29:15.000Z",
        "pickUpTime": "2024-06-06T03:29:15.000Z",
        "type": 1
    }';
    $request = new Request('POST', '/api/client/task', $headers, $body);
    $res = $client->sendAsync($request)->wait();
    echo $res->getBody();
    var request = require('request');
    var options = {
        'method': 'POST',
        'url': '/api/client/task',
        'headers': {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
        },
        body: JSON.stringify({
            "mappingKey": "12345678",
            "mappingCode": "12345678",
            "mappingBranchId": "12345",
            "discountCode": "",
            "tax": 0,
            "taxPercent": 0,
            "discount": 0,
            "deliveryCharges": 120,
            "subTotal": 2080,
            "paymentType": "COD",
            "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
            "instruction": "",
            "customerName": "Test Customer",
            "customerEmail": "user@blinkco.io",
            "customerAddress": "Tariq Road, PECHS Block 2",
            "customerPhone": "923001234567",
            "lat": "24.871641",
            "lng": "67.059906",
            "deliveryTime": "2024-06-06T04:29:15.000Z",
            "pickUpTime": "2024-06-06T03:29:15.000Z",
            "type": 1
        })
    };
    request(options, function (error, response) {
        if (error) throw new Error(error);
        console.log(response.body);
    });

Sample Response in JSON

HTTP Code: 201 Content Type: JSON

    {
        "eventId": 20,
        "event": "TASK_CREATED",
        "data": {
            "taskId": "XYZAB-12345",
            "type": 1
        }
    }

Task Updation

The API allows you to update the task.

Endpoint

PUT /api/client/task

Authorization: Bearer Token

Provide your bearer token in the Authorization header when making requests to protected resources.

Example Authorization:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............

Request Parameters

Parameter Type Required Description
taskId string required Blink logistics Unique Id
discountCode string optional The discount code used in the task.
tax decimal optional The tax value of the task.
taxPercent decimal optional The tax percentage of the task.
discount decimal optional The discount amount of the task.
deliveryCharges decimal optional The delivery charges of the task.
subTotal decimal optional The sub total of the task.
paymentType string optional The payment method used for the task. (COD for Cash on Delivery/ONLINE for Online paid)
description string optional The task description.
instruction string optional The task instructions.
customerName string optional The name of the customer.
customerEmail string optional The email of the customer.
customerAddress string optional The address of the customer.
customerPhone string optional The phone number of the customer.
lat string optional The latitude of the customer's address.
lng string optional The longitude of the customer's address.
pickUpTime datetime optional The pickup time of the task. (UTC Format)
deliveryTime datetime optional The delivery time of the task. (UTC Format)
type integer required The type of the task. (1 for normal task/2 for return task)

Sample Payload

   {
        "taskId": "XYZAB-12345",
        "discountCode": "",
        "tax": 0,
        "taxPercent": 0,
        "discount": 0,
        "deliveryCharges": 120,
        "subTotal": 2080,
        "paymentType": "COD",
        "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
        "instruction": "",
        "customerName": "Test Customer",
        "customerEmail": "user@blinkco.io",
        "customerAddress": "Tariq Road, PECHS Block 2",
        "customerPhone": "923001234567",
        "lat": "24.871641",
        "lng": "67.059906",
        "deliveryTime": "2024-06-06T04:29:15.000Z",
        "pickUpTime": "2024-06-06T03:29:15.000Z",
        "type": 1
    }

Sample Request

    curl --location --request PUT '/api/client/task' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............' \
    --data-raw '{
            "taskId": "XYZAB-12345",
            "discountCode": "",
            "tax": 0,
            "taxPercent": 0,
            "discount": 0,
            "deliveryCharges": 120,
            "subTotal": 2080,
            "paymentType": "COD",
            "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
            "instruction": "",
            "customerName": "Test Customer",
            "customerEmail": "user@blinkco.io",
            "customerAddress": "Tariq Road, PECHS Block 2",
            "customerPhone": "923001234567",
            "lat": "24.871641",
            "lng": "67.059906",
            "deliveryTime": "2024-06-06T04:29:15.000Z",
            "pickUpTime": "2024-06-06T03:29:15.000Z",
            "type": 1
        }'
    $client = new Client();
    $headers = [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
    ];
    $body = '{
        "taskId": "XYZAB-12345",
        "discountCode": "",
        "tax": 0,
        "taxPercent": 0,
        "discount": 0,
        "deliveryCharges": 120,
        "subTotal": 2080,
        "paymentType": "COD",
        "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
        "instruction": "",
        "customerName": "Test Customer",
        "customerEmail": "user@blinkco.io",
        "customerAddress": "Tariq Road, PECHS Block 2",
        "customerPhone": "923001234567",
        "lat": "24.871641",
        "lng": "67.059906",
        "deliveryTime": "2024-06-06T04:29:15.000Z",
        "pickUpTime": "2024-06-06T03:29:15.000Z",
        "type": 1
    }';
    $request = new Request('PUT', '/api/client/task', $headers, $body);
    $res = $client->sendAsync($request)->wait();
    echo $res->getBody();
    var request = require('request');
    var options = {
        'method': 'PUT',
        'url': '/api/client/task',
        'headers': {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
        },
        body: JSON.stringify({
            "taskId": "XYZAB-12345",
            "discountCode": "",
            "tax": 0,
            "taxPercent": 0,
            "discount": 0,
            "deliveryCharges": 120,
            "subTotal": 2080,
            "paymentType": "COD",
            "description": "Details: Milk Buffalo 1 Ltr Pouch, Quantity: 8; \n",
            "instruction": "",
            "customerName": "Test Customer",
            "customerEmail": "user@blinkco.io",
            "customerAddress": "Tariq Road, PECHS Block 2",
            "customerPhone": "923001234567",
            "lat": "24.871641",
            "lng": "67.059906",
            "deliveryTime": "2024-06-06T04:29:15.000Z",
            "pickUpTime": "2024-06-06T03:29:15.000Z",
            "type": 1
        })
    };
    request(options, function (error, response) {
        if (error) throw new Error(error);
        console.log(response.body);
    });

Sample Response in JSON

HTTP Code: 201 Content Type: JSON

    {
        "eventId": 21,
        "event": "TASK_UPDATED",
        "data": {
            "taskId": "XYZAB-12345",
            "type": 1
        }
    }

Get Task Status

The API allows you to get the task updated status.

Endpoint

GET /api/client/task/status

Authorization: Bearer Token

Provide your bearer token in the Authorization header when making requests to protected resources.

Example Authorization:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............

Query Params

mappingKey string
Example: 12345678

Sample Request

    curl --location --request GET '/api/client/task/status?mappingKey=12345678' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
    $client = new Client();
    $headers = [
        'Content-Type' => 'application/json',
        'Authorization' => 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
    ];
    $request = new Request('GET', '/api/client/task/status?mappingKey=12345678', $headers);
    $res = $client->sendAsync($request)->wait();
    echo $res->getBody();
    var request = require('request');
    var options = {
        'method': 'PUT',
        'url': '/api/client/task/status?mappingKey=12345678',
        'headers': {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9............'
        }
    };
    request(options, function (error, response) {
        if (error) throw new Error(error);
        console.log(response.body);
    });

Sample Response in JSON

HTTP Code: 200 Content Type: JSON

    {
        "eventId": 24,
        "event": "TASK_ACCEPTED",
        "data": {
            "taskId": "XYZAB-12345",
            "type": 1,
            "reason": "",
            "agent": {
                "name": "Test Rider",
                "contact": "+923213456789"
            },
            "trackingLink": "https://delivery-stg.blinkco.io/tracking/jvkUgPIRN6f8jZg9q62xy"
        }
    }
Task Status
Event Id Event Name Description
20 TASK_CREATED A new order or shipment has been created in the system.
21 TASK_UPDATED An existing order or shipment details have been modified (e.g., quantity change, address update).
22 TASK_UNASSIGN An order/shipment previously assigned to a driver is now unassigned (potentially due to driver unavailability or route changes).
23 TASK_ASSIGNED An order/shipment has been allocated to a specific driver for processing.
24 TASK_ACCEPTED The assigned driver has confirmed they can handle the order/shipment. (This might be implicit or require manual confirmation depending on the system).
25 TASK_ARRIVED The driver has reached the place where they need to collect the items for delivery.
26 TASK_STARTED The driver has started moving toward the delivery location.
27 TASK_FINISHED The goods have been delivered to the final destination.
28 TASK_CANCELLED The order/shipment has been cancelled before completion (e.g., by the customer or due to unforeseen circumstances).
29 TASK_REASSIGNED The order/shipment has been re-assigned to a different driver due to changes or disruptions.

Task Status Webhook

This webhook allows you to update order status according to task status.

NOTE: Please update the webhook url in blink logistics portal in order to receive real-time task status.

Sample Webhook Payload

Content Type: JSON

    {
        "eventId": 24,
        "event": "TASK_ACCEPTED",
        "data": {
            "taskId": "XYZAB-12345",
            "type": 1,
            "reason": "",
            "agent": {
                "name": "Test Rider",
                "contact": "+923213456789"
            },
            "trackingLink": "https://delivery-stg.blinkco.io/tracking/jvkUgPIRN6f8jZg9q62xy"
        }
    }