Official SDK for the Chekin API, providing easy access to property management, reservation handling, and guest check-in functionality.
- Authentication: Secure API key-based authentication
- Property Management: Create and manage properties/housings
- Reservation Management: Handle reservations and bookings
- Guest Management: Dynamic guest forms and check-in process
- TypeScript Support: Full TypeScript definitions included
- Browser & Node.js: Works in both environments
- CDN Ready: Available via unpkg for browser use
npm install chekin-npm-sdk
# or
yarn add chekin-npm-sdk<script src="https://unpkg.com/chekin-npm-sdk/dist/sdk.bundle.js"></script>import { ChekinSDK } from 'chekin-npm-sdk';
async function main() {
// Initialize SDK
const sdk = new ChekinSDK('YOUR_API_KEY_HERE');
// Generate authentication token
const token = await sdk.generateToken();
console.log('Token generated:', token);
// Now you can use properties, reservations, and guests services
const property = await sdk.properties.createProperty(
'Hotel Demo',
'HOT',
{
external_id: 'ext-' + Date.now(),
commercial_name: 'Hotel Demo Commercial',
vatin: 'ES12345678',
rooms_quantity: 10,
location: { country: 'ES', city: 'Madrid' }
}
);
console.log('Property created:', property);
}
main().catch(console.error);<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/chekin-npm-sdk/dist/sdk.bundle.js"></script>
</head>
<body>
<script>
async function initDemo() {
// Initialize SDK
const sdk = new window.ChekinNpmSDK.ChekinSDK('YOUR_API_KEY_HERE');
// Generate token
const token = await sdk.generateToken();
console.log('SDK ready!', token);
// Use the SDK services...
}
initDemo().catch(console.error);
</script>
</body>
</html>Creates a new SDK instance with the provided API key.
Generates and stores an authentication token. Must be called before using any other methods.
After calling generateToken(), the following services become available:
sdk.properties- Property managementsdk.reservations- Reservation managementsdk.guests- Guest management
Creates a new property.
Parameters:
name(string) - Property name (required)type(PropertyType) - Property type:"HOT","APT","HST","B&B"(required)options(object) - Additional options:external_id(string) - External identifiercommercial_name(string) - Commercial namevatin(string) - VAT identification numberrooms_quantity(number) - Number of roomslocation(object) - Location detailscountry(string) - ISO country codecity(string) - City name
Example:
const property = await sdk.properties.createProperty(
'Hotel Sunshine',
'HOT',
{
external_id: 'hotel-001',
commercial_name: 'Hotel Sunshine Resort',
vatin: 'ES12345678',
rooms_quantity: 50,
location: { country: 'ES', city: 'Barcelona' }
}
);Creates a new reservation.
Parameters:
housingId(string) - Property ID (required)guests(number) - Number of guests (required)checkIn(string) - Check-in date in YYYY-MM-DD format (required)checkOut(string) - Check-out date in YYYY-MM-DD format (required)options(object) - Additional options:source_name(string) - Booking sourcedefault_leader_full_name(string) - Lead guest namedefault_invite_email(string) - Guest emailbooking_reference(string) - External booking reference
Example:
const reservation = await sdk.reservations.createReservation(
property.id,
2,
'2025-12-01',
'2025-12-07',
{
source_name: 'Booking.com',
default_leader_full_name: 'John Doe',
default_invite_email: 'john@example.com'
}
);Retrieves the dynamic guest form schema based on property and reservation details.
Parameters:
payload(object) - Request payload:reservation_id(string) - Reservation ID (required)- Additional fields as needed for dynamic form generation
Example:
const schema = await sdk.guests.getGuestSchema({
reservation_id: reservation.id
});
// Use schema.default to render dynamic form
schema.default.forEach(field => {
console.log(field.name, field.type, field.label);
});Creates a guest with the provided form data.
Parameters:
payload(object) - Guest data:reservation_id(string) - Reservation ID (required)- Additional fields from the dynamic form
Example:
const guest = await sdk.guests.createGuest({
reservation_id: reservation.id,
full_name: 'John Doe',
email: 'john@example.com',
phone: '+1234567890',
// ... other fields from dynamic form
});The SDK works in all modern browsers and includes:
- ES5+ compatibility
- Promise-based API
- TypeScript definitions
- Global
window.ChekinNpmSDKobject when loaded via CDN
The SDK uses API key authentication. Contact Chekin to obtain your API credentials:
- Test Environment:
api-ng.chekintest.xyz - Production Environment: Contact support for details
Check out the included demo.html file for a complete working example that demonstrates:
- SDK initialization and authentication
- Property creation with form validation
- Reservation management
- Dynamic guest forms with real-time schema updates
- Complete error handling and logging
This SDK is built with:
- TypeScript for type safety
- Rollup for bundling
- Native Fetch API for HTTP requests
- Modular architecture for easy maintenance
git clone <repository>
cd chekin-npm-sdk
npm install
npm run buildThe SDK throws descriptive errors for:
- Authentication failures
- Validation errors
- API errors
- Network issues
try {
const property = await sdk.properties.createProperty(/* ... */);
} catch (error) {
console.error('Property creation failed:', error.message);
}MIT Β© Chekin
For technical support and API access, please contact Chekin support.