# Getting started

This guide takes you from zero to your first authenticated response. By the end you will have a credential, an access token, and a `200 OK` from a live endpoint.

## Base URL

Every endpoint is served under a single path prefix on one multi-tenant host:

```
https://ari.console.adrasis.com/api/v1
```

All requests use HTTPS, `application/json` bodies, `snake_case` field names, ISO 8601 dates, ISO 4217 currencies, and opaque `public_id` identifiers. The tenant your credential belongs to is resolved from the access token — there is no tenant path segment or header to set.

## Step 1 — Obtain a credential

Credentials are issued from the **Distribution API Credentials** screen in the Console (`Distribution → API Credentials`). Each credential is bound to a connector and granted one or both scopes:

* `distribution:read` — content and availability/search endpoints.
* `distribution:booking` — prebook, book, and cancel endpoints.

Three authentication mechanisms are offered:

| Mechanism                                      | When to use                                                                      |
| ---------------------------------------------- | -------------------------------------------------------------------------------- |
| **OAuth 2.0 client credentials** (recommended) | Default for all new integrations. You receive a `client_id` and `client_secret`. |
| **HTTP Basic**                                 | Offered for partners that cannot run a token exchange.                           |
| **API key**                                    | Offered for simple machine-to-machine callers.                                   |

The plaintext secret (`client_secret`, Basic password, or API key) is shown **exactly once** at creation time. Store it securely; you cannot retrieve it again — you can only rotate it.

This guide uses OAuth 2.0, the recommended path. See [Authentication](/developer/authentication.md) for the Basic and API-key alternatives.

## Step 2 — Exchange your credential for an access token

OAuth credentials are exchanged for an access token using the `client_credentials` grant. The token endpoint is served under `/api/console/v1`; all other API calls use the `/api/v1` surface:

```bash
curl -s -X POST \
  https://ari.console.adrasis.com/api/console/v1/distribution/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials' \
  -d 'client_id=YOUR_CLIENT_ID' \
  -d 'client_secret=YOUR_CLIENT_SECRET'
```

The response is a short-lived bearer token:

```json
{
  "access_token": "<ACCESS_TOKEN>",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "distribution:read distribution:booking",
  "issued_at": 1748851200
}
```

The token is valid for `expires_in` seconds (3600). Re-request a new one when it expires — no refresh token is issued for this grant.

## Step 3 — Make your first authenticated call

Send the token on the `Authorization` header of every Distribution request.

### List your properties

```bash
curl -s \
  https://ari.console.adrasis.com/api/v1/properties?limit=2 \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
```

```json
{
  "properties": [
    {
      "public_id": "7gQ2kPa9",
      "name": "Grand Bosphorus Hotel",
      "star_rating": 5,
      "country_code": "TR",
      "currency_code": "TRY",
      "timezone_iana": "Europe/Istanbul",
      "content_updated_at": "2026-06-01T08:30:00Z"
    }
  ],
  "pagination": { "page": 1, "limit": 2, "has_more": true }
}
```

### Or run an availability search

```bash
curl -s -X POST \
  https://ari.console.adrasis.com/api/v1/search \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "property_ids": ["7gQ2kPa9"],
    "checkin": "2026-06-10",
    "checkout": "2026-06-13",
    "occupancy": [{ "adults": 2 }],
    "currency": "TRY"
  }'
```

```json
{
  "currency_code": "TRY",
  "results": [
    {
      "property_id": "7gQ2kPa9",
      "total_available": 1,
      "total_blocked": 0,
      "allocations": [
        {
          "allocation_id": "alc_5f3a9c1d8e7b4a2f6c0d9e8b7a6f5c4d",
          "rooms": 1,
          "strategy": "single-room",
          "grand_total": "9000.00",
          "currency": "TRY",
          "slots": [
            {
              "rate_key": "rp_bar:r3Tz9Lm0:single",
              "room_public_id": "r3Tz9Lm0",
              "rate_plan_public_id": "rp_bar",
              "stay_total": "9000.00",
              "status": "AVAILABLE"
            }
          ]
        }
      ]
    }
  ]
}
```

You now have a working integration. The `allocation_id` from a search feeds directly into prebook and book.

## Next steps

* [Authentication](/developer/authentication.md) — token lifecycle, scopes, and the Basic and API-key alternatives.
* [Property content](/developer/property-content.md) — build and delta-refresh your catalogue.
* [The booking flow](/developer/booking-flow.md) — `search → prebook → book → cancel`.
* [Idempotency](/developer/idempotency.md) — safe retries on `POST /book`.
* [Errors](/developer/errors.md) — the error envelope and status-code reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adrasis.gitbook.io/developer/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
