Müşteri oluşturma
Yeni bir müşteri (alıcı) kaydı oluşturmak için bu endpoint kullanılır. Fatura oluştururken customer.id olarak bu kaydın ID’si gönderilir.
İstek
POST /api/customers
Accept: application/json
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
İstek gövdesi alanları
| Alan | Tip | Zorunlu | Açıklama |
|---|---|---|---|
type | string | Evet | person veya company — bkz. Sabitler. |
tax_number | string | Evet | VKN (10 hane) veya TCKN (11 hane). |
tax_office | string | Koşullu | Tüzel kişi (company) için zorunlu. |
title | string | Koşullu | Tüzel kişi için ünvan zorunlu. |
name | string | Koşullu | Gerçek kişi için ad zorunlu. |
surname | string | Koşullu | Gerçek kişi için soyad zorunlu. |
country | string | Evet | Ülke. |
address | string | Evet | Açık adres. |
city | string | Evet | İl. |
district | string | Evet | İlçe. |
postcode | string | Hayır | Posta kodu. |
phone | string | Hayır | Telefon. |
email | string | Hayır | E-posta (geçerli format). |
iban | string | Hayır | IBAN. |
Örnek istekler
- 💻 cURL
- 🐘 PHP
- 🟢 Node.js
- 🐍 Python
- 🔷 C#
curl -X POST "https://app.faturaentegrator.com/api/customers" \
-H "Accept: application/json" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"tax_number":"11111111111","tax_office":"","title":"","name":"Ali","surname":"Yılmaz","phone":"5555555555","email":"ali@example.com","address":"Örnek Mah. No:1","district":"Kadıköy","city":"İstanbul","country":"TÜRKİYE","postcode":"34000","type":"person","iban":""}'
<?php
$body = [
'tax_number' => '11111111111',
'tax_office' => '',
'title' => '',
'name' => 'Ali',
'surname' => 'Yılmaz',
'phone' => '5555555555',
'email' => 'ali@example.com',
'address' => 'Örnek Mah. No:1',
'district' => 'Kadıköy',
'city' => 'İstanbul',
'country' => 'TÜRKİYE',
'postcode' => '34000',
'type' => 'person',
'iban' => '',
];
$ch = curl_init('https://app.faturaentegrator.com/api/customers');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_HTTPHEADER => ['Accept: application/json', 'Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
const body = {
tax_number: '11111111111',
tax_office: '',
title: '',
name: 'Ali',
surname: 'Yılmaz',
phone: '5555555555',
email: 'ali@example.com',
address: 'Örnek Mah. No:1',
district: 'Kadıköy',
city: 'İstanbul',
country: 'TÜRKİYE',
postcode: '34000',
type: 'person',
iban: '',
};
const res = await fetch('https://app.faturaentegrator.com/api/customers', {
method: 'POST',
headers: { Accept: 'application/json', Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
const data = await res.json();
import requests
body = {
'tax_number': '11111111111',
'tax_office': '',
'title': '',
'name': 'Ali',
'surname': 'Yılmaz',
'phone': '5555555555',
'email': 'ali@example.com',
'address': 'Örnek Mah. No:1',
'district': 'Kadıköy',
'city': 'İstanbul',
'country': 'TÜRKİYE',
'postcode': '34000',
'type': 'person',
'iban': '',
}
r = requests.post(
'https://app.faturaentegrator.com/api/customers',
json=body,
headers={'Accept': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY'},
)
data = r.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");
var body = new { tax_number = "11111111111", tax_office = "", title = "", name = "Ali", surname = "Yılmaz", phone = "5555555555", email = "ali@example.com", address = "Örnek Mah. No:1", district = "Kadıköy", city = "İstanbul", country = "TÜRKİYE", postcode = "34000", type = "person", iban = "" };
var content = new StringContent(System.Text.Json.JsonSerializer.Serialize(body), System.Text.Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://app.faturaentegrator.com/api/customers", content);
var data = await response.Content.ReadFromJsonAsync<JsonElement>();