OTAs: How to connect to Beds24 using API V2

From Beds24 Wiki
Revision as of 02:37, 23 October 2024 by Asher (talk | contribs) (Created page with "Category:API_V2 Category:Connect PMS or OTA <div class="heading">OTAs: How to connect to Beds24 using API V2</div> This page explains how OTAs can develop API conne...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


OTAs: How to connect to Beds24 using API V2
This page explains how OTAs can develop API connectivity with Beds24

1 Functions

1.1 The Basics

It is a good idea to get a basic understanding of how Beds24 works.

We recommend going through this introduction and creating a test property with prices and any data you intend to use.

1.2 The API

Beds24 has two API versions, V1 and V2, we recommend using V2 for any new projects.

Documentation for API V2 is available here.

There is also interactive Swagger documentation. We recommend using Swagger to try the examples in this guide.

1.3 API V2 Authentication

API V2 uses refresh tokens which generate access tokens, these tokens will be included as headers in your requests in this format: "token: {token}"

To obtain a refresh token, first go the API page in the control panel and click the generate invite code button. Select the scopes you require then click the generate invite code button. You will now see an invite code on this page, you can copy this to your clipboard and use the GET /authentication/setup endpoint to exchange your invite code for a refresh token.

Request:

curl -X 'GET' \ 'https://beds24.com/api/v2/authentication/setup' \ -H 'accept: application/json' \ -H 'code: abc123'

Response:

{
  "token": "qEK5L...",
  "expiresIn": 86400,
  "refreshToken": "iexTC..."
}

In the above example, "token" is a short term access token that you will use to authenticate other API calls, "expiresIn" is how many seconds the token will last, finally you can use "refreshToken" to generate more tokens in the future.

Try making an invite code and exchanging it for a refresh token yourself with our Swagger page

1.4 Retrieving property data from Beds24

You can get properties from Beds24 using the GET /properties endpoint.

Try GETing properties with this request

curl -X 'GET' \ 'https://beds24.com/api/v2/properties' \ -H 'accept: application/json' \ -H 'token: 123...'

If successful, you should be able to see information about your properties in the JSON response.

In Swagger, try clicking the "schema" under POST /properties to see all the fields you can set using this endpoint.

By default not all property data will be returned, to include additional information in the response you can include parameters. For example, to include all of a property's room data in the response, add the parameter ?includeAllRooms=true to the request URL

curl -X 'GET' \ 'https://beds24.com/api/v2/properties?includeAllRooms=true' \ -H 'accept: application/json' \ -H 'token: 123...'

1.5 Price and availability

1.6 Bookings