Skip to main content

Register

Yeni kullanıcı kaydı oluşturur ve otomatik olarak giriş yapar.

Endpoint

POST /api/v1/auth/register

Authentication

Bu endpoint authentication gerektirmez (public).

Request

Headers

HeaderDeğerZorunlu
Content-Typeapplication/jsonEvet

Request Body

ParametreTipZorunluAçıklama
emailstringEvetKullanıcı e-posta adresi
passwordstringEvetKullanıcı şifresi (min: 8 karakter)
device_namestringHayırCihaz adı (varsayılan: "API Client")
device_osstringHayırİşletim sistemi
device_browserstringHayırTarayıcı bilgisi
device_platformstringHayırPlatform bilgisi
locationobjectHayırKonum bilgileri (ip, country, city, vb.)

Example Request

{
"email": "new@example.com",
"password": "secret123",
"device_name": "My Device",
"device_os": "Windows",
"device_browser": "Chrome"
}

Response

Success Response (201 Created)

{
"token": "1|abcdef1234567890...",
"user": {
"id": 2,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"email": "new@example.com",
"is_active": true,
"created_at": "2025-11-20T12:00:00.000000Z",
"updated_at": "2025-11-20T12:00:00.000000Z",
"detail": null,
"setting": null,
"roles": []
}
}

Error Responses

422 Unprocessable Entity - Validasyon Hatası

{
"message": "The given data was invalid.",
"errors": {
"email": ["The email has already been taken."],
"password": ["The password must be at least 8 characters."]
}
}

Code Examples

cURL

curl -X POST https://api.example.com/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "new@example.com",
"password": "secret123",
"device_name": "My Device"
}'

JavaScript (Fetch)

const response = await fetch('https://api.example.com/api/v1/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: 'new@example.com',
password: 'secret123',
device_name: 'My Device',
}),
});

const data = await response.json();
console.log(data.token); // API token'ı

Notes

  • Kayıt sonrası otomatik olarak giriş yapılır ve token döner
  • İlk kayıt olan kullanıcı otomatik olarak superadmin rolü alır
  • Sonraki tüm kullanıcılar user rolü ile kayıt olur
  • Her kullanıcı için otomatik olarak UserDetail ve UserSetting kayıtları oluşturulur
  • Login - Mevcut kullanıcı girişi
  • Me - Mevcut kullanıcı bilgileri