{"openapi":"3.1.0","info":{"title":"cekmut API","version":"1.0.0","description":"API untuk membuat tagihan berkode unik dan membaca transaksi rekening yang dipantau cekmut.\n\nAutentikasi: `Authorization: Bearer ck_live_…` (buat di menu Developer). Setiap kunci punya izin (scope).\n\nData mutasi dibaca berkala dari bank (bukan seketika). Status lunas dikirim lewat webhook `payment.matched`.\n\nWebhook ditandatangani: header `Cekmut-Signature: t=<unix>,v1=<hex HMAC-SHA256 dari \"<t>.<body>\">`, `Cekmut-Event-Id` untuk idempotensi (pengiriman at-least-once).\n\nEvent webhook: transaction.created, transaction.updated, payment.matched, payment.review_required, payment.reversed, invoice.created, invoice.expired, invoice.cancelled, sync.failed, sync.recovered."},"servers":[{"url":"https://app.cekmut.id/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Scope: invoices:read, invoices:write, transactions:read, accounts:read"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"fields":{"type":"object","additionalProperties":{"type":"string"}}}}}},"Account":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_number":{"type":"string"},"account_masked":{"type":"string"},"currency":{"type":"string"},"balance":{"type":["string","null"],"pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Nominal eksak (string desimal, 2 angka di belakang titik). Tidak pernah float."},"balance_at":{"type":["string","null"],"format":"date-time"},"connection":{"type":"object"}}},"Transaction":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"account":{"type":"string","example":"•••• 7890"},"status":{"enum":["pending","posted"],"description":"pending = PEND (belum tercatat bank)"},"booked_at":{"type":["string","null"],"format":"date"},"direction":{"enum":["credit","debit"]},"amount":{"type":"string","pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Nominal eksak (string desimal, 2 angka di belakang titik). Tidak pernah float."},"currency":{"type":"string"},"description":{"type":"string"},"balance":{"type":["string","null"],"pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Nominal eksak (string desimal, 2 angka di belakang titik). Tidak pernah float."},"recon_status":{"enum":["unmatched","baseline","not_applicable","matched","review","ignored"]},"ingested_at":{"type":"string","format":"date-time"},"invoice":{"type":["object","null"],"properties":{"id":{"type":"string"},"number":{"type":"string"}}}}},"Invoice":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"number":{"type":"string","example":"INV-000123"},"external_ref":{"type":["string","null"]},"status":{"enum":["open","paid","expired","cancelled"]},"amount":{"type":"string","pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Nominal eksak (string desimal, 2 angka di belakang titik). Tidak pernah float."},"unique_code":{"type":"integer","description":"Rupiah tambahan (1–999)"},"total":{"type":"string","pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Yang WAJIB ditransfer pembeli persis (amount + kode unik)"},"paid":{"type":"string","pattern":"^\\d+\\.\\d{2}$","example":"150123.00","description":"Nominal eksak (string desimal, 2 angka di belakang titik). Tidak pernah float."},"currency":{"type":"string"},"account_id":{"type":["string","null"]},"description":{"type":["string","null"]},"customer":{"type":"object"},"metadata":{"type":"object"},"expires_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"closed_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"pay_to":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"bank":{"type":"string"},"account_number":{"type":"string"},"label":{"type":"string"}}}},"payment":{"type":["object","null"],"properties":{"id":{"type":"string"},"strategy":{"enum":["unique_amount","reference","manual"]},"score":{"type":"integer"},"decided_by":{"enum":["auto","manual"]},"transaction_id":{"type":"string"}}}}},"NewInvoice":{"type":"object","required":["amount"],"properties":{"amount":{"type":["string","integer"],"example":"150000","description":"Rupiah bulat sebelum kode unik"},"external_ref":{"type":"string","maxLength":100,"description":"ID pesanan Anda. Mengirim ulang dengan nilai & nominal sama mengembalikan tagihan yang sama (200), nominal beda → 409."},"expires_in_minutes":{"type":"integer","minimum":5,"maximum":43200,"description":"Bawaan 1440 (24 jam). Tagihan tetap bisa lunas selama masa tenggang (bawaan 60 menit)."},"account_id":{"type":"string","format":"uuid","description":"Batasi ke satu rekening tujuan"},"description":{"type":"string","maxLength":200},"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"}}},"metadata":{"type":"object","description":"Maks. 4 KB"}}}}},"paths":{"/accounts":{"get":{"summary":"Daftar rekening","description":"Scope accounts:read","responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/transactions":{"get":{"summary":"Daftar transaksi (terbaru dulu)","description":"Scope transactions:read","parameters":[{"name":"account_id","in":"query","schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"recon_status","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}},{"name":"to","in":"query","schema":{"type":"string"}},{"name":"q","in":"query","schema":{"type":"string"}},{"name":"min_amount","in":"query","schema":{"type":"string"}},{"name":"max_amount","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object","required":["data","next_cursor","has_more"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/transactions/{id}":{"get":{"summary":"Satu transaksi","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transaction"}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices":{"post":{"summary":"Buat tagihan berkode unik","description":"Scope invoices:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewInvoice"}}}},"responses":{"200":{"description":"Sudah ada (external_ref sama)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"201":{"description":"Dibuat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"Daftar tagihan","description":"Scope invoices:read","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"external_ref","in":"query","schema":{"type":"string"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"type":"object","required":["data","next_cursor","has_more"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}":{"get":{"summary":"Satu tagihan (termasuk pembayaran bila lunas)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/cancel":{"post":{"summary":"Batalkan tagihan terbuka","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Berhasil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Galat","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}