Skip to main content

Müşteri Oluştur

Yeni müşteri oluşturur.

Endpoint

POST /api/v1/customers

Authentication

Bu endpoint authentication gerektirir.

Header: Authorization: Bearer \{token\}

Permission

  • customers.create - Tüm müşterileri oluşturma
  • customers.create.own - Sadece kendi müşterisini oluşturma

Request

Headers

HeaderDeğerZorunlu
AuthorizationBearer \{token\}Evet
Content-Typeapplication/jsonEvet

Request Body

ParametreTipZorunluAçıklama
company_namestringEvetŞirket adı
legal_namestringHayırYasal ad
tax_numberstringHayırVergi numarası
emailstringHayırE-posta adresi
phonestringHayırTelefon numarası
organization_idintegerHayırOrganizasyon ID'si
is_activebooleanHayırAktif durumu (varsayılan: true)

Example Request

{
"company_name": "Örnek Şirket",
"legal_name": "Örnek Şirket Ltd.",
"tax_number": "1234567890",
"email": "info@ornek.com",
"phone": "+90 555 000 00 00",
"is_active": true
}

Response

Success Response (201 Created)

{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"company_name": "Örnek Şirket",
"legal_name": "Örnek Şirket Ltd.",
"tax_number": "1234567890",
"email": "info@ornek.com",
"phone": "+90 555 000 00 00",
"is_active": true,
"user_id": 1,
"created_at": "2025-11-20T12:00:00.000000Z",
"updated_at": "2025-11-20T12:00:00.000000Z"
}

Error Responses

403 Forbidden

{
"message": "Forbidden"
}

422 Unprocessable Entity

{
"message": "Validation failed",
"errors": {
"company_name": ["The company name field is required."]
}
}

Code Examples

cURL

curl -X POST https://api.example.com/api/v1/customers \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"company_name": "Örnek Şirket",
"legal_name": "Örnek Şirket Ltd.",
"tax_number": "1234567890",
"email": "info@ornek.com"
}'

Notes

  • .own permission'ı olan kullanıcılar için user_id otomatik olarak atanır
  • is_active değeri belirtilmemişse varsayılan olarak true kullanılır