Introduction to BSTD API Integration

Welcome to the BSTD API Integration Guide — your resource for seamlessly embedding BSTD's powerful transport and logistics automation features directly into your existing websites and applications. This guide covers how to utilize our APIs for document generation, lead management, shipment tracking, and more.

Important Note for Developers

The BSTD UI Kit and embedded API scripts are designed to be lightweight, static HTML/CSS, and JavaScript components. They are not dependent on any specific CMS or backend language, making them highly flexible. You can integrate them into any static site or embed them into your existing platform (e.g., PHP, Node.js, Django, Ruby on Rails) with ease. Please note that these scripts do not include a CMS or dynamic data fetching by default; they are designed to fetch data from your BSTD account via API keys.

Quick Start: Embedding BSTD Features

This section will help you quickly integrate BSTD features into your web presence. The easiest way to get started is by embedding our pre-built UI components.

1. Embed & Access BSTD UI Components

To instantly load all BSTD UI components, styles, and interactivity, simply add the following script tag to your website's HTML, ideally just before the closing `` tag:


<!-- Include BSTD UI Kit Script -->
<script src="https://bstd.digital.thugo.in/assets/js/bstd-ui-kit.min.js" defer></script>
        

This method requires no build tools or complex setup, allowing you to integrate BSTD features into your site within minutes.

Key API Integrations

To further enhance your website with interactive and dynamic BSTD functionalities, you can integrate the following APIs:

Document API

Use the Document API to securely embed and manage customer-specific documents such as invoices, agreements, contracts, or loading slips directly on your website. This allows your users to view, download, or even e-sign documents without leaving your platform.


<script>
document.addEventListener('DOMContentLoaded', () => {
  const urlParams = new URLSearchParams(window.location.search);
  const token = urlParams.get('key'); // Expects a secure token in the URL
  const apiKey = 'YOUR_BSTD_API_KEY'; // <strong>Replace with your actual BSTD API key</strong>

  if (!token) {
    // Display an error if the token is missing
    document.body.innerHTML = '<h3 style="color: #dc3545; text-align: center; margin-top: 50px;">Error: Missing document access token in URL.</h3>';
  } else if (!apiKey || apiKey === 'YOUR_BSTD_API_KEY') {
    // Display an error if the API key is missing or default
    document.body.innerHTML = '<h3 style="color: #dc3545; text-align: center; margin-top: 50px;">Error: Please provide a valid BSTD API key.</h3>';
  }
  else {
    // Append the script to load the document viewer
    const script = document.createElement('script');
    script.src = `https://bstd.digital.thugo.in/api/embed/customer-docs.js?apikey=${apiKey}&key=${encodeURIComponent(token)}`;
    document.head.appendChild(script);
  }
});
</script>
          

Important Tip: Ensure you pass the secure `key` (document token) dynamically in the URL (e.g., `yourwebsite.com/docs?key=YOUR_DOCUMENT_TOKEN`) to identify the customer and securely load their specific documents. Remember to replace `'YOUR_BSTD_API_KEY'` with your unique API key obtained from your BSTD dashboard.

Leads API

Automate lead capture on your website using the Leads API. This script will inject a customizable lead generation form or modal that seamlessly submits data directly to your BSTD lead management system.


<script src="https://bstd.digital.thugo.in/api/embed/delayed-form-modal.js?apikey=YOUR_BSTD_API_KEY" defer></script>
          

Use Case: This API is ideal for capturing sales inquiries, product interest, support requests, or any user data that you want to funnel directly into your BSTD lead workflow. Remember to replace `'YOUR_BSTD_API_KEY'` with your actual API key.

Shipment Tracking API

Empower your customers to track their orders and shipments with ease by embedding our Shipment Tracking API. This integration provides a tracking form that allows customers to enter an LR (Lorry Receipt) number or tracking ID to view live shipment status.


<!-- Placeholder where the shipment tracking widget will appear -->
<div id="shipmentTrackingContainer"></div>

<!-- Include the tracking script before the closing </body> tag -->
<script>
document.addEventListener('DOMContentLoaded', () => {
  const apiKey = 'YOUR_BSTD_API_KEY'; // <strong>Replace with your actual BSTD API key</strong>

  if (!apiKey || apiKey === 'YOUR_BSTD_API_KEY') {
    document.getElementById('shipmentTrackingContainer').innerHTML = '<h3 style="color: #dc3545; text-align: center; margin-top: 50px;">Error: Please provide a valid BSTD API key for shipment tracking.</h3>';
  } else {
    const script = document.createElement('script');
    script.src = `https://bstd.digital.thugo.in/api/embed/delayed-shipment-tracking-modal.js?apikey=${apiKey}`;
    script.defer = true;
    document.head.appendChild(script);
  }
});
</script>
          

Result: Integrating this API significantly improves customer transparency and can reduce inbound support calls related to shipment status. Ensure you replace `'YOUR_BSTD_API_KEY'` with your unique API key for this integration to function correctly and display accurate tracking information.