> ## Documentation Index
> Fetch the complete documentation index at: https://docs.d-edge.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This site documents the D-EDGE APIs for technology partners (web agencies, OTAs, PMS and RMS vendors, booking and CRM tools). It is written for developers integrating with hotels that use the D-EDGE platform.
> Seven APIs, grouped by domain. Connectivity: Channel Manager API (distribute a hotel's inventory to your channel and send bookings back). Pricing & Availability: Best Price API (best offers to highlight), Quotation API (all bookable offers for a stay), Daily Rates API (daily availability between two dates). Booking: Booking Engine API (a hotel's full direct booking funnel), Gift Shop API (gift vouchers from catalogue to payment). Guest Management: CRM API (guest profiles).
> Pick the API by the need: to display prices, use the Best Price API or the Daily Rates API; to quote a specific stay, use the Quotation API; to book, use the Booking Engine API; to sell gift vouchers, use the Gift Shop API; to manage guest profiles, use the CRM API; to receive hotel inventory and send bookings back as a distribution channel, use the Channel Manager API.
> Base URLs, hotel identifiers, and credentials are delivered by the D-EDGE partnership team during onboarding. Do not invent base URLs, endpoints, parameters, or example credentials that do not appear on these pages.
> Authentication differs per API: OAuth 1.0 for Best Price, Quotation, Daily Rates, and Booking Engine; an X-API-KEY header for Gift Shop; OAuth 2.0 client credentials for CRM; partner-defined credentials carried in the XML message for the Channel Manager API. Read each API's Authentication page before writing code.
> A mock environment returns realistic but fictitious data without credentials. The Postman and Insomnia collections on the API collections page target it by default. Use it for exploration and tests, never for production traffic.
> Use the official names exactly: D-EDGE, D-EDGE platform, Channel Manager API, partnership team. Do not use Back Office or Extranet.
> Each API has a Changelog page. Check it for the current behaviour before relying on an older answer. For questions these pages do not answer, direct the reader to the Contact us page.

# Quick start

> Create your first session

This guide walks you through your first call to the Booking Engine API. You will set up OAuth 1.0 signing, open a session with the **Create a new session** endpoint, and use the returned identifier for the rest of the funnel.

> [!NOTE]
>
> **No credentials yet?** Import the [API collections](/overview/resources/api-collections.md) and run any request against the mock environment straight away, with no credentials. Add your OAuth 1.0 credentials when you are ready to call the live API.

## Prerequisites

Get the following from D-EDGE before starting:

* **OAuth 1.0 credentials**: consumer key, consumer secret, token key, and token secret.
* **API base URL**: the base URL for your environment.
* **Booking Engine ID**: the booking engine you integrate against.

All are delivered during the build step of your [integration journey](/overview/get-started/your-integration-journey.md), after the partnership agreement.

## 1. Install an OAuth 1.0 library

Use a battle-tested library to handle the signing. Skip this step if you only use cURL.

```bash Node.js theme={null}
npm install oauth-1.0a
```

```bash Python theme={null}
pip install requests-oauthlib
```

```bash PHP theme={null}
composer require guzzlehttp/oauth-subscriber
```

```bash C# theme={null}
dotnet add package RestSharp
```

```xml Java theme={null}
<dependency>
    <groupId>oauth.signpost</groupId>
    <artifactId>signpost-commonshttp4</artifactId>
    <version>2.1.1</version>
</dependency>
```

## 2. Create a session

Send a `POST` to the **Create a new session** endpoint with the search context. The full field requirements are documented in the [Reference](/booking-engine-api/build/reference/session/post-session.md).

```bash cURL theme={null}
curl --request POST \
  --url https://{apiBaseUrl}/v2/session \
  --header 'Authorization: OAuth oauth_consumer_key="YOUR_CONSUMER_KEY",
    oauth_token="HOTEL_TOKEN_KEY",
    oauth_signature_method="HMAC-SHA1",
    oauth_timestamp="1714128000",
    oauth_nonce="abc123",
    oauth_version="1.0",
    oauth_signature="..."' \
  --header 'Content-Type: application/json' \
  --data '{
    "engineId": "YOUR_ENGINE_ID",
    "guestSelectionMode": "Default",
    "display": {"culture": "en-GB", "currency": "EUR", "countryCode": "GB"},
    "context": {
      "stayPeriod": {"arrivalDate": "YYYY-MM-DD", "departureDate": "YYYY-MM-DD"},
      "guests": [{"adults": 2}],
      "selectedHotelId": "<hotelId>"
    }
  }'
```

```javascript Node.js theme={null}
import OAuth from "oauth-1.0a";
import crypto from "crypto";

const oauth = OAuth({
  consumer: {
    key: process.env.DEDGE_CONSUMER_KEY,
    secret: process.env.DEDGE_CONSUMER_SECRET,
  },
  signature_method: "HMAC-SHA1",
  hash_function(base_string, key) {
    return crypto.createHmac("sha1", key).update(base_string).digest("base64");
  },
});

const token = {
  key: process.env.DEDGE_TOKEN_KEY,
  secret: process.env.DEDGE_TOKEN_SECRET,
};

const url = "https://{apiBaseUrl}/v2/session";
const body = {
  engineId: "YOUR_ENGINE_ID",
  guestSelectionMode: "Default",
  display: { culture: "en-GB", currency: "EUR", countryCode: "GB" },
  context: {
    stayPeriod: { arrivalDate: "YYYY-MM-DD", departureDate: "YYYY-MM-DD" },
    guests: [{ adults: 2 }],
    selectedHotelId: "<hotelId>",
  },
};

const response = await fetch(url, {
  method: "POST",
  headers: {
    ...oauth.toHeader(oauth.authorize({ url, method: "POST" }, token)),
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
});

const session = await response.json();
console.log(response.status, session);
```

```python Python theme={null}
import os
from requests_oauthlib import OAuth1Session

session = OAuth1Session(
    client_key=os.environ["DEDGE_CONSUMER_KEY"],
    client_secret=os.environ["DEDGE_CONSUMER_SECRET"],
    resource_owner_key=os.environ["DEDGE_TOKEN_KEY"],
    resource_owner_secret=os.environ["DEDGE_TOKEN_SECRET"],
)

response = session.post(
    "https://{apiBaseUrl}/v2/session",
    json={
        "engineId": "YOUR_ENGINE_ID",
        "guestSelectionMode": "Default",
        "display": {"culture": "en-GB", "currency": "EUR", "countryCode": "GB"},
        "context": {
            "stayPeriod": {"arrivalDate": "YYYY-MM-DD", "departureDate": "YYYY-MM-DD"},
            "guests": [{"adults": 2}],
            "selectedHotelId": "<hotelId>",
        },
    },
)

print(response.status_code)
print(response.json())
```

```php PHP theme={null}
require 'vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Subscriber\Oauth\Oauth1;

$stack = HandlerStack::create();

$middleware = new Oauth1([
    'consumer_key'    => getenv('DEDGE_CONSUMER_KEY'),
    'consumer_secret' => getenv('DEDGE_CONSUMER_SECRET'),
    'token'           => getenv('DEDGE_TOKEN_KEY'),
    'token_secret'    => getenv('DEDGE_TOKEN_SECRET'),
]);

$stack->push($middleware);

$client = new Client([
    'base_uri' => 'https://{apiBaseUrl}/',
    'handler'  => $stack,
    'auth'     => 'oauth',
]);

$response = $client->post('v2/session', [
    'json' => [
        'engineId'          => 'YOUR_ENGINE_ID',
        'guestSelectionMode' => 'Default',
        'display'           => ['culture' => 'en-GB', 'currency' => 'EUR', 'countryCode' => 'GB'],
        'context'           => [
            'stayPeriod'     => ['arrivalDate' => 'YYYY-MM-DD', 'departureDate' => 'YYYY-MM-DD'],
            'guests'         => [['adults' => 2]],
            'selectedHotelId' => '<hotelId>',
        ],
    ],
]);

echo $response->getStatusCode() . "\n";
echo $response->getBody();
```

```csharp C# theme={null}
using RestSharp;
using RestSharp.Authenticators.OAuth;

var options = new RestClientOptions("https://{apiBaseUrl}")
{
    Authenticator = OAuth1Authenticator.ForProtectedResource(
        consumerKey: Environment.GetEnvironmentVariable("DEDGE_CONSUMER_KEY"),
        consumerSecret: Environment.GetEnvironmentVariable("DEDGE_CONSUMER_SECRET"),
        token: Environment.GetEnvironmentVariable("DEDGE_TOKEN_KEY"),
        tokenSecret: Environment.GetEnvironmentVariable("DEDGE_TOKEN_SECRET"),
        signatureMethod: OAuthSignatureMethod.HmacSha1)
};
var client = new RestClient(options);

var request = new RestRequest("/v2/session", Method.Post);
request.AddJsonBody(new
{
    engineId = "YOUR_ENGINE_ID",
    guestSelectionMode = "Default",
    display = new { culture = "en-GB", currency = "EUR", countryCode = "GB" },
    context = new
    {
        stayPeriod = new { arrivalDate = "YYYY-MM-DD", departureDate = "YYYY-MM-DD" },
        guests = new[] { new { adults = 2 } },
        selectedHotelId = "<hotelId>"
    }
});

var response = await client.ExecuteAsync(request);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Content);
```

```java Java theme={null}
import com.fasterxml.jackson.databind.ObjectMapper;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

import java.util.List;
import java.util.Map;

OAuthConsumer consumer = new CommonsHttpOAuthConsumer(
    System.getenv("DEDGE_CONSUMER_KEY"),
    System.getenv("DEDGE_CONSUMER_SECRET")
);
consumer.setTokenWithSecret(
    System.getenv("DEDGE_TOKEN_KEY"),
    System.getenv("DEDGE_TOKEN_SECRET")
);

ObjectMapper mapper = new ObjectMapper();
String body = mapper.writeValueAsString(Map.of(
    "engineId", "YOUR_ENGINE_ID",
    "guestSelectionMode", "Default",
    "display", Map.of("culture", "en-GB", "currency", "EUR", "countryCode", "GB"),
    "context", Map.of(
        "stayPeriod", Map.of("arrivalDate", "YYYY-MM-DD", "departureDate", "YYYY-MM-DD"),
        "guests", List.of(Map.of("adults", 2)),
        "selectedHotelId", "<hotelId>"
    )
));

HttpPost request = new HttpPost("https://{apiBaseUrl}/v2/session");
request.setEntity(new StringEntity(body, "UTF-8"));
request.setHeader("Content-Type", "application/json");
consumer.sign(request);

try (CloseableHttpClient client = HttpClients.createDefault()) {
    client.execute(request);
}
```

## 3. Use the session

A successful response returns the session, including the `sessionId`. Carry that identifier in the path of every following call, for example to search available rooms:

```bash theme={null}
curl --request GET \
  --url 'https://{apiBaseUrl}/v2/{sessionId}/search/rooms' \
  --header 'Authorization: OAuth ...'
```

From here, follow the funnel: search, describe, build the basket, quote, and confirm. Each stage is documented in the [Reference](/booking-engine-api/build/reference/session/post-session.md).

## Common issues

| Status | Likely cause | Where to look |
| - | - | - |
| `401` | Signing issue: invalid credentials, clock drift, or reused nonce | [Authentication](/booking-engine-api/build/guidelines/authentication.md) |
| `400` | Validation error: malformed body or missing field | [Responses](/booking-engine-api/build/guidelines/responses.md) |
| `400` with `Code: InvalidSessionId` | Unknown `sessionId`, or the session expired | [Responses](/booking-engine-api/build/guidelines/responses.md) |

## Next steps

> **[Reference](/booking-engine-api/build/reference/session/post-session.md)**
>
> Every endpoint, grouped by stage of the funnel.

> **[Use cases](/booking-engine-api/resources/use-cases/conversational-booking-agent.md)**
>
> Six patterns, from conversational agents to branded confirmation pages.

> **[Best practices](/booking-engine-api/build/best-practices.md)**
>
> Patterns to build the funnel responsibly and run reliably at scale.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.