# Get Started

Minical API for PMS partners.

## 1. Introduction

Welcome to our API reference!

REST APIs (which are a type of web API) involves requests and responses, not too unlike visiting a web page. You make a request to a resource stored on a server, and the server responds with the requested information. The protocol used to transport the data is HTTP. “REST” stands for Representational State Transfer.

## 2. Get an API key

If you would like to use the api.minical.io PMS API, please request an API key here:&#x20;

<https://app.minical.io/settings/api_access>

Go to the Settings page \
Settings -> [API Access](https://app.minical.io/settings/api_access)

You will find here the **"Enable API access"** switch When you enable it, an API key will be generated in the input box just below the switch then update the settings page.\
From there you can copy this **Key** and set it in the HTTP header

X-API-KEY :  c74d8325xxxxxxxxxxxxxxf2ed17fc7

![You can easily generate API key by clicking on "Enable minical-app API access" slide button](https://811327896-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRi5vAE8q5IV5CQr0PerQ%2Fuploads%2FNsrgRLzlZ9etJOCptQaj%2Fimage%20\(2\).png?alt=media\&token=347ba02d-247e-4362-87d4-0992ef6f1c80)

{% hint style="info" %}
&#x20;The X-API-KEY and company\_id will need to be submitted with every request
{% endhint %}

## 3. Data Format <a href="#contact-us" id="contact-us"></a>

The API operates with the JSON data format.

Message us on [discord](< https://discord.gg/a7B7RXZ3w5>)

API can be accessed by placing the JSON in the request body. Always use the correct method (mentioned with every request) to send requests to us.

JSON (raw): Set the HTTP header Content-Type: application/json and pass a raw UTF8 encoded json body.


# Charge

<details>

<summary><a href="https://api.minical.io/v2/booking/get_booking_charges">https://api.minical.io/v2/booking/get_booking_charges</a>  <strong>Get Booking Charges</strong> </summary>

This endpoint allows you to get charges of a booking.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

booking\_id                           integer       PMS Booking ID&#x20;

company\_id                         integer       PMS Property ID

</details>

**Responses**

<details>

<summary><strong>200</strong>                                                                  Charges successfully retrieved.</summary>

```html
[
    {
        "charge_id": "192",
        "description": "",
        "date_time": null,
        "booking_id": "450",
        "amount": "50.00",
        "is_deleted": "0",
        "charge_type_id": "8490024049",
        "selling_date": "2020-06-25",
        "user_id": "88",
        "customer_id": "8490850795",
        "pay_period": "0",
        "is_night_audit_charge": "0"
    },
    {
        "charge_id": "202",
        "description": "Premium Package",
        "date_time": null,
        "booking_id": "450",
        "amount": "50.00",
        "is_deleted": "0",
        "charge_type_id": "8490024658",
        "selling_date": "2020-06-25",
        "user_id": "88",
        "customer_id": "8490850795",
        "pay_period": "0",
        "is_night_audit_charge": "0"
    }
]
```

</details>

<details>

<summary><strong>404</strong>  Could not find to matching this query.</summary>

```html
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
{
   "company_id": "8490006340",
   "booking_id": "450"
}
```

&#x20;

<details>

<summary><a href="https://api.minical.io/v2/booking/add_booking_charges">https://api.minical.io/v2/booking/add_booking_charges</a>                                                          <strong>Add Booking Charges</strong> </summary>

This endpoint allows you to add charges of a booking.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

charges/description           string         Description about charge&#x20;

charges/booking\_id           integer       PMS Booking ID

charges/amount                 number      Charge amount

charges/charge\_type\_id    integer       PMS charge type id (service charge etc.)

charges/selling\_date         string         Date on which you want to add charge

company\_id                        integer      PMS Property ID&#x20;

</details>

**Responses**

<details>

<summary><strong>200</strong>                                                     Charges successfully added.</summary>

```html
{ 
   "status": "success" 
}
```

</details>

<details>

<summary><strong>404</strong>                                                     Could not find to matching this query.           </summary>

```html
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
    "company_id": "8490006340",
    "charges":[
        {
            "description": "first charge",
            "booking_id": "450",
            "amount": "50.00",
            "charge_type_id": "8490024049",
            "selling_date": "2020-06-25"
        },
        {
            "description": "daily charge",
            "booking_id": "450",
            "amount": "50.00",
            "charge_type_id": "8490024049",
            "selling_date": "2020-06-25"
        }
    ]
}
```


# Payment

<details>

<summary><a href="https://api.minical.io/v2/booking/get_booking_payments">https://api.minical.io/v2/booking/get_booking_payments</a>                                                        <strong>Get Booking Payments</strong></summary>

This endpoint allows you to get payments of a booking.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

company\_id                         integer       PMS Property ID

booking\_id                           integer       PMS Booking ID&#x20;

</details>

**Responses**

<details>

<summary><strong>200</strong>                                                                  Payments successfully retrieved.</summary>

```html
[
    {
        "payment_id": "37",
        "description": "",
        "date_time": "2020-07-06 11:53:31",
        "booking_id": "454",
        "amount": "150.00",
        "payment_type_id": "8490071469",
        "credit_card_id": "1016622",
        "selling_date": "2020-06-25",
        "is_deleted": "0",
        "user_id": "88",
        "customer_id": "8490850999",
        "payment_gateway_used": "MonerisGateway",
        "gateway_charge_id": "8-1_15;454",
        "read_only": "0",
        "payment_status": "charge",
        "parent_charge_id": null,
        "is_captured": "1",
        "logs": null
    },
    {
        "payment_id": "38",
        "description": "",
        "date_time": "2020-07-06 12:48:10",
        "booking_id": "454",
        "amount": "112.00",
        "payment_type_id": "8490071469",
        "credit_card_id": "1016622",
        "selling_date": "2020-06-25",
        "is_deleted": "0",
        "user_id": "88",
        "customer_id": "8490850999",
        "payment_gateway_used": "MonerisGateway",
        "gateway_charge_id": "14-1_15;454_1179703956",
        "read_only": "0",
        "payment_status": "charge",
        "parent_charge_id": null,
        "is_captured": "1",
        "logs": null
    }
]
```

</details>

<details>

<summary><strong>404</strong>  Could not find to matching this query.</summary>

```
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
{
   "company_id": "8490006340",
   "booking_id": "454"
}
```


# Booking

<details>

<summary><a href="https://api.minical.io/v2/booking/receive_booking">https://api.minical.io/v2/booking/receive_booking</a>                                                                   Create Booking</summary>

This endpoint allows you to create booking.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

booking/booking\_notes       string         Extra facilities like Tea/Coffee maker, Shower etc.

booking/source                   string         Booking source (like booking\_dot\_com OR expedia etc.)

booking/card/cvc               number       Customer's card cvc number

booking/card/name            string         Customer's card holder name

&#x20;booking/card/exp\_year      integer      Customer's card expiry year (yy)

booking/card/exp\_month   integer      Customer's card expiry month (mm)

booking/card/number         number     Customer's card number

booking/rate\_plan/currency/currency\_code    string     Currency code (like USD)

booking/rate\_plan/rates/base\_rate                  integer   charge rate for 1 day

booking/rate\_plan/rates/date                           string      End date of rate (check out date - 1 day)

booking/rate\_plan/rates/date\_end                   string      End date of rate (check out date - 1 day)

booking/rate\_plan/rates/date\_start                 string      start date of rate (check in date)

booking/rate\_plan/pms\_rate\_plan\_id               integer    PMS Rate plan ID

booking/rate\_plan/description                         string     description about booking

booking/rate\_plan/number\_of\_adults\_included\_for\_base\_rate     integer   Number of adults

booking/staying\_guest                                     string      staying guest with customer

booking/booking\_customer/country               string      customer's country name

booking/booking\_customer/postal\_code       string      customer's zip/postal code

booking/booking\_customer/city                     string      customer's city name

booking/booking\_customer/address             string     customer's address

booking/booking\_*customer/email                  string      customer's email id*

booking/booking\_*customer/phone*                 number    *customer's phone  number*

booking/booking\_*customer/customer\_name  string      customer's name*

booking/booking\_customer/company\_id        number    PMS property ID

booking/children\_count                                   *string*      Number of children

booking/adult\_count                                       integer    Number of adults

booking/check\_out\_date                               string      Booking check out date

booking/check\_in\_date                                 string      Booking check in date

booking/ota\_type                                          string      Booking source &#x20;

booking/pms\_room\_type\_id                         integer    PMS Room Type ID

booking/company\_id                                    integer    PMS property ID

booking/booking\_type                                 string      Type of booking new / modified /                 cancelled&#x20;

booking/ota\_booking\_id                             integer     Booking  ID

company\_id                                                 integer    PMS property ID

</details>

#### Responses

<details>

<summary><strong>200</strong>                                                                  Booking successfully created.</summary>

```html
{
    "ota_booking_id": "76732432325",
    "pms_booking_id": "482",
    "booking_type": "new"
}
```

</details>

<details>

<summary><strong>404</strong>  Could not find a booking matching this query.</summary>

```
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
{
   "booking":{
      "ota_booking_id": "7673212325",
      "booking_type": "new",
      "company_id": "8490006340",
      "pms_room_type_id": "8490020098",
      "ota_type": "booking_dot_com",
      "source": "2",
      "check_in_date": "2020-07-25",
      "check_out_date": "2020-07-28",
      "adult_count": "3",
      "children_count": "2",
      "booking_notes": "created via Booking.com. Booking ID: 76732432325\nEarlyCheckIn, HighFloor",
      "booking_customer": {
         "company_id": "8490006340",
         "customer_name": "Pk Patidar",
         "phone": "+91 7878765456",
         "email": "abcd@gmail.com",
         "address": "",
         "city": "",
         "postal_code": "",
         "country": ""
      },
      "staying_guest": {
         "guest_name": ""
      },
      "card": {
         "number": "4242424242424242",
         "exp_month": "08",
         "exp_year": "23",
         "name": "Pankaj Patidar",
         "cvc": "123"
      },
      "rate_plan": {
         "rate_plan_name": "booking_dot_com #76732432325",
         "number_of_adults_included_for_base_rate": "3",
         "description": "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.",
         "pms_rate_plan_id": "131335",
         "rates": [
            {
               "date_start": "2020-07-25",
               "date_end": "2020-07-27",
               "date": "2020-07-27",
               "base_rate": "50.00"
            }
         ],
         "currency": {
            "currency_code": "USD"
         }
      }
   },
   "company_id":"8490006340"
}
```

<details>

<summary><a href="#https-api.minical.io-v2-booking-receive_booking-create-booking">https://api.minical.io/v2/booking/get_booking_detail</a>                                                               Get Booking detail (last 15 minute interval)</summary>

This endpoint allows you to get booking detail.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

company\_id                          string         Property ID

</details>

#### Responses

<details>

<summary><strong>200</strong>                                                                  Booking successfully retrieved.</summary>

```
[
    {
        "booking_id": "345",
        "arrival_date": "2022-07-28 00:00:00",
        "departure_date": "2022-07-30 00:00:00",
        "customer_name": "Eeshan Jain",
        "email": "mradul.jain90@gmail.com",
        "booking_source": "Owner",
        "rate": "333",
        "booking_date": "2022-08-18 16:50:18",
        "room_type": "New Room Type",
        "rate_plan": "New Rate Plan #345",
        "customer_type": "VIP"
    },
    {
        "booking_id": "344",
        "arrival_date": "2022-07-29 00:00:00",
        "departure_date": "2022-08-01 00:00:00",
        "customer_name": null,
        "email": null,
        "booking_source": "Walk-in / Telephone",
        "rate": "0",
        "booking_date": "2022-08-18 16:50:14",
        "room_type": "Double Customer",
        "rate_plan": null,
        "customer_type": null
    }
]
```

</details>

<details>

<summary><strong>404</strong>                                                                 Could not find to matching this query.</summary>

```
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
{
   "company_id": "8490006340"
}
```


# Room

<details>

<summary><a href="https://api.minical.io/v2/room_type/get_adr"><strong>https://api.minical.io/v2/room_type/get_adr</strong></a>                                                                                       <strong>Get average daily rate</strong></summary>

This endpoint allows you to get average daily rate of a rate plan.

**Parameter**

**Header**

X-API-KEY                           string         API key&#x20;

**Body**

date\_start                                 string         Start Date

date\_end                                  string         End Date

room\_type\_id                     integer       PMS Room Type ID

rate\_plan\_id                       integer        PMS Rate Plan ID

company\_id                       integer         PMS Property ID

</details>

**Responses**

<details>

<summary><strong>200</strong>                                                                  ADR successfully retrieved.</summary>

```
{
    "adult_1_adr": "100.00",
    "adult_2_adr": "150.00",
    "adult_3_adr": "200.00",
    "adult_4_adr": "250.00"
}
```

</details>

<details>

<summary><strong>404</strong>  Could not find a adr matching this query.</summary>

```
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body

```
{
   "date_start": "2020-07-25",
   "date_end": "2020-07-28",
   "company_id": "8490006340",
   "room_type_id": "8490020098",
   "rate_plan_id": "131335"
}
```


# Rate

<details>

<summary><a href="https://api.minical.io/v2/rates/update_rates">https://api.minical.io/v2/rates/update_rates</a>                                                                              Update Rates</summary>

This endpoint allows you to update rate of a rate plan.

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

rates/date\_start                       string        Start date

rates/date\_end                       string        End date

rates/adult\_1\_rate               number    Rate for 1 adult

rates/adult\_2\_rate               number    Rate for 2 adult

rates/adult\_3\_rate               number    Rate for 3 adult

rates/adult\_4\_rate               number    Rate for 4 adult

rates/additional\_adult\_rate   number   Rate for additional adults

rates/additional\_child\_rate    number   Rate for additional children

rates/minimum\_length\_of\_stay   integer  Stay for minimum number of nights

rates/maximum\_length\_of\_stay  integer  Stay for maximum number of nights

rates/closed\_to\_arrival                boolean    Arrival is closed for given dates (0 for open, 1 for close)

rates/closed\_to\_departure          boolean      Departure is closed for given dates (0 for open, 1 for close)       &#x20;

rates/can\_be\_sold\_online            boolean      1 for sell, 0 for not sell

rate\_plan\_id                                  integer        PMS Rate Plan ID

company\_id                                  integer        PMS Property ID

</details>

**Responses**

<details>

<summary><strong>200</strong>                                                                  Rate successfully updated.</summary>

```
{
    "status": "success"
}
```

</details>

<details>

<summary><strong>404</strong>  Could not find a rate matching this query.</summary>

```
{
    "status": false,
    "error": "Unknown method."
}
```

</details>

#### Request Body <a href="#request-body" id="request-body"></a>

```
{
    "company_id":"8490006340",
    "rate_plan_id":"168265",
    "rates":[
        {
            "date_start":"2020-07-05",
            "date_end":"2020-07-10",
            "adult_1_rate": "221.00",
            "adult_2_rate": "332.00",
            "adult_3_rate": "443.00",
            "adult_4_rate": "554.00",
            "additional_adult_rate": 155,
            "additional_child_rate": 266,
            "minimum_length_of_stay": "1",
            "maximum_length_of_stay": "10",
            "closed_to_arrival": "0",
            "closed_to_departure": "0",
            "can_be_sold_online": "1"
        },
        {
            "date_start":"2020-07-15",
            "date_end":"2020-07-20",
            "adult_1_rate": "22.00",
            "adult_2_rate": "32.00",
            "adult_3_rate": "43.00",
            "adult_4_rate": "54.00",
            "additional_adult_rate": 15,
            "additional_child_rate": 26,
            "minimum_length_of_stay": "1",
            "maximum_length_of_stay": "10",
            "closed_to_arrival": "0",
            "closed_to_departure": "0",
            "can_be_sold_online": "1"
        }
    ]
}
```


# Availability

<details>

<summary><a href="/minical-api/availability">https://api.minical.io/v2/inventory/update_availabil</a><a href="/minical-api/availability">ity</a><br><strong>Update Availability</strong></summary>

This endpoint allows you to update the availability

**Parameter**

**Header**

X-API-KEY                            string         API key&#x20;

**Body**

date\_start                       string        Start date

date\_end                         string        End date

availability                    number     Availability

channel\_id                     number    Channel ID

room\_type\_ids              number    Room Type ID

company\_id                   integer      PMS Property ID

</details>

Note: Make sure you use channel\_id is **1** OR **9**\
1 for **"Channex**\
2 for **"Online Booking Engine"**

**Request Body Example**

```
{
    "company_id":"696",
    "channel_id":"9",
    "room_type_ids":"2353,2356",
    "date_start":"2024-12-25",
    "date_end":"2024-12-30",
    "availability":"2"
}
```

**Response**

<details>

<summary>200                                                                                   Availability successfully updated</summary>

```
{
    "status": "success"
}
```

</details>


