Kullanıcı Oluştur
Yeni kullanıcı oluşturur.
Endpoint
POST /api/v1/users
Authentication
Bu endpoint authentication gerektirir.
Header: Authorization: Bearer \{token\}
Permission
users.create - Kullanıcı oluşturma yetkisi gerekir.
Request
Headers
| Header | Değer | Zorunlu |
|---|---|---|
Authorization | Bearer \{token\} | Evet |
Content-Type | application/json | Evet |
Request Body
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
email | string | Evet | E-posta adresi |
password | string | Evet | Şifre (min: 8 karakter) |
is_active | boolean | Hayır | Aktif durumu (varsayılan: true) |
role_ids | array | Hayır | Rol ID'leri |
Example Request
{
"email": "member@example.com",
"password": "secret123",
"is_active": true,
"role_ids": [2, 3]
}
Response
Success Response (201 Created)
{
"id": 2,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"email": "member@example.com",
"is_active": true,
"created_at": "2025-11-20T12:00:00.000000Z",
"updated_at": "2025-11-20T12:00:00.000000Z",
"detail": null,
"setting": {
"locale": "tr",
"timezone": "Europe/Istanbul"
},
"roles": [
{
"id": 2,
"name": "Admin",
"slug": "mgmt.admin"
}
]
}
Error Responses
422 Unprocessable Entity
{
"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/users \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"email": "member@example.com",
"password": "secret123",
"is_active": true
}'
Notes
- Yeni kullanıcı oluşturulduğunda otomatik olarak
UserDetailveUserSettingkayıtları oluşturulur - Rol atanmazsa varsayılan olarak
userrolü atanır - İlk kayıt olan kullanıcı otomatik olarak
superadminrolü alır
Related Endpoints
- User List - Kullanıcı listesi
- User Detail - Kullanıcı detayı