Oturum Listesi
Tüm aktif oturumları listeler (Sanctum token'ları).
Endpoint
GET /api/v1/sessions
Authentication
Bu endpoint authentication gerektirir.
Header: Authorization: Bearer \{token\}
Permission
sessions.view- Tüm oturumları görüntülemesessions.view.own- Sadece kendi oturumlarını görüntüleme
Request
Headers
| Header | Değer | Zorunlu |
|---|---|---|
Authorization | Bearer \{token\} | Evet |
Query Parameters
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
search | string | Hayır | Genel arama (UUID, name, IP, device bilgileri) |
user_id | integer | Hayır | Kullanıcı ID'si (sadece yetkili kullanıcılar) |
ip_address | string | Hayır | IP adresi filtresi |
device_name | string | Hayır | Cihaz adı filtresi |
device_os | string | Hayır | İşletim sistemi filtresi |
device_browser | string | Hayır | Tarayıcı filtresi |
device_platform | string | Hayır | Platform filtresi |
created_from | date | Hayır | Oluşturulma tarihi başlangıç (YYYY-MM-DD) |
created_to | date | Hayır | Oluşturulma tarihi bitiş (YYYY-MM-DD) |
last_used_from | date | Hayır | Son kullanım tarihi başlangıç (YYYY-MM-DD) |
last_used_to | date | Hayır | Son kullanım tarihi bitiş (YYYY-MM-DD) |
last_activity_from | date | Hayır | Son aktivite tarihi başlangıç (YYYY-MM-DD) |
last_activity_to | date | Hayır | Son aktivite tarihi bitiş (YYYY-MM-DD) |
page | integer | Hayır | Sayfa numarası (varsayılan: 1) |
per_page | integer | Hayır | Sayfa başına kayıt (varsayılan: 15, max: 100) |
Response
Success Response (200 OK)
{
"data": [
{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"name": "Chrome on Windows",
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0...",
"device_name": "My Computer",
"device_os": "Windows",
"device_browser": "Chrome",
"device_platform": "desktop",
"location": {
"country": "Turkey",
"city": "Istanbul"
},
"abilities": [],
"created_at": "2025-11-20T12:00:00.000000Z",
"last_used_at": "2025-11-20T15:00:00.000000Z",
"last_activity_at": "2025-11-20T15:00:00.000000Z",
"tokenable": {
"id": 1,
"uuid": "b0f8e9da-0a6d-4c73-8d9a-0ca1aa7d42f7",
"email": "user@example.com"
}
}
],
"current_page": 1,
"per_page": 15,
"total": 1,
"last_page": 1
}
Code Examples
cURL
curl -X GET https://api.example.com/api/v1/sessions \
-H "Authorization: Bearer \{token\}"
Filtreleme Örnekleri
# Belirli bir kullanıcının oturumları (sadece yetkili kullanıcılar)
curl -X GET "https://api.example.com/api/v1/sessions?user_id=1" \
-H "Authorization: Bearer \{token\}"
# IP adresi filtresi
curl -X GET "https://api.example.com/api/v1/sessions?ip_address=192.168.1.1" \
-H "Authorization: Bearer \{token\}"
# Tarih aralığı filtresi
curl -X GET "https://api.example.com/api/v1/sessions?created_from=2025-01-01&created_to=2025-12-31" \
-H "Authorization: Bearer \{token\}"
Notes
.ownpermission'ı olan kullanıcılar sadece kendi oturumlarını görür- Oturumlar son aktivite, son kullanım ve oluşturulma tarihine göre sıralanır
- Her token için device, IP, location bilgileri saklanır
- Token metadata'sı
PersonalAccessTokenObserverile otomatik güncellenir
Related Endpoints
- Mevcut Oturum - Mevcut oturum bilgisi
- Oturum İptal Et - Belirli oturumu iptal et