İçeriğe geç
GlobalTrustIDdocs

Doğrulama Oturumları

Oturum uç noktalarının istek ve yanıt sözleşmesi.

Oturum aç#

HTTP
POST /v1/verification/session
Authorization: Bearer sk_live_...
Content-Type: application/json

İstek

AlanTürZorunluAçıklama
scopediziEvetİstenen alanlar. 1–12 arası.
webhook_urlmetinHayırSonucun POST edileceği https adres.
JSON
{
  "scope": ["identity.first_name", "identity.last_name"],
  "webhook_url": "https://sizin-siteniz.com/gti/webhook"
}

Yanıt200 OK

JSON
{
  "status": true,
  "data": {
    "session_id": "01J8ZQ4X7K9M2N3P4Q5R6S7T8U",
    "qr": "https://api.globaltrust.id/v1/verification/session/01J8ZQ.../qr.svg",
    "scope": ["identity.first_name", "identity.last_name"],
    "status": "waiting",
    "expires_at": "2026-09-01T12:30:00Z"
  },
  "error_code": 0,
  "error_message": null
}

Geçerli scope değerleri için Doğrulama Akışı sayfasına bakın.


Oturumu oku#

HTTP
GET /v1/verification/session/{session_id}
Authorization: Bearer sk_live_...

Yalnızca gizli anahtar kabul eder.

Yanıt200 OK

JSON
{
  "status": true,
  "data": {
    "session_id": "01J8ZQ4X7K9M2N3P4Q5R6S7T8U",
    "status": "approved",
    "scope": ["identity.first_name", "identity.last_name"],
    "identity": {
      "identity.first_name": "Ayşe",
      "identity.last_name": "Yılmaz"
    }
  },
  "error_code": 0,
  "error_message": null
}

identity alanı yalnızca oturum onaylandığında ve sonuç henüz zaman aşımına uğramadığında bulunur. Diğer tüm durumlarda alan yoktur.

Dönen identity her zaman oturumun scope'una göre süzülür — istemci ne gönderirse göndersin, istemediğiniz bir alan size ulaşmaz.


QR görüntüsü#

HTTP
GET /v1/verification/session/{session_id}/qr.svg

Anahtar gerektirmez; doğrudan <img src> içinde kullanılabilir. SVG döner, her boyutta net görünür.

HTML
<img src="https://api.globaltrust.id/v1/verification/session/01J8ZQ.../qr.svg"
     alt="Doğrulamak için okutun" width="240" height="240">

Canlı durum (WebSocket)#

Çıktı
wss://api.globaltrust.id/v1/verification/session/{session_id}/ws

Oturumun durumu her değiştiğinde bir mesaj gönderir. Kimlik alanlarını taşımaz — sonucu her zaman sunucunuzdan, gizli anahtarla okuyun.

JavaScript
const ws = new WebSocket(
  "wss://api.globaltrust.id/v1/verification/session/" + sessionId + "/ws"
);

ws.onmessage = function (event) {
  const durum = JSON.parse(event.data);
  if (durum.status === "approved") {
    // Sonucu kendi sunucunuzdan isteyin.
    fetch("/benim-sunucum/dogrulama-tamam?session=" + sessionId);
  }
};

Mobil uygulamaya ait uçlar#

/scan ve /decide uçları GlobalTrustID mobil uygulaması tarafından kullanılır ve cihaz imzasıyla kimliklendirilir. Entegratörlerin bu uçlara istek göndermesi gerekmez.