Parsek API Dokümantasyonu

Parsek e-Fatura işlemlerini kendi sistemlerinize entegre edin. REST tabanlı, JSON döndüren, API anahtarı ile korunan public API.

Temel URLhttps://api.parsekpro.com

Başlarken

API kullanmaya başlamak için önce bir API anahtarı oluşturmanız gerekir. Parsek uygulamasında Ayarlar → API Anahtarları bölümünden (yalnızca admin/super_admin) yeni bir anahtar üretebilirsiniz. Anahtar pk_ ön ekiyle başlar ve yalnızca oluşturulduğu anda tam görünür.

Kimlik Doğrulama

Tüm /v1/* istekleri, her istekte X-API-Key header’ı ile kimlik doğrular. Anahtar yönetimi endpoint’leri ise uygulama oturumunun Authorization: Bearer <token> header’ını kullanır. Her anahtar yalnızca kendisine tanımlı izinlere (scope) erişir; yetersiz izinde 403 insufficient_scope döner. Anahtarlar sunucuda hash’lenerek saklanır ve yalnızca oluşturulduğunda bir kez gösterilir.

Rate Limit

Her API anahtarının dakikalık istek limiti vardır (varsayılan 60 istek/dakika, anahtar oluştururken rate_limit ile ayarlanır). Her yanıtta X-RateLimit-Limit ve X-RateLimit-Remaining header’ları döner; limit aşıldığında 429 + Retry-After alırsınız. Tarayıcı tabanlı çağrılar için anahtara allowed_domains (origin whitelist) tanımlayabilirsiniz.

Hata Kodları

KodAçıklama
200Başarılı
400Hatalı istek — eksik/geçersiz parametre
401Yetkisiz — geçersiz veya eksik API anahtarı
403Yasak — origin izinli değil / yetersiz yetki
404Kaynak bulunamadı
429İstek limiti aşıldı
500Sunucu hatası

Endpoint Referansı Aktif

Faturalar

POST /api/external/v1/invoices X-API-Key scope: einvoice

Fatura oluştur (opsiyonel anında gönder)

Yeni bir e-Arşiv/e-Fatura taslağı oluşturur. `send_immediately: true` verilirse fatura anında gönderilir.

İstek Gövdesi

AlanTipZorunluAçıklama
send_immediatelybooleanHayırtrue ise fatura anında gönderilir
customerobjectEvetAlıcı bilgileri (name zorunlu; vkn veya tckn)
linesarrayEvetFatura kalemleri (en az 1)
invoice_typestringHayırFatura tipi (varsayılan 'SATIS')
currencystringHayırPara birimi (varsayılan 'TRY')
issue_datestring (date)HayırFatura tarihi YYYY-MM-DD (varsayılan bugün)
notesarrayHayırFatura notları
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/invoices" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"send_immediately":false,"customer":{"name":"Örnek Müşteri A.Ş.","vkn":"1234567890","email":"[email protected]","tax_office":"Kadıköy","address":{"city":"İstanbul","country":"Türkiye"}},"lines":[{"name":"Danışmanlık Hizmeti","quantity":1,"unit_price":1000,"tax_percent":20,"unit_code":"C62"}],"invoice_type":"SATIS","currency":"TRY"}'
Yanıt Örneği
{
  "success": true,
  "invoice": {
    "id": "9f1c2b7e-...",
    "status": "draft",
    "payable_amount": 1200
  }
}
GET /api/external/v1/invoices X-API-Key scope: einvoice

Faturaları listele

Şirkete ait faturaları sayfalı olarak listeler. `direction` ve `status` ile filtrelenebilir.

Parametreler

AlanTipinZorunluAçıklama
directionstringqueryHayır'outbound' / 'inbound'
statusstringqueryHayırDurum (draft, sent, error…)
pageintegerqueryHayırSayfa (0 tabanlı, varsayılan 0)
limitintegerqueryHayırSayfa boyutu (varsayılan 20)
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/invoices" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "9f1c2b7e-...",
      "invoice_number": "PSK2026000000123",
      "direction": "outbound",
      "status": "sent",
      "issue_date": "2026-02-10",
      "customer_name": "Örnek Müşteri A.Ş.",
      "payable_amount": 1200,
      "tax_amount": 200
    }
  ],
  "total": 42,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/invoices/{id} X-API-Key scope: einvoice

Fatura detayı

Tek bir faturanın tüm alanlarını döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetFatura ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/invoices/{id}" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "id": "9f1c2b7e-...",
  "invoice_number": "PSK2026000000123",
  "status": "sent",
  "payable_amount": 1200,
  "lines": [
    {
      "name": "Danışmanlık Hizmeti",
      "quantity": 1,
      "unitPrice": 1000,
      "taxPercent": 20
    }
  ]
}
GET /api/external/v1/invoices/{id}/status X-API-Key scope: einvoice

Fatura durumu sorgula

Faturanın güncel durum kodunu ve mesajını döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetFatura ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/invoices/{id}/status" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "id": "9f1c2b7e-...",
  "invoice_uuid": "A1B2C3-...",
  "status": "sent",
  "status_code": 100,
  "status_message": null
}
GET /api/external/v1/invoices/{id}/pdf X-API-Key scope: einvoice

Fatura PDF indir

Faturanın PDF çıktısını (application/pdf) döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetFatura ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/invoices/{id}/pdf" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
application/pdf (binary)
POST /api/external/v1/invoices/{id}/cancel X-API-Key scope: einvoice

e-Arşiv fatura iptal

Yalnızca e-Arşiv (EARSIVFATURA) senaryosundaki faturalar iptal edilebilir.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetFatura ID

İstek Gövdesi

AlanTipZorunluAçıklama
cancel_datestring (date)Hayırİptal tarihi (varsayılan bugün)
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/invoices/{id}/cancel" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"cancel_date":"2026-02-11"}'
Yanıt Örneği
{
  "success": true,
  "result": {}
}

Yardımcılar

POST /api/external/v1/check-einvoice-user X-API-Key scope: einvoice

e-Fatura mükellefi kontrolü

Verilen VKN/TCKN’nin GİB e-Fatura mükellefi olup olmadığını kontrol eder.

İstek Gövdesi

AlanTipZorunluAçıklama
vknstringHayırVergi Kimlik No
tcknstringHayırTC Kimlik No
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/check-einvoice-user" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"vkn":"1234567890"}'
Yanıt Örneği
{
  "is_einvoice_user": true
}

Cari Hesaplar

GET /api/external/v1/current-accounts X-API-Key scope: current_accounts:read

Cari hesapları listele

Şirkete ait cari hesapları sayfalı listeler. Filtreler: `account_type` (CUSTOMER/VENDOR/SUBCONTRACTOR/EMPLOYEE), `status` (ACTIVE/PASSIVE), `q` (ad/kod arama), `updated_since` (delta senkron).

Parametreler

AlanTipinZorunluAçıklama
account_typestringqueryHayırCUSTOMER/VENDOR/SUBCONTRACTOR/EMPLOYEE
statusstringqueryHayırACTIVE / PASSIVE
qstringqueryHayırAd/kod araması
updated_sincestring (ISO8601)queryHayırBu tarihten sonra güncellenenler
pageintegerqueryHayırSayfa (0 tabanlı)
limitintegerqueryHayırSayfa boyutu (max 100)
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/current-accounts" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "account_code": "MUS-00001",
      "account_name": "Örnek Müşteri A.Ş.",
      "account_type": "CUSTOMER",
      "balance": 12500,
      "base_currency": "TRY",
      "status": "ACTIVE"
    }
  ],
  "total": 42,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/current-accounts/{id} X-API-Key scope: current_accounts:read

Cari hesap detayı

Tek bir cari hesabın tüm alanlarını döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetCari hesap ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/current-accounts/{id}" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "id": "uuid",
  "account_code": "MUS-00001",
  "account_name": "Örnek Müşteri A.Ş.",
  "account_type": "CUSTOMER",
  "tax_number": "1234567890",
  "iban": "TR..",
  "balance": 12500,
  "base_currency": "TRY",
  "status": "ACTIVE"
}
POST /api/external/v1/current-accounts X-API-Key scope: current_accounts:write

Cari hesap oluştur

Yeni cari hesap oluşturur. `account_code` verilmezse tipe göre otomatik üretilir (MUS/TED/TAS/PER). `Idempotency-Key` header desteklenir.

İstek Gövdesi

AlanTipZorunluAçıklama
account_namestringEvetCari adı
account_typestringEvetCUSTOMER/VENDOR/SUBCONTRACTOR/EMPLOYEE
account_codestringHayırBoşsa otomatik üretilir
tax_numberstringHayırVKN/TCKN
tax_officestringHayırVergi dairesi
emailstringHayırE-posta
phonestringHayırTelefon
ibanstringHayırIBAN
base_currencystringHayırPara birimi (varsayılan TRY)
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/current-accounts" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"account_name":"Örnek Müşteri A.Ş.","account_type":"CUSTOMER","tax_number":"1234567890","email":"[email protected]","base_currency":"TRY"}'
Yanıt Örneği
{
  "id": "uuid",
  "account_code": "MUS-00007",
  "account_name": "Örnek Müşteri A.Ş.",
  "account_type": "CUSTOMER",
  "status": "ACTIVE",
  "base_currency": "TRY"
}
PUT /api/external/v1/current-accounts/{id} X-API-Key scope: current_accounts:write

Cari hesap güncelle

Verilen alanları günceller (yalnızca izinli alanlar).

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetCari hesap ID

İstek Gövdesi

AlanTipZorunluAçıklama
account_namestringHayırCari adı
phonestringHayırTelefon
statusstringHayırACTIVE/PASSIVE
İstek Örneği
curl -X PUT "https://api.parsekpro.com/api/external/v1/current-accounts/{id}" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"phone":"05551112233","status":"PASSIVE"}'
Yanıt Örneği
{
  "id": "uuid",
  "account_code": "MUS-00001",
  "phone": "05551112233",
  "status": "PASSIVE"
}
GET /api/external/v1/current-accounts/{id}/balance X-API-Key scope: current_accounts:read

Cari hesap bakiyesi

Borç/alacak/net bakiye ve çoklu para birimi bakiyelerini döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetCari hesap ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/current-accounts/{id}/balance" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "account_id": "uuid",
  "debit_balance": 30000,
  "credit_balance": 17500,
  "balance": 12500,
  "balance_base": 12500,
  "base_currency": "TRY",
  "balances": {
    "TRY": 12500
  }
}
GET /api/external/v1/current-accounts/{id}/transactions X-API-Key scope: current_accounts:read

Cari hesap hareketleri

Cari hesabın hareketlerini sayfalı döndürür. `from`/`to` tarih filtresi.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetCari hesap ID
fromstring (date)queryHayırBaşlangıç tarihi
tostring (date)queryHayırBitiş tarihi
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/current-accounts/{id}/transactions" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "transaction_date": "2026-02-10",
      "transaction_type": "DEBIT",
      "amount": 1200,
      "currency_code": "TRY",
      "description": "Fatura",
      "document_number": "PSK2026..."
    }
  ],
  "total": 12,
  "page": 0,
  "limit": 20
}

Stok & Depo

GET /api/external/v1/products X-API-Key scope: inventory:read

Ürün/malzeme kataloğu

Malzeme kataloğunu listeler. Filtreler: `q` (ad arama), `material_type`, `updated_since`.

Parametreler

AlanTipinZorunluAçıklama
qstringqueryHayırAd araması
material_typestringqueryHayırCONSUMABLE / USABLE
updated_sincestring (ISO8601)queryHayırDelta senkron
pageintegerqueryHayırSayfa
limitintegerqueryHayırBoyut (max 100)
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/products" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "name": "Çimento CEM I 42.5",
      "material_type": "CONSUMABLE",
      "minimum_stock_level": 100,
      "current_avg_cost": 250,
      "sale_price": 300,
      "default_currency": "TRY"
    }
  ],
  "total": 128,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/products/{id} X-API-Key scope: inventory:read

Ürün/malzeme detayı

Tek bir malzemenin tüm alanlarını döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetMalzeme ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/products/{id}" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "id": "uuid",
  "name": "Çimento CEM I 42.5",
  "material_type": "CONSUMABLE",
  "current_avg_cost": 250,
  "total_stock_value": 32000
}
GET /api/external/v1/inventory/levels X-API-Key scope: inventory:read

Stok seviyeleri

Depo/şube bazında güncel stok seviyeleri. Filtreler: `material_id`, `branch_id`, `warehouse_location_id`.

Parametreler

AlanTipinZorunluAçıklama
material_idstring (uuid)queryHayırMalzeme filtresi
branch_idstring (uuid)queryHayırŞube filtresi
warehouse_location_idstring (uuid)queryHayırDepo filtresi
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/inventory/levels" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "material_id": "uuid",
      "material_name": "Çimento CEM I 42.5",
      "branch_id": "uuid",
      "warehouse_location_id": "uuid",
      "current_quantity": 450,
      "total_incoming": 900,
      "total_outgoing": 450
    }
  ],
  "total": 12,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/inventory/movements X-API-Key scope: inventory:read

Stok hareketleri

Stok hareketlerini listeler. Filtreler: `material_id`, `branch_id`, `transaction_type`, `from`/`to`.

Parametreler

AlanTipinZorunluAçıklama
material_idstring (uuid)queryHayırMalzeme
transaction_typestringqueryHayırIN/OUT/ADJUSTMENT…
fromstring (date)queryHayırBaşlangıç
tostring (date)queryHayırBitiş
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/inventory/movements" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "material_id": "uuid",
      "transaction_type": "IN",
      "quantity": 100,
      "unit_price": 250,
      "currency_code": "TRY",
      "created_at": "2026-02-10T10:00:00Z"
    }
  ],
  "total": 340,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/warehouses X-API-Key scope: inventory:read

Depo/lokasyon listesi

Depo ve lokasyonları listeler. Filtreler: `branch_id`, `is_active`.

Parametreler

AlanTipinZorunluAçıklama
branch_idstring (uuid)queryHayırŞube
is_activebooleanqueryHayırAktif filtresi
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/warehouses" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "code": "DEPO-01",
      "name": "Merkez Depo",
      "location_path": "Merkez Depo",
      "is_active": true
    }
  ],
  "total": 6,
  "page": 0,
  "limit": 20
}
POST /api/external/v1/inventory/movements X-API-Key scope: inventory:write

Stok hareketi oluştur

Stok girişi/çıkışı/düzeltmesi. `transaction_type`: IN, OUT, ADJUSTMENT, COUNT_ADJUSTMENT. Stok seviyesi ve değerleme (FIFO/Ortalama) otomatik güncellenir. OUT’ta yetersiz stokta 409. `Idempotency-Key` desteklenir.

İstek Gövdesi

AlanTipZorunluAçıklama
material_idstring (uuid)EvetMalzeme ID
transaction_typestringEvetIN/OUT/ADJUSTMENT/COUNT_ADJUSTMENT
quantitynumberEvetMiktar (pozitif)
branch_idstring (uuid)HayırŞube (lokasyon modu zorunlu)
warehouse_location_idstring (uuid)HayırDepo lokasyonu
unit_pricenumberHayırBirim fiyat (IN için değerleme)
notesstringHayırNot
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/inventory/movements" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"material_id":"uuid","transaction_type":"IN","quantity":100,"unit_price":250,"notes":"Satın alma girişi"}'
Yanıt Örneği
{
  "id": "uuid",
  "material_id": "uuid",
  "transaction_type": "IN",
  "quantity": 100,
  "unit_price": 250,
  "currency_code": "TRY",
  "created_at": "2026-02-10T10:00:00Z"
}

Puantaj / PDKS

GET /api/external/v1/employees X-API-Key scope: attendance:read

Personel dizini (eşleştirme)

PDKS cihazlarının kart/sicil eşleştirmesi için personel dizinini döndürür. Filtreler: `q` (ad/sicil/kart arama), `status`, `branch_id`, `updated_since`.

Parametreler

AlanTipinZorunluAçıklama
qstringqueryHayırAd / sicil / kart araması
statusstringqueryHayıractive / passive
updated_sincestring (date)queryHayırISO8601 delta senkron
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/employees" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "employee_number": "SICIL-9001",
      "pdks_card_no": "CARD-001",
      "first_name": "Ali",
      "last_name": "Yılmaz",
      "full_name": "Ali Yılmaz",
      "tc_identity_no": "12345678901",
      "branch_id": "uuid",
      "status": "active"
    }
  ],
  "total": 42,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/attendance X-API-Key scope: attendance:read

Günlük puantaj kayıtları

Günlük puantaj kayıtlarını listeler. Filtreler: `employee_id`, `branch_id`, `status_code`, `date`, `from`/`to` (tarih).

Parametreler

AlanTipinZorunluAçıklama
employee_idstring (uuid)queryHayırPersonel
status_codestringqueryHayırX/I/R/YG/DD/UI
fromstring (date)queryHayırBaşlangıç (YYYY-MM-DD)
tostring (date)queryHayırBitiş (YYYY-MM-DD)
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/attendance" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "employee_id": "uuid",
      "date": "2026-02-10",
      "status_code": "X",
      "work_hours": 9.5,
      "overtime_hours": 1.5,
      "check_in_time": "2026-02-10T05:00:00Z",
      "check_out_time": "2026-02-10T14:30:00Z",
      "source": "pdks_api"
    }
  ],
  "total": 120,
  "page": 0,
  "limit": 20
}
GET /api/external/v1/attendance/punches X-API-Key scope: attendance:read

Ham PDKS giriş/çıkış olayları

Cihazlardan gelen ham giriş/çıkış (punch) olaylarını döndürür (hata ayıklama/denetim). Filtreler: `employee_id`, `device_id`, `matched`, `from`/`to`.

Parametreler

AlanTipinZorunluAçıklama
employee_idstring (uuid)queryHayırPersonel
device_idstringqueryHayırCihaz kimliği
matchedbooleanqueryHayırEşleşme durumu
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/attendance/punches" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "employee_id": "uuid",
      "card_no": "CARD-001",
      "device_id": "GATE-1",
      "direction": "IN",
      "punch_time": "2026-02-10T05:00:00Z",
      "attendance_date": "2026-02-10",
      "matched": true,
      "source": "pdks_api"
    }
  ],
  "total": 240,
  "page": 0,
  "limit": 20
}
POST /api/external/v1/attendance X-API-Key scope: attendance:write

PDKS puantaj push (punch veya günlük)

PDKS donanım/entegratörleri için iki mod: (1) `punches` — ham giriş/çıkış olayları push edilir; günlük puantaj (çalışma saati IN→OUT eşleştirmesiyle) otomatik hesaplanır; tekrar gönderim idempotenttir (dedup). (2) `records` — günlük puantaj doğrudan yazılır (`status_code`: X/I/R/YG/DD/UI). Personel `card_no`, `employee_number`, `tc_identity_no` veya `employee_id` ile eşleştirilir. Eşleşmeyenler `unmatched` içinde döner. `standard_daily_hours` (varsayılan 8) fazla mesai için baz alınır. `Idempotency-Key` desteklenir. Başarıda `attendance.recorded` webhook’u tetiklenir.

İstek Gövdesi

AlanTipZorunluAçıklama
punchesarrayHayırPunch modu: [{ card_no|employee_id|employee_number|tc_identity_no, timestamp (ISO8601), direction? (IN/OUT), device_id? }]
recordsarrayHayırGünlük mod: [{ card_no|employee_id|..., date (YYYY-MM-DD), status_code, work_hours?, overtime_hours?, note? }]
standard_daily_hoursnumberHayırFazla mesai bazı (varsayılan 8)
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/attendance" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"standard_daily_hours":8,"punches":[{"card_no":"CARD-001","timestamp":"2026-02-10T05:00:00Z","direction":"IN","device_id":"GATE-1"},{"card_no":"CARD-001","timestamp":"2026-02-10T14:30:00Z","direction":"OUT","device_id":"GATE-1"}]}'
Yanıt Örneği
{
  "mode": "punch",
  "punches_received": 2,
  "punches_inserted": 2,
  "punches_skipped_duplicate": 0,
  "attendance_upserted": 1,
  "unmatched": []
}

Webhooks

GET /api/external/v1/webhooks X-API-Key scope: webhooks:manage

Webhook uçlarını listele

Şirkete ait aktif/pasif webhook uçlarını ve abone olunabilecek event kataloğunu (`available_events`) döndürür.

İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/webhooks" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "url": "https://ornek.com/webhook",
      "events": [
        "invoice.status_changed",
        "payment.received"
      ],
      "is_active": true,
      "secret_masked": "whsec_…a1b2"
    }
  ],
  "available_events": [
    "current_account.created",
    "current_account.updated",
    "inventory.movement.created",
    "inventory.low_stock",
    "invoice.status_changed",
    "payment.received",
    "attendance.recorded",
    "webhook.test"
  ]
}
GET /api/external/v1/webhooks/{id} X-API-Key scope: webhooks:manage

Webhook detayı

Tek bir webhook ucunun detayını döndürür (secret maskeli).

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/webhooks/{id}" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "id": "uuid",
  "url": "https://ornek.com/webhook",
  "events": [
    "payment.received"
  ],
  "is_active": true,
  "secret_masked": "whsec_…a1b2"
}
POST /api/external/v1/webhooks X-API-Key scope: webhooks:manage

Webhook oluştur

Yeni bir webhook ucu ekler. Yalnızca `https://` genel adresler kabul edilir (özel/iç IP’ler SSRF koruması ile reddedilir). `secret` YALNIZCA oluşturmada bir kez tam döner — HMAC-SHA256 imza doğrulaması için saklayın.

İstek Gövdesi

AlanTipZorunluAçıklama
urlstring (https)EvetTeslimat URL’i (yalnız https)
eventsarrayEvetAbone olunacak event(ler)
descriptionstringHayırAçıklama
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/webhooks" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://ornek.com/parsek-webhook","events":["invoice.status_changed","payment.received"],"description":"Muhasebe entegrasyonu"}'
Yanıt Örneği
{
  "id": "uuid",
  "url": "https://ornek.com/parsek-webhook",
  "events": [
    "invoice.status_changed",
    "payment.received"
  ],
  "is_active": true,
  "secret": "whsec_9f1c2b7e...(yalnizca burada tam doner)"
}
PUT /api/external/v1/webhooks/{id} X-API-Key scope: webhooks:manage

Webhook güncelle

URL, event listesi, `is_active` (aktif/pasif) veya açıklamayı günceller. URL değişirse SSRF kontrolü tekrar uygulanır.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID

İstek Gövdesi

AlanTipZorunluAçıklama
urlstring (https)HayırYeni URL
eventsarrayHayırYeni event listesi
is_activebooleanHayırAktif/pasif
descriptionstringHayırAçıklama
İstek Örneği
curl -X PUT "https://api.parsekpro.com/api/external/v1/webhooks/{id}" \
  -H "X-API-Key: pk_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"is_active":false}'
Yanıt Örneği
{
  "id": "uuid",
  "url": "https://ornek.com/parsek-webhook",
  "events": [
    "payment.received"
  ],
  "is_active": false
}
DELETE /api/external/v1/webhooks/{id} X-API-Key scope: webhooks:manage

Webhook sil

Webhook ucunu ve bağlı teslimat kayıtlarını siler.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID
İstek Örneği
curl -X DELETE "https://api.parsekpro.com/api/external/v1/webhooks/{id}" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "success": true
}
POST /api/external/v1/webhooks/{id}/test X-API-Key scope: webhooks:manage

Test teslimatı gönder

`webhook.test` olayını uca senkron gönderir ve sonucu (HTTP kodu, deneme sayısı) döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/webhooks/{id}/test" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "delivered": true,
  "response_code": 200,
  "error": null,
  "attempts": 1
}
GET /api/external/v1/webhooks/{id}/deliveries X-API-Key scope: webhooks:manage

Teslimat loglarını listele

Uca ait teslimat denemelerini (durum, deneme, HTTP kodu, hata) sayfalı döndürür. Hata ayıklama için.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID
pageintegerqueryHayırSayfa (0 tabanlı)
limitintegerqueryHayırSayfa boyutu
İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/v1/webhooks/{id}/deliveries" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "data": [
    {
      "id": "uuid",
      "event": "payment.received",
      "status": "success",
      "attempts": 1,
      "response_code": 200,
      "error": null,
      "created_at": "2026-02-10T10:00:00Z"
    }
  ],
  "total": 12,
  "page": 0,
  "limit": 20
}
POST /api/external/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver X-API-Key scope: webhooks:manage

Teslimatı yeniden gönder

Başarısız (veya herhangi bir) teslimatı deneme sayacını sıfırlayarak elle yeniden gönderir; sonucu senkron döndürür.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetWebhook ID
deliveryIdstring (uuid)pathEvetTeslimat ID
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver" \
  -H "X-API-Key: pk_xxxxxxxx"
Yanıt Örneği
{
  "delivered": true,
  "response_code": 200,
  "error": null,
  "attempts": 1,
  "will_retry": false
}

API Anahtarları

GET /api/external/keys Bearer

API anahtarlarını listele

Şirkete ait API anahtarlarını listeler (admin/super_admin). Anahtarlar maskeli döner.

İstek Örneği
curl -X GET "https://api.parsekpro.com/api/external/keys" \
  -H "Authorization: Bearer <TOKEN>"
Yanıt Örneği
[
  {
    "id": "uuid",
    "key_name": "Muhasebe Entegrasyonu",
    "api_key_masked": "...a1b2c3d4",
    "is_active": true,
    "rate_limit": 60,
    "request_count": 128
  }
]
POST /api/external/keys Bearer

API anahtarı oluştur

Yeni bir API anahtarı üretir (pk_ ön ekli). Anahtar yalnızca oluşturulunca tam görünür.

İstek Gövdesi

AlanTipZorunluAçıklama
key_namestringHayırAnahtar adı
permissionsarrayHayırİzinler (varsayılan ['einvoice'])
rate_limitintegerHayırDakikalık limit (varsayılan 60)
allowed_domainsarrayHayırİzinli origin listesi (tarayıcıdan çağrı için)
İstek Örneği
curl -X POST "https://api.parsekpro.com/api/external/keys" \
  -H "Authorization: Bearer <TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"key_name":"Muhasebe Entegrasyonu","permissions":["einvoice"],"rate_limit":60}'
Yanıt Örneği
{
  "id": "uuid",
  "api_key": "pk_9f...c3",
  "message": "API anahtari olusturuldu. Bu anahtari guvenli bir yerde saklayin."
}
DELETE /api/external/keys/{id} Bearer

API anahtarı sil

Verilen API anahtarını siler.

Parametreler

AlanTipinZorunluAçıklama
idstring (uuid)pathEvetAnahtar ID
İstek Örneği
curl -X DELETE "https://api.parsekpro.com/api/external/keys/{id}" \
  -H "Authorization: Bearer <TOKEN>"
Yanıt Örneği
{
  "success": true
}

Webhooks Aktif

Parsek, abone olduğunuz olaylar gerçekleştiğinde HTTPS ucunuza giden POST istekleri gönderir. Uçları yukarıdaki Webhooks API ile yönetin.

Event kataloğu

EventAçıklama
current_account.createdYeni cari hesap oluşturuldu
current_account.updatedCari hesap güncellendi
inventory.movement.createdStok hareketi kaydedildi
inventory.low_stockStok minimum seviyenin altına düştü
invoice.status_changede-Fatura durumu değişti
payment.receivedÖdeme alındı (PayTR)
webhook.testTest teslimatı (manuel)

Teslimat başlıkları

HeaderAçıklama
X-Parsek-EventEvent adı
X-Parsek-DeliveryBenzersiz teslimat ID’si
X-Parsek-TimestampUnix zaman damgası (saniye)
X-Parsek-Signaturet=<timestamp>,v1=<hmac_sha256>

Payload yapısı

{
  "id": "3f1c...",
  "event": "payment.received",
  "created": "2026-02-10T10:00:00.000Z",
  "data": {
    "merchant_oid": "SUB123",
    "amount": 649,
    "currency": "TL",
    "request_type": "subscription",
    "received_at": "2026-02-10T10:00:00.000Z"
  }
}

İmza doğrulama (HMAC-SHA256)

const crypto = require('crypto');
// Express: gövdeyi HAM alın → express.raw({ type: 'application/json' })
function verifyParsekWebhook(req, secret) {
  const header = req.headers['x-parsek-signature'] || '';   // 't=...,v1=...'
  const parts = Object.fromEntries(header.split(',').map(p => p.split('=')));
  const timestamp = parts.t, received = parts.v1;
  const body = req.body.toString('utf8');                    // ham JSON string
  const expected = crypto.createHmac('sha256', secret)
    .update(timestamp + '.' + body).digest('hex');
  const ok = received && received.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
  // Replay koruması: 5 dakikadan eski istekleri reddedin
  const fresh = Math.abs(Date.now()/1000 - Number(timestamp)) < 300;
  return ok && fresh;
}

Yeniden deneme & güvenilirlik

Başarısız teslimatlar (2xx dışı yanıt veya zaman aşımı) otomatik olarak 4 kez artan gecikmeyle (30sn, 2dk, 10dk, 30dk) yeniden denenir. Denemeleri teslimat log endpoint’inden inceleyebilir, redeliver endpoint’i ile elle yeniden gönderebilirsiniz. Yalnızca genel https adresleri kabul edilir (özel/iç IP’ler SSRF koruması ile engellenir).

Yakında Yakında

Aşağıdaki API’ler geliştirme aşamasındadır ve henüz canlı değildir. Yalnızca yukarıdaki “Aktif” endpoint’ler kullanılabilir.

🏗️

ERP Veri API’si

Proje ve hakediş verilerine salt-okunur erişim.

🦺

İSG / İBYS API’si

Çalışan sağlık takibi, KKD zimmet ve İBYS bildirim entegrasyonu.

🏭

OSB API’si

Katılımcı firma, parsel, aidat tahakkuk ve altyapı sayaç verileri.