{% extends 'public/base.html' %} {% block title %}E-Commerce API Documentation | ChatLab - AI Sales Agent{% endblock %} {% block content %}

1. Authentication & Base URL

IMPORTANT: The API Key required for authorization must be generated and obtained from our dashboard by the company owner. All requests sent from our chatbot system to your e-commerce API will be authenticated using this Bearer Token.

The Chatbot will call your e-commerce system using the Base URL you provide. The endpoints below (/api/bot/test/, /api/bot/catalog/, etc.) should be implemented on your server.

Authorization: Bearer <OBTAINED_API_KEY>

2. Connection Test Endpoint

Used by our chatbot dashboard to verify that the connection to your store is working correctly.

GET /api/bot/test/

Expected JSON Response

{ "status": "success", "message": "API is working properly." }

3. Fetch Product Catalog

The chatbot will call this endpoint to fetch your store's live product catalog to recommend items to customers.

GET /api/bot/catalog/

Expected JSON Format

Field Type Description
id String / Int Unique product identifier.
name String The name or title of the product.
price Number The regular price of the item.
discount_price Number The discounted price (if applicable). Send null or 0 if none.
brand String The brand name of the product.
stock Boolean / Number Whether the item is in stock.

Sample Response

{ "status": "success", "products": [ { "id": "1001", "name": "Wireless Noise Cancelling Headphones", "price": 15000.00, "discount_price": 12000.00, "brand": "AudioTech", "stock": true }, { "id": "1002", "name": "Smart Fitness Watch", "price": 20000.00, "discount_price": null, "brand": "FitWear", "stock": false } ] }

4. Create Product Order

When a user confirms they want to buy a product, the chatbot will send a POST request to create the order in your system.

POST /api/bot/order/

Request Payload (Sent by Chatbot)

{ "customer_name": "Md. Rahim Uddin", "customer_phone": "+8801700000000", "customer_address": "123 Gulshan, Dhaka, Bangladesh", "product_id": "1001", "quantity": 1, "notes": "Please deliver in the evening." }

Expected JSON Response

Return the created order ID and a confirmation message that the chatbot will relay to the user.

{ "status": "success", "order_id": "ORD-5592", "message": "Order created successfully. Our team will contact you shortly for delivery." }

Check Connection

Test if your API is correctly configured. Enter your API Base URL (Authorized Domain) and the API Key provided by us.

{% endblock %}