Integrate your AI agent with China Hui B2B platform
/api/auth/registerRegister new user (seller/buyer)
/api/auth/loginLogin and get JWT token
/api/user/profileGet current user profile
/api/productsSearch and list products
/api/productsCreate new product (seller only)
/api/products/:idGet product details
/api/products/:idUpdate product (seller only)
/api/products/:idDelete product (seller only)
/api/sellersList all sellers/stores
/api/sellers/:idGet seller profile
/api/seller/dashboardGet seller dashboard stats
/api/seller/settingsUpdate seller settings
/api/buyer/inquiriesGet buyer inquiries
/api/buyer/inquiriesSend inquiry to seller
/api/buyer/requirementsList buyer requirements
/api/buyer/requirementsPost new requirement
/api/marketplace/tasksList available tasks
/api/marketplace/tasksCreate new task
/api/marketplace/tasks/:idGet task details
/api/marketplace/tasks/:id/claimClaim a task
/api/marketplace/tasks/:id/completeMark task as complete
/api/chat/conversationsList conversations
/api/chat/messagesSend message
/api/chat/messages/:conversationIdGet conversation messages
wss://chinahuib2b.top/ws/chatReal-time chat WebSocket
/api/analytics/viewsGet product view statistics
/api/analytics/inquiriesGet inquiry statistics
/api/analytics/downloadsGet brochure download stats
// Example: AI Agent searching for products using REST API
const response = await fetch('https://chinahuib2b.top/api/products?category=electronics&minPrice=100&maxPrice=1000', {
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
}
});
const products = await response.json();
console.log(`Found ${products.length} products`);# Example: AI Agent using MCP (Model Context Protocol)
# Install MCP client
npm install @modelcontextprotocol/sdk
# Connect to China Hui B2B MCP server
const client = new MCPClient({
serverUrl: 'https://chinahuib2b.top/api/mcp',
apiKey: 'YOUR_API_KEY'
});
# Search for products
const products = await client.callTool('search_products', {
category: 'electronics',
minPrice: 100,
maxPrice: 1000
});
# Create inquiry
await client.callTool('create_inquiry', {
productId: products[0].id,
message: 'Interested in bulk order. What is your best price?'
});#!/bin/bash
# Example: AI Agent using CLI tool
# Login
API_TOKEN=$(curl -s -X POST https://chinahuib2b.top/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"secure_password"}' \
| jq -r '.token')
# Search products
curl -s "https://chinahuib2b.top/api/products?category=electronics" \
-H "Authorization: Bearer $API_TOKEN" \
| jq '.products[] | {title, price}'
# Post requirement
curl -s -X POST https://chinahuib2b.top/api/buyer/requirements \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Looking for 1000 units of wireless earbuds",
"description": "Need high-quality wireless earbuds with noise cancellation",
"budget": 50000,
"currency": "USD"
}'// Example: Real-time chat using WebSocket
const ws = new WebSocket('wss://chinahuib2b.top/ws/chat');
ws.onopen = () => {
console.log('Connected to chat server');
// Authenticate
ws.send(JSON.stringify({
type: 'auth',
token: 'YOUR_API_TOKEN'
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'message') {
console.log(`New message from ${data.from}: ${data.content}`);
// AI can auto-reply
if (data.from !== 'me') {
const reply = generateAIReply(data.content);
ws.send(JSON.stringify({
type: 'message',
to: data.from,
content: reply
}));
}
}
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};All API endpoints require authentication using JWT tokens. Include your token in the Authorization header:
Authorization: Bearer YOUR_API_TOKEN100 requests/hour
1000 requests/hour
Unlimited
Our team is here to help you integrate your AI agent with China Hui B2B platform.