API Documentation¶
Overview¶
The BidScript backend exposes RESTful APIs to interact with various features of the application. The application uses JWT tokens for authentication with selective endpoint protection.
Authentication¶
JWT Authentication¶
Protected endpoints require a valid JWT token in the Authorization header:
The JWT token should contain user identification information including userID and companyID.
Health Check¶
System Health¶
Public endpoint that returns system health status.
Response:
Application Status¶
Public endpoint that returns a simple hello message.
Response:
Document Management¶
Upload Document¶
Request:
- Content-Type: multipart/form-data
- Form Data:
- file: File (PDF, DOCX, etc.)
- metadata: JSON string (optional)
Response:
{
"id": "string",
"filename": "string",
"contentType": "string",
"size": "number",
"url": "string",
"createdAt": "string"
}
Parse Document¶
Request Body:
Response:
Get Document¶
Response:
{
"id": "string",
"filename": "string",
"contentType": "string",
"size": "number",
"url": "string",
"metadata": "object",
"createdAt": "string",
"parsedAt": "string"
}
Delete Document¶
Response:
Chat API¶
Send Message¶
Public endpoint for processing chat messages.
Request Body:
{
"userID": "string",
"companyID": "string",
"conversationUUID": "string",
"conversationId": "string",
"message": "string",
"documents": [
{
"name": "string",
"type": "string",
"content": "string"
}
]
}
Response:
CORS Support¶
Handles preflight requests for CORS support.
GET /conversations
Protected endpoint that requires JWT authentication.
Query Parameters:
- `userID`: User identifier (if not in JWT token)
Response:
```json
[
{
"id": "string",
"title": "string",
"createdAt": "string",
"updatedAt": "string",
"userID": "string"
}
]
Get Conversation by ID¶
Protected endpoint that returns a specific conversation.
Response:
{
"id": "string",
"title": "string",
"messages": ["object"],
"createdAt": "string",
"updatedAt": "string"
}
Create Conversation¶
Protected endpoint to create a new conversation.
Request Body:
Delete Conversation¶
Protected endpoint to delete a conversation.
Response:
Document Processing¶
Process Documents¶
Processes uploaded documents for analysis.
Request Body:
Response:
Notifications¶
Get User Notifications¶
Public endpoint to retrieve notifications for a user.
Response:
[
{
"id": "string",
"userId": "string",
"title": "string",
"description": "string",
"type": "string",
"isRead": "boolean",
"requiresAction": "boolean",
"links": [
{
"text": "string",
"path": "string",
"description": "string"
}
],
"createdAt": "string"
}
]
Create Notification¶
Public endpoint to create a new notification.
Request Body:
{
"userId": "string",
"title": "string",
"description": "string",
"type": "info|warning|error|success",
"requiresAction": "boolean",
"links": [
{
"text": "string",
"path": "string",
"description": "string"
}
]
}
Mark Notification as Read¶
Public endpoint to mark a notification as read.
Delete Notification¶
Public endpoint to delete a notification.
Editor API¶
Create Document¶
Request Body:
Response:
Get Document¶
Response:
{
"id": "string",
"title": "string",
"content": "string",
"documentType": "string",
"metadata": "object",
"createdAt": "string",
"updatedAt": "string"
}
Update Document¶
Request Body:
Response:
Delete Document¶
Response:
Collaboration API¶
Join Collaboration Session¶
Request Body:
Response:
{
"sessionId": "string",
"participants": [
{
"userId": "string",
"userName": "string",
"connectedAt": "string"
}
]
}
Leave Collaboration Session¶
Request Body:
ProjectHub API¶
Process Tender Pack¶
Request Body:
{
"documentId": "string",
"options": {
"extractRequirements": "boolean",
"identifyDeadlines": "boolean",
"categoriseContent": "boolean"
}
}
Response:
{
"id": "string",
"status": "string",
"sections": "number",
"requirements": "number",
"jobId": "string"
}
Get Tender Processing Status¶
Response:
{
"jobId": "string",
"status": "string",
"progress": "number",
"completed": "boolean",
"error": "string"
}
Error Handling¶
All API endpoints follow a consistent error response format:
{
"statusCode": "number",
"timestamp": "string",
"path": "string",
"message": "string",
"error": "string"
}
Common HTTP status codes:
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
Rate Limiting¶
API endpoints are subject to rate limiting:
- 100 requests per minute for authenticated users
- 10 requests per minute for unauthenticated users
Exceeded rate limits will return a 429 (Too Many Requests) status code.