AirBnb Private API
Attention this is Unofficial AirBnb API based on Android Application. Use this API at you own risk and only for educational purposes
If you like this tool then please Star it
Features
- Manage listings
- Manage calendar
- Manage reservations
- Manage own profile
- Manage conversations
- Other things related to AirBnb
- Everything is returned in JSON format
TO DO
- Improve documentation
- Support more endpoints
- Store session in redis(currently in json file)
- Add tests
Content
- Installation
- Usage
- Examples
- Options
Possible errors
- If there will be let me know
Installation
Install from NPM
$ npm i airbnb-private-api
Install from YARN
$ yarn add airbnb-private-api
Usage
Import library
const AirBnbClient = ;
Authorization By Email
_authentication_by_email
- If the request was successful then you don't need to execute this method anymore. All required AUTH data will be saved to a JSON file
- Authorization by using email and password
- New device credentials will be generated
- To make it convenient the login token and the device details will be saved to a file {session_path}/{email}.json for the future usage
let airbnb = email: 'email@example.com' password: 'password' session_path: '/user/bob/Downloads';async try let response = await airbnb; console; catch error console;
Authorization By Phone
_authentication_by_phone
- This is the best way to authorize to the AirBnb. In that case chances of receiving checkpoint are drastically lower
- If the request was successful then you don't need to execute this method anymore. All required AUTH data will be saved to a JSON file
- Authorization by using phone
- New device credentials will be generated
- To make it convenient the login token and the device details will be saved to a file {session_path}/{email}.json for the future usage
let airbnb = phone: '18009009899' session_path: '/user/bob/Downloads';async try // First you need to send request to receive the SMS code await airbnb; // After receiving the SMS code you need to submit it in order to receive the login credentials let response = await airbnb; console; catch error console;
_load_session
- Before calling any other method, we need to load an active session
- Method _load_session() will load the device credentials and auth token from the a {session_path}/{email}.json
async try await airbnb; catch error console;
Profile
_get_my_profile
- Method is returning all your profile information
async try let response await airbnb; console catch error console;
_get_user_profile
- Method is returning public user details
- USER_ID - positive number(>0)
async try let response = await airbnb; console catch error console;
_get_wishlists
- Method is returning items that are located in the Saved section of your profile
- Method is accepting an object with _limit and _offset values
- _limit - limit of items to display. Defaut value: 10
- _offset - number of items to skip. Default value: 0
async try let response = await airbnb; console catch error console;
Search
_get_listings_from_search
- Method will return ARRAY of home listings from a search result
- Method is accepting an object:
// Number of items to return: {number default: 30} _limit // Number of items to skip: {number default: 0} _offset // Number of adults: {number default: 0} adults // Number of children: {number default: 0} children // Number of infants: {number default: 0} infants // ISO Check In date. For example: '2020-02-17': {string default: ''} checkin // ISO Check Out date. For example: '2020-02-20': {string default: ''} checkout // Search query. For example: Boston, MA, USA : {string default: ''} query // Array of amenities ID's: {array default: number[]} // Some of the ID's that i figured out // 30 - Heating // 44 - Hangers // 4 - WiFi // 8 - Kitchen // 45 - Hair Drier // 41 - Shampoo // 5 - AC // 33 - Washer // 34 - Dryer // 27 - Fireplace // 46 - Iron // 47 - Laptop friendly workspace // 58 - Tv // 64 - High chair // 58 - Self check in // 35 - Smoke alarm // 36 - Carbon monoxide alarm // 78 - Private bathroom // 12 - Pets allowed // 9 - Free parking on premises // 25 - Hot Tub amenities // Array of room types: {array default: string[]} // Possible values: "Entire home/apt", "Private room", "Hotel room", "Shared room" room_types // Show only instant bookings: {boolean default: false} ib // Show only superhosts: {boolean default: false} superhost // Minimum price: {number default: } price_min // Maximum price: {number default: } price_max // Minimum bathrooms: {number default: } min_bathrooms // Minimum bedrooms: {number default: } min_bedrooms // Minimum beds: {number default: } min_beds
- If some values are empty then you will receive an empty array
async { try let response = await airbnb; console; catch error console; };
Listing
_get_listings
- Method is returning a list of your listed properties
- Method is accepting an object with id and _limit values
- id - listing id. If not specified then method will return _limit number of listings. Defaut value: 0
- _limit - number of listings to return. Default value: 10
async try let response = await airbnb; console catch error console;
Calendar
_update_calendar_price
- Method is updating the price on the listing_id on the specified dates
- Method is accepting an object with the listing_id , daily_price and dates
- listing_id: number - listing id
- daily_price: number - new price
- dates: Array[ISO_DATE] - array of ISO dates. Date should be in ISO format. For example ['2020-02-18', '2020-02-19', '2020-02-28']
async try let response = await airbnb; console catch error console;
_update_calendar_availability
- Method is updating availablity for the listing_id
- Method is accepting an object with the listing_id , availability and dates
- listing_id: number - listing id
- availability: boolean - true available, false not available
- dates: Array[ISO_DATE] - array of iso dates. Date should be in ISO format. For example ['2020-02-18', '2020-02-19', '2020-02-28']
async try let response = await airbnb; console catch error console;
_update_calendar_note
- Method is updating note on the listing_id for the specified dates
- Method is accepting an object with the listing_id , notes and dates
- listing_id: number - listing id
- notes: string - any string
- dates: Array[ISO_DATE] - array of iso dates. Date should be in ISO format. For example ['2020-02-18', '2020-02-19', '2020-02-28']
async try let response = await airbnb; console catch error console;
_update_calendar_smart_pricing
- Method is enabling or disabled smart pricing on the listing_id for the specified dates
- Method is accepting an object with listing_id , active and dates
- listing_id: number - listing id
- active: boolean - true enabled, false disabled
- dates: Array[ISO_DATE] - array of iso dates. Date should be in ISO format. For example ['2020-02-18', '2020-02-19', '2020-02-28']
async try let response = await airbnb; console catch error console;
Messages
_messaging_syncs
- Method will synchronize latest messages from your profile
- Method is accepting an object:
//Profile type 'guest', 'host', 'experience_host' or 'guest_and_host': {string default: 'host'} type //Number of items to return: {number default: 10} _limit
- If someone will send you a message then you can retrieve details of the message(thread) by calling this method. Airbnb App is calling this method once in a while to sync all new messages with the App.
async try let response = await airbnb; console catch error console;
_get_threads_ids
- Method will return thread id's
- Method is accepting an object with the _limit , _offset and type
- _limit: number - number of items to return: Default 10
- _offset: number - number of items to skip: Default 0
- type: string - inbox type. Can be 'guest', 'host', 'experience_host' or 'guest_and_host'. Default 'host'
async try let response = await airbnb; console catch error console;
_get_thread_by_id
- Method will return conversations from a specific thread id(conversation id)
- Method is accepting an object:
//Thread id: {number default: null} id
async try let response = await airbnb; console catch error console;
_get_threads_full
- The more threads you request the longer request will execute
- Method will return full thread(conversation) data for the last _limit threads
- Method is accepting an object with the _limit , _offset and type
- _limit: number - number of items to return: Default 10
- _offset: number - number of items to skip: Default 0
- type: string - inbox type. Can be 'guest', 'host', 'experience_host' or 'guest_and_host'. Default 'host'
async try let response = await airbnb; console catch error console;
Reservations
_get_reservations
- Method will return a (_limit ) number of reservations
- Method is accepting an object:
//Number of items to return: {number default: 30} _limit //Number of items to skip: {number default: 0} _offset //ISO date. For example '2020-02-17': {string default: CURRENT_DATE} //Show only reservation from start_date start_date //ISO date. For example '2020-02-17': {string default: ''} //Show only reservation till end_date end_date //You can sort list by 'start_date', 'nights', 'number_of_guests' and 'status': {string default: 'start_date'} order_by //Include accepted reservations: {boolean default: true} include_accept //Include canceled reservations: {boolean default: false} include_canceled //Include reservations with additional verification request: {boolean default: false} include_checkpoint //Include canceled reservations: {boolean default: false} include_pending;
async try let response = await airbnb; console catch error console;
_get_reservation_details
- Method will return details from the specified RESERVATION_ID
- RESERVATION_ID - string
async try let response = await airbnb; console catch error console;
Examples
const AirBnbClient = ; let airbnb = email: 'email@example.com' password: 'password' session_path: '/user/bob/Downloads'; // If we do not have an active session then we need to call _authentication_by_email() or _authentication_by_phone() method// If authorization was succesfull(no errors) then Do Not Use this method anymore in the futureasync try await airbnb; let my_listings = await airbnb; console catch error console; // If we already have an active session then we need to load session details with method _load_session()async try await airbnb; let my_listings = await airbnb; console catch error console;
Options
let options = //Email: {string default: ""} email: "exampl@mail.com" //Password: {string default: ""} password: 'bob' //Set proxy: {string default: ""} proxy: "" //Set currency: {string default: "USD"} currency: 'USD' //Set locale: {string default: "en-US"} locale: 'en-US' // Session is stored in json file and file it self should be stored somewhere // Set session file location: {string default: "{HOME_DIR}/Downloads} session_path:'/user/bob/Downloads';
License
MIT
Free Software