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
| Header | Değer | Zorunlu |
|---|---|---|
Content-Type | application/json | Evet |
Request Body
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
email | string | Evet | Kullanıcı e-posta adresi |
password | string | Evet | Kullanıcı şifresi (min: 8 karakter) |
device_name | string | Hayır | Cihaz adı (varsayılan: "API Client") |
device_os | string | Hayır | İşletim sistemi |
device_browser | string | Hayır | Tarayıcı bilgisi |
device_platform | string | Hayır | Platform bilgisi |
location | object | Hayır | Konum 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
superadminrolü alır - Sonraki tüm kullanıcılar
userrolü ile kayıt olur - Her kullanıcı için otomatik olarak
UserDetailveUserSettingkayıtları oluşturulur