Base URL
Authentication
All endpoints are secured and require authentication. Include your authentication token in the request headers.Example Authentication with the Backend API
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Documentation for the Tripedge Backend SDK
/api
const { TripedgeBackendAPI } = require("./tripedge.backend.api");
const client = new TripedgeBackendAPI({
baseURL: "YOUR_BASE_URL",
headers: {
"Authorization": "YOUR_AUTH_TOKEN",
},
});
interface CreateUserPayload {
firstName: string; // Required, non-empty
lastName: string; // Required, non-empty
email: string; // Required, valid email format
phone: string; // Required, non-empty
clientAccountLimit: number; // Required, minimum 0
}
// Create a new user
const createResponse = await client.user.createUser({
firstName: "Test",
lastName: "User",
email: "test@example.com",
phone: "1234567890",
clientAccountLimit: 1000
});
if (!createResponse.data?.id) {
throw new Error("Failed to create user");
}
const userId = createResponse.data.id.toString();
{
success?: boolean;
message?: string | null;
data?: {
id: number;
firstName: string;
lastName: string;
email: string;
phone: string;
clientAccountLimit: string;
createdAt: string; // date-time
updatedAt: string; // date-time
deletedAt: string | null;
}
}
// Path Parameters
id: string // User ID
const getUserResponse = await client.user.getUserById(userId);
interface UpdateUserPayload {
firstName?: string; // Non-empty if provided
lastName?: string; // Non-empty if provided
email?: string; // Valid email format if provided
phone?: string; // Non-empty if provided
clientAccountLimit?: string;
}
// Update a user
const updateResponse = await client.user.updateUser(userId, {
firstName: "Updated",
lastName: "User",
email: "updated@example.com",
phone: "0987654321",
clientAccountLimit: "2000"
});
// Path Parameters
id: string // User ID
const getTokenResponse = await client.user.getUserToken(userId);
{
success?: boolean;
message?: string | null;
data?: {
token: string;
expiresAt: string; // date-time
}
}
// No parameters required
const response = await api.booking.getBookings();
if (response.data) {
console.log(response.data);
}
{
success?: boolean;
message?: string | null;
data?: Array<{
id: number;
status: "confirmed" | "pending" | "cancelled";
voucher: string;
hotelId: number;
checkIn: string;
checkOut: string;
firstName: string;
lastName: string;
email: string;
phone: string;
lines: Array<{
lineText: string;
amount: string;
}>;
pricePerNight: string;
priceFees: string;
priceDueAtHotel: string;
priceInclusive: string;
priceChargeable: string;
currency: string;
remarks: string;
roomType: string;
cancellationPolicy: string;
cancellationPolicyDate: string;
rooms: Array<{
adults: Array<{
title: string;
firstName: string;
lastName: string;
}>;
children: Array<{
title: string;
firstName: string;
lastName: string;
age: number;
}>;
}>;
clientCommission: string;
paymentMethod: "creditCard" | "account";
userId: number;
hotel: {
id: number;
name: string;
stars: number; // 1-5
coordinates?: [number, number];
address: {
address?: string;
postalCode?: string;
city?: string;
country?: string;
};
rating: number; // 0-5
reviews: number; // min 0
pricePerNight: string;
priceFees: string;
priceDueAtHotel: string;
priceInclusive: string;
priceChargeable: string;
amenities: string[];
location: string;
images: string[];
exclusive: boolean;
type: string;
};
}>;
}
// Path Parameters
userId: string // ID of the user to get bookings for
interface CreateAccountingEntryPayload {
debit: number; // minimum 0
credit: number; // minimum 0
name: string; // Required, non-empty
clientId: number; // Required
bookingId?: number;
ccPaymentId?: string;
userId?: number;
bankPaymentId?: number;
}
{
success?: boolean;
message?: string | null;
data?: {
id: number;
debit: number;
credit: number;
name: string;
clientId: number;
bookingId: number;
ccPaymentId: string;
userId: number;
bankPaymentId: number;
createdAt: string; // date-time
updatedAt: string; // date-time
deletedAt: string;
}
}
// No parameters required
// Path Parameters
id: string // Accounting entry ID
// Path Parameters
bookingId: string // ID of the booking
{
success: false;
message: string;
data: null;
}
