Lydira API
EN

Kılavuzlar

Hızlı başlangıç

Anahtardan ilk rezervasyona beş çağrı. Önce sayfanın üstünden hücrenizi seçin; aşağıdaki bütün örnekler o adrese göre yazılır.

  1. 1

    Anahtar alın

    Lydira'da Ayarlar → API anahtarları sayfasından yeni bir anahtar oluşturun. İşi gören en dar kapsamı seçin. Rezervasyon gönderen partner sistemi için import, masaüstü bilet yazıcısı için ticket_import, hesabın geri kalanını gerçekten okumanız gerekiyorsa full. Anahtar sek_ ile başlar ve yalnızca bir kez gösterilir.
    Settings → API keys
    
      Name    Partner sync
      Scope   full | ticket_import | import
      Token   sek_…  (shown once)
  2. 2

    Adrese ulaştığınızı görün

    Health anahtar istemez. Burada bir hata alıyorsanız sorun adrestedir, başka bir yerde değil.
    curl https://YOUR-CELL.lydira.com/api/v1/health
    
    { "ok": true, "api": "v1" }
  3. 3

    Anahtarı sınayın

    Anahtarınızın gerçekte ne olduğunu söyleyen tek çağrı /me. Döndüğü companies[].id ve branches[].id değerlerini saklayın; aktarım uçları bunları alır ve başka hiçbir yerde görünmezler.
    curl https://YOUR-CELL.lydira.com/api/v1/me \
      -H 'Authorization: Bearer sek_YOUR_API_KEY'
  4. 4

    Rezervasyonu önce deneyin

    Her aktarım ucunun, aynı yolu koşan ama hiçbir şey yazmayan bir ikizi var. Denemede yeşil olan gerçekte de yeşil olur; atlamak için sebep yok.
    curl -X POST https://YOUR-CELL.lydira.com/api/v1/imports/hotel_stays/validate \
      -H 'Authorization: Bearer sek_YOUR_API_KEY' \
      -H 'Content-Type: application/json' \
      -d '{
      "rows": [
        {
          "external_id": "HOTEL-STAY-1001",
          "check_in_on": "2026-03-14",
          "check_out_on": "2026-03-18",
          "currency": "EUR",
          "guest_count": 2,
          "customer_external_id": "CUSTOMER-1001",
          "supplier_external_id": "SUPPLIER-1001",
          "status": "draft",
          "notes": "Imported from the source system.",
          "rate_basis": "net",
          "margin_mode": "percent",
          "option_date": "2026-03-14",
          "transaction_date": "2026-03-14",
          "invoice_date": "2026-03-18",
          "cost_lines": [
            {
              "kind": "room_rate",
              "amount": "1250.00",
              "label": "Imported line",
              "currency": "EUR",
              "vat_rate": "20",
              "tax_inclusive": true,
              "quantity": 1
            }
          ],
          "sell_lines": [
            {
              "kind": "package_price",
              "amount": "1250.00",
              "label": "Imported line",
              "currency": "EUR",
              "vat_rate": "20",
              "tax_inclusive": true,
              "quantity": 1
            }
          ],
          "travelers": [
            {
              "first_name": "Ada",
              "last_name": "Lovelace",
              "nationality": "TR",
              "national_id": "10000000146",
              "passport_number": "U01234567",
              "passport_country": "TR",
              "passport_expiry": "2031-06-30",
              "date_of_birth": "1988-04-21",
              "gender": "female",
              "frequent_flyer_number": "TK123456789"
            }
          ],
          "rooms": [
            {
              "name": "Deluxe Sea View",
              "room_type": "double",
              "capacity": 2,
              "occupancy": 2,
              "nightly_rate": "180.00",
              "single_supplement_amount": "60.00",
              "single_supplement_currency": "EUR"
            }
          ]
        }
      ]
    }'
  5. 5

    Şimdi gerçekten gönderin

    Aynı gövde, /validate olmadan. Bozuk bir satır tek başına düşer ve hangi alan yüzünden düştüğünü söyler; partinin geri kalanı içeri girer.
    curl -X POST https://YOUR-CELL.lydira.com/api/v1/imports/hotel_stays \
      -H 'Authorization: Bearer sek_YOUR_API_KEY' \
      -H 'Content-Type: application/json' \
      -H 'Idempotency-Key: 8f14e45f-ea2c-4f33-9a3b-6d0c1b7e5a90' \
      -d '{
      "rows": [
        {
          "external_id": "HOTEL-STAY-1001",
          "check_in_on": "2026-03-14",
          "check_out_on": "2026-03-18",
          "currency": "EUR",
          "guest_count": 2,
          "customer_external_id": "CUSTOMER-1001",
          "supplier_external_id": "SUPPLIER-1001",
          "status": "draft",
          "notes": "Imported from the source system.",
          "rate_basis": "net",
          "margin_mode": "percent",
          "option_date": "2026-03-14",
          "transaction_date": "2026-03-14",
          "invoice_date": "2026-03-18",
          "cost_lines": [
            {
              "kind": "room_rate",
              "amount": "1250.00",
              "label": "Imported line",
              "currency": "EUR",
              "vat_rate": "20",
              "tax_inclusive": true,
              "quantity": 1
            }
          ],
          "sell_lines": [
            {
              "kind": "package_price",
              "amount": "1250.00",
              "label": "Imported line",
              "currency": "EUR",
              "vat_rate": "20",
              "tax_inclusive": true,
              "quantity": 1
            }
          ],
          "travelers": [
            {
              "first_name": "Ada",
              "last_name": "Lovelace",
              "nationality": "TR",
              "national_id": "10000000146",
              "passport_number": "U01234567",
              "passport_country": "TR",
              "passport_expiry": "2031-06-30",
              "date_of_birth": "1988-04-21",
              "gender": "female",
              "frequent_flyer_number": "TK123456789"
            }
          ],
          "rooms": [
            {
              "name": "Deluxe Sea View",
              "room_type": "double",
              "capacity": 2,
              "occupancy": 2,
              "nightly_rate": "180.00",
              "single_supplement_amount": "60.00",
              "single_supplement_currency": "EUR"
            }
          ]
        }
      ]
    }'

Sırada ne var