Lydira API
EN

API referansı

Ticket printer

2 uç nokta

The Air Printer ingest: a desktop agent watches the GDS ticketing-printer folder and POSTs each new file here, where it is parsed into a draft ticket sale. Requires a key with the ticket_import (or full) scope — the narrow one is the point, since the agent runs on a PC in an agency office.

Idempotent twice over: the same BYTES answer 200 with status: "duplicate", and so does a re-print carrying a ticket number the account already holds (a different file, same document). The agent replays its watch folder after any restart, so that is the normal case rather than the exotic one.

Recent captures

GET/api/v1/ticket_imports

Dar kapsamlı anahtarla da çalışır: ticket_import

Newest first. Doubles as the agent's "test connection" probe and its "last N imported" panel; walk page.next_cursor to read back past the first page, which is what a reconnecting agent needs after an outage.

Parametreler

Sorgu

  • limitintegervarsayılan 25

    Rows per page.

  • cursorstring

    Opaque; take it from the previous response's page.next_cursor.

Yanıt · 200

  • dataobject[]zorunlu
    Alanları göster
    • iduuid
    • statusenum

      şunlardan biriparsedduplicatefailed

    • providerstring
    • formatstring
    • filenamestringnull olabilir
    • ticket_sale_iduuidnull olabilir
    • errorstringnull olabilir
    • captured_atdate-timenull olabilir
    • created_atdate-time
    • duplicate_ticket_numbersstring[]null olabilir

      On a ticket-grain duplicate, the document numbers this capture repeats.

  • pageobjectzorunlu

    The cursor for the list beside it. Re-send the same request with ?cursor=<next_cursor> while has_more is true. next_cursor is null on the last page.

    Alanları göster
    • next_cursorstringzorunlunull olabilir
    • has_morebooleanzorunlu
    • limitintegerzorunlu

Yanıtlar

  • 401Missing or invalid Bearer token
  • 403The key lacks the required scope, or the plan doesn't include API access
  • 429Rate limit exceeded
curl -X GET 'https://YOUR-CELL.lydira.com/api/v1/ticket_imports' \
  -H 'Authorization: Bearer sek_YOUR_API_KEY'
Yanıt
200
{
  "data": [
    {
      "id": "9d2f7c3a-1b4e-4a7d-8e51-2c0f6b9a4d18",
      "status": "parsed",
      "provider": "amadeus",
      "format": "amadeus_air",
      "filename": "voucher.pdf",
      "ticket_sale_id": "9d2f7c3a-1b4e-4a7d-8e51-2c0f6b9a4d18",
      "error": "string",
      "captured_at": "2026-03-14T09:30:00Z",
      "created_at": "2026-03-14T09:30:00Z",
      "duplicate_ticket_numbers": [
        "string"
      ]
    }
  ],
  "page": {
    "next_cursor": "MjAyNi0wMy0xNFQwOTozMDowMC4wMDAwMDBafDk0MQ",
    "has_more": true,
    "limit": 25
  }
}

Submit a printer file

POST/api/v1/ticket_imports

Dar kapsamlı anahtarla da çalışır: ticket_import

201 when the file parsed into a new draft sale, 200 when it was already captured (same bytes, or a ticket number the account holds) and 422 when it could not be parsed — the capture is still recorded, so a failure is visible rather than lost.

The GDS and the format are sniffed from the CONTENT and are authoritative over any provider / format the agent sends.

Parametreler

Başlık

  • Idempotency-Keystring

    Your own unique string for this write (a UUID is the obvious choice), max 255 characters. Optional: omit it and nothing changes. Send it and a repeat of the same request returns this call's response verbatim, with Idempotent-Replay: true, instead of writing again.

Gövde

  • contentstringzorunlu

    The printer file, base64-encoded.

  • filenamestring
  • encodingstring

    Source encoding

  • providerstring

    A hint only; the content decides.

  • formatstring

    A hint only; the content decides.

  • agentobject

    The desktop agent's own build, for support.

    Alanları göster
    • versionstring
    • hoststring
    • osstring

Yanıt · 200

  • iduuid
  • statusenum

    şunlardan biriduplicate

  • providerstring
  • formatstring
  • filenamestringnull olabilir
  • ticket_sale_iduuidnull olabilir
  • errorstringnull olabilir
  • captured_atdate-timenull olabilir
  • created_atdate-time
  • duplicate_ticket_numbersstring[]null olabilir

Yanıtlar

  • 201Parsed into a new draft ticket sale
  • 401Missing or invalid Bearer token
  • 403The key lacks the required scope, or the plan doesn't include API access
  • 422The file could not be parsed; the capture is recorded anyway
  • 429Rate limit exceeded
curl -X POST 'https://YOUR-CELL.lydira.com/api/v1/ticket_imports' \
  -H 'Authorization: Bearer sek_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: 8f14e45f-ea2c-4f33-9a3b-6d0c1b7e5a90' \
  -d '{
  "content": "string",
  "filename": "AIR07.05.24.1342.0000.txt",
  "encoding": "string",
  "provider": "string",
  "format": "string",
  "agent": {
    "version": "string",
    "host": "string",
    "os": "string"
  }
}'
Yanıt
200
{
  "id": "9d2f7c3a-1b4e-4a7d-8e51-2c0f6b9a4d18",
  "status": "duplicate",
  "provider": "amadeus",
  "format": "amadeus_air",
  "filename": "voucher.pdf",
  "ticket_sale_id": "9d2f7c3a-1b4e-4a7d-8e51-2c0f6b9a4d18",
  "error": "string",
  "captured_at": "2026-03-14T09:30:00Z",
  "created_at": "2026-03-14T09:30:00Z",
  "duplicate_ticket_numbers": [
    "string"
  ]
}