API Key Güncelle
API anahtarı bilgilerini günceller.
Endpoint
PUT /api/v1/api-keys/\{uuid\}
PATCH /api/v1/api-keys/\{uuid\}
Authentication
Bu endpoint authentication gerektirir.
Header: Authorization: Bearer \{token\}
Permission
api.keys.update- Tüm API anahtarlarını güncellemeapi.keys.update.own- Sadece kendi API anahtarlarını güncelleme
Request
Headers
| Header | Değer | Zorunlu |
|---|---|---|
Authorization | Bearer \{token\} | Evet |
Content-Type | application/json | Evet |
Path Parameters
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
uuid | string | Evet | API key UUID'si |
Request Body
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
name | string | Hayır | API key adı |
expires_at | datetime | Hayır | Son kullanma tarihi |
permissions | array | Hayır | İzin listesi |
metadata | object | Hayır | Ek metadata bilgileri (JSON) |
is_active | boolean | Hayır | Aktif durumu |
Example Request
{
"name": "Updated Production API Key",
"expires_at": "2027-12-31T23:59:59.000000Z",
"is_active": true
}
Response
Success Response (200 OK)
{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated Production API Key",
"expires_at": "2027-12-31T23:59:59.000000Z",
"is_active": true,
"updated_at": "2025-11-20T12:00:00.000000Z"
}
Error Responses
404 Not Found
{
"message": "Not Found"
}
403 Forbidden
{
"message": "Forbidden"
}
Code Examples
cURL
curl -X PATCH https://api.example.com/api/v1/api-keys/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Production API Key",
"expires_at": "2027-12-31T23:59:59.000000Z"
}'
Notes
.ownpermission'ı olan kullanıcılar sadece kendi anahtarlarını güncelleyebilirPUTtüm alanları günceller,PATCHsadece gönderilen alanları günceller- API key'in kendisi değiştirilemez, sadece metadata ve ayarlar güncellenebilir
Related Endpoints
- API Key Detayı - API key detayını getir
- API Key İptal Et - API key'i iptal et