Faturalar API
Faturalar modülünün tüm işlemleri (14) ve veri modelleri (4): adresler, izinler, girdiler, ön koşullar, olaylar ve örnekler.
Her satırında vergisi olan numaralı faturalar ve iade faturaları.
Modül kodu invoices · 14 işlem · 4 veri modeli · 12 olay. Bir anahtar ya da token, arkasındaki kişinin bu modülde yapabildiğinden fazlasını asla yapamaz; satır düzeyindeki güvenlik uygulamadakiyle birebir aynıdır. Yetki kapsamları: invoices (hepsi), invoices:read (yalnız okuma) ya da invoices:<yetenek>.
Kaynaklar
| Kaynak | Tablo | Listeleme ve okuma | POST | PATCH | DELETE |
|---|---|---|---|---|---|
invoice_attachments | invoice_attachment | /api/v1/invoice_attachments | |||
invoice_events | invoice_event | /api/v1/invoice_events | |||
invoice_lines | invoice_line | /api/v1/invoice_lines | |||
invoices | invoice | /api/v1/invoices |
Listeler limit (en çok 200), cursor, order (ör. -created_at), fields ve q alır; diğer her sorgu parametresi bir sütun süzgecidir: ?status=paid, ?total[gte]=100, ?id[in]=a,b, ?x=null.
İşlemler
| İşlem | Gereken izin | Ne yapar |
|---|---|---|
invoices.add_note | invoices:write | Not ekle |
invoices.attach_file | invoices:write | Dosya ekle |
invoices.create_draft | invoices:write | Fatura başlat |
invoices.create_from_agreement | invoices:write | Sözleşmeyi faturalandır |
invoices.detach_file | invoices:write | Dosyayı ayır |
invoices.issue | invoices:write | Faturayı kes |
invoices.issue_credit_note | invoices:manage | İade faturası kes |
invoices.mark_paid | invoices:write | Ödendi işaretle |
invoices.mark_sent | invoices:write | Gönderildi işaretle |
invoices.raise_notices | invoices:write | Fatura hatırlatmalarını oluştur |
invoices.send | invoices:write | E-postayla gönder |
invoices.settle_from_agreement | invoices:write | Sözleşmeden kapat |
invoices.update_draft | invoices:write | Taslak faturayı düzenle |
invoices.void | invoices:manage | Faturayı iptal et |
invoices.add_note
Not ekle — Faturanın kendi geçmişine bir satır.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoice_events/actions/add_note- Asıl adres:
POST /api/v1/actions/invoices.add_note
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Fatura · kimliği: invoice |
message | string | evet | Not · en çok 4000 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
Yayımladığı olaylar: invoices.note_added
Neye yazar: invoice_event (insert) — Records the note
curl -X POST https://app.getera.io/api/v1/invoice_events/actions/add_note \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"id":"INVOICE_ID","message":"Note"}'{
"ok": true,
"result": "…",
"events": [
"invoices.note_added"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoiceEvents.addNote({
id: "INVOICE_ID",
message: "Note"
})era invoice_events add_note \
--id "INVOICE_ID" \
--message "Note"{
"name": "era__invoices__add_note",
"arguments": {
"id": "INVOICE_ID",
"message": "Note"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found · 429 çok sık istek
invoices.attach_file
Dosya ekle — Yüklenmiş bir dosyayı faturaya bağlar.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoice_attachments/actions/attach_file- Asıl adres:
POST /api/v1/actions/invoices.attach_file
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Fatura · kimliği: invoice |
fileId | uuid | evet | Dosya · kimliği: file |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
attachment_file_not_found | Dosya bulunmalı. |
Yayımladığı olaylar: invoices.attachments_changed
Neye yazar: invoice_attachment (insert) — Links the file; invoice_event (insert) — Records it
curl -X POST https://app.getera.io/api/v1/invoice_attachments/actions/attach_file \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"id":"INVOICE_ID","fileId":"FILE_ID"}'{
"ok": true,
"result": "…",
"events": [
"invoices.attachments_changed"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoiceAttachments.attachFile({
id: "INVOICE_ID",
fileId: "FILE_ID"
})era invoice_attachments attach_file \
--id "INVOICE_ID" \
--file-id "FILE_ID"{
"name": "era__invoices__attach_file",
"arguments": {
"id": "INVOICE_ID",
"fileId": "FILE_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, attachment_file_not_found · 429 çok sık istek
invoices.create_draft
Fatura başlat — Satırlarıyla bir taslak fatura; her satır dondurulmuş vergi bilgisi taşır.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoices/actions/create_draft- Asıl adres:
POST /api/v1/actions/invoices.create_draft
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
customerId | uuid | evet | Fatura edilen · kimliği: customer |
agreementId | uuid | Sözleşme · kimliği: agreement | |
currency | string | Para birimi · en çok 3 | |
taxCountry | string | Vergi ülkesi · en çok 2 | |
dueDate | date | Son tarih | |
notes | string | Notlar · en çok 4000 | |
lines | object / array | evet | Kalemler |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
customer_not_found | Kişi bulunmalı. |
customer_archived | Arşivlenmiş bir kişiye fatura kesilmez. |
invalid_currency | Para birimi bir ISO-4217 kodu olmalı. |
agreement_not_found | Belirtilen sözleşme bulunmalı. |
invoice_needs_lines | Faturanın en az bir satırı olmalı. |
invalid_invoice_lines | Her satırın bir açıklaması, pozitif bir miktarı ve fiyatı olmalı. |
Yayımladığı olaylar: invoices.draft_created
Neye yazar: invoice (insert) — Opens the draft; invoice_line (insert) — Writes its lines with their tax snapshot; invoice_event (insert) — Records that it was created
curl -X POST https://app.getera.io/api/v1/invoices/actions/create_draft \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"customerId":"CUSTOMER_ID","lines":{}}'{
"ok": true,
"result": "…",
"events": [
"invoices.draft_created"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.createDraft({
customerId: "CUSTOMER_ID",
lines: {}
})era invoices create_draft --data '{"customerId":"CUSTOMER_ID","lines":{}}'{
"name": "era__invoices__create_draft",
"arguments": {
"customerId": "CUSTOMER_ID",
"lines": {}
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 customer_not_found, customer_archived, invalid_currency, agreement_not_found, invoice_needs_lines, invalid_invoice_lines · 429 çok sık istek
invoices.create_from_agreement
Sözleşmeyi faturalandır — Bir sözleşmenin satırları, indirimi ve para biriminden taslak fatura.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoices/actions/create_from_agreement- Asıl adres:
POST /api/v1/actions/invoices.create_from_agreement
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
agreementId | uuid | evet | Sözleşme · kimliği: agreement |
taxCountry | string | Vergi ülkesi · en çok 2 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
agreement_not_found | Sözleşme bulunmalı. |
agreement_not_invoiceable | İptal edilmiş bir sözleşme faturalanmaz. |
agreement_already_invoiced | Bir sözleşmenin aynı anda tek geçerli faturası olur. |
Yayımladığı olaylar: invoices.draft_created
Neye yazar: invoice (insert) — Opens the draft; invoice_line (insert) — Copies the lines; invoice_event (insert) — Records that it was created
curl -X POST https://app.getera.io/api/v1/invoices/actions/create_from_agreement \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"agreementId":"AGREEMENT_ID"}'{
"ok": true,
"result": "…",
"events": [
"invoices.draft_created"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.createFromAgreement({
agreementId: "AGREEMENT_ID"
})era invoices create_from_agreement \
--agreement-id "AGREEMENT_ID"{
"name": "era__invoices__create_from_agreement",
"arguments": {
"agreementId": "AGREEMENT_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 agreement_not_found, agreement_not_invoiceable, agreement_already_invoiced · 429 çok sık istek
invoices.detach_file
Dosyayı ayır — Dosyanın faturayla bağını kaldırır; dosya Dosyalar’da kalır.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoice_events/actions/detach_file- Asıl adres:
POST /api/v1/actions/invoices.detach_file
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Fatura · kimliği: invoice |
fileId | uuid | evet | Dosya · kimliği: file |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
attachment_not_found | Dosya ekli olmalı. |
Yayımladığı olaylar: invoices.attachments_changed
Neye yazar: invoice_attachment (delete) — Unlinks the file; invoice_event (insert) — Records it
curl -X POST https://app.getera.io/api/v1/invoice_events/actions/detach_file \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"id":"INVOICE_ID","fileId":"FILE_ID"}'{
"ok": true,
"result": "…",
"events": [
"invoices.attachments_changed"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoiceEvents.detachFile({
id: "INVOICE_ID",
fileId: "FILE_ID"
})era invoice_events detach_file \
--id "INVOICE_ID" \
--file-id "FILE_ID"{
"name": "era__invoices__detach_file",
"arguments": {
"id": "INVOICE_ID",
"fileId": "FILE_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, attachment_not_found · 429 çok sık istek
invoices.issue
Faturayı kes — Taslağa çalışma alanının kendi serisinden numarasını verir ve kime kesildiğini dondurur.
Gereken izin invoices:write · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır) · Era çalıştırırken bir kişiye onaylatır
https://app.getera.io/api/v1/invoices/{id}/actions/issue- Asıl adres:
POST /api/v1/actions/invoices.issue
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
issueDate | date | Düzenleme tarihi | |
dueDate | date | Son tarih |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_draft | Yalnızca taslak kesilir. |
invoice_needs_lines | Faturanın en az bir satırı olmalı. |
Yayımladığı olaylar: invoices.issued
Neye yazar: invoice (update) — Numbers and issues it; invoice_event (insert) — Records the issue
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/issue \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"issueDate":"2026-11-02"}'{
"ok": true,
"result": "…",
"events": [
"invoices.issued"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.issue("INVOICE_ID", {
issueDate: "2026-11-02"
})era invoices issue INVOICE_ID \
--issue-date "2026-11-02"{
"name": "era__invoices__issue",
"arguments": {
"id": "INVOICE_ID",
"issueDate": "2026-11-02"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_draft, invoice_needs_lines · 429 çok sık istek
invoices.issue_credit_note
İade faturası kes — Kesilmiş veya ödenmiş bir faturayı tamamen, kendi numarasıyla ayrı bir belge olarak alacaklandırır.
Gereken izin invoices:manage · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır) · Era çalıştırırken bir kişiye onaylatır
https://app.getera.io/api/v1/invoices/{id}/actions/issue_credit_note- Asıl adres:
POST /api/v1/actions/invoices.issue_credit_note
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
reason | string | evet | Neden · en çok 2000 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_creditable | Yalnızca kesilmiş veya ödenmiş bir faturaya iade faturası kesilir. |
invoice_already_credited | Bir faturaya bir kez iade faturası kesilir. |
Yayımladığı olaylar: invoices.credit_note_issued
Neye yazar: invoice (insert) — Writes the credit note; invoice_line (insert) — Copies the credited lines; invoice_event (insert) — Records it on both documents
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/issue_credit_note \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Reason"}'{
"ok": true,
"result": "…",
"events": [
"invoices.credit_note_issued"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.issueCreditNote("INVOICE_ID", {
reason: "Reason"
})era invoices issue_credit_note INVOICE_ID \
--reason "Reason"{
"name": "era__invoices__issue_credit_note",
"arguments": {
"id": "INVOICE_ID",
"reason": "Reason"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:manage izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_creditable, invoice_already_credited · 429 çok sık istek
invoices.mark_paid
Ödendi işaretle — Para finans dışında geldiğinde kesilmiş bir faturayı elle kapatır.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoices/{id}/actions/mark_paid- Asıl adres:
POST /api/v1/actions/invoices.mark_paid
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
paidAt | date-time | Ödeme zamanı |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_issued | Yalnızca kesilmiş fatura ödenir. |
Yayımladığı olaylar: invoices.paid
Neye yazar: invoice (update) — Marks it paid; invoice_event (insert) — Records the payment
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/mark_paid \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"paidAt":"2026-11-02T09:00:00Z"}'{
"ok": true,
"result": "…",
"events": [
"invoices.paid"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.markPaid("INVOICE_ID", {
paidAt: "2026-11-02T09:00:00Z"
})era invoices mark_paid INVOICE_ID \
--paid-at "2026-11-02T09:00:00Z"{
"name": "era__invoices__mark_paid",
"arguments": {
"id": "INVOICE_ID",
"paidAt": "2026-11-02T09:00:00Z"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_issued · 429 çok sık istek
invoices.mark_sent
Gönderildi işaretle — Faturanın kişiye ulaştığını kaydeder.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoices/{id}/actions/mark_sent- Asıl adres:
POST /api/v1/actions/invoices.mark_sent
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_issued | Yalnızca kesilmiş fatura gönderilir. |
Yayımladığı olaylar: invoices.sent
Neye yazar: invoice (update) — Stamps when it was sent; invoice_event (insert) — Records the send
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/mark_sent \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{}'{
"ok": true,
"result": "…",
"events": [
"invoices.sent"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.markSent("INVOICE_ID")era invoices mark_sent INVOICE_ID{
"name": "era__invoices__mark_sent",
"arguments": {
"id": "INVOICE_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_issued · 429 çok sık istek
invoices.raise_notices
Fatura hatırlatmalarını oluştur — Günlük iş: vadesi yaklaşan ve geçen her kesilmiş fatura bir kez bildirilir.
Gereken izin invoices:write · veriyi değiştirir
403 machine_only).https://app.getera.io/api/v1/invoices/actions/raise_notices- Asıl adres:
POST /api/v1/actions/invoices.raise_notices
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
asOf | date | Geçerlilik tarihi |
Yayımladığı olaylar: invoices.due_soon, invoices.overdue
Neye yazar: invoice (update) — Records that the reminder was raised (due soon / overdue)
Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 429 çok sık istek
invoices.send
E-postayla gönder — Faturayı bildirimler modülü üzerinden e-postayla gönderir; kayıt, gidip gitmediğini gösterir.
Gereken izin invoices:write · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır) · Era çalıştırırken bir kişiye onaylatır
https://app.getera.io/api/v1/invoice_events/actions/send- Asıl adres:
POST /api/v1/actions/invoices.send
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Fatura · kimliği: invoice |
to | string | E-posta · en çok 320 | |
message | string | Mesaj · en çok 4000 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_issued | Yalnızca kesilmiş fatura gönderilir. |
invoice_recipient_missing | Gönderilecek bir adres olmalı. |
Yayımladığı olaylar: invoices.send_requested
Neye yazar: invoice_event (insert) — Records who it was sent to
curl -X POST https://app.getera.io/api/v1/invoice_events/actions/send \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"id":"INVOICE_ID"}'{
"ok": true,
"result": "…",
"events": [
"invoices.send_requested"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoiceEvents.send({
id: "INVOICE_ID"
})era invoice_events send \
--id "INVOICE_ID"{
"name": "era__invoices__send",
"arguments": {
"id": "INVOICE_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_issued, invoice_recipient_missing · 429 çok sık istek
invoices.settle_from_agreement
Sözleşmeden kapat — Otomatik: finans tamamını tahsil ettiğinde sözleşmenin kesilmiş faturasını ödendi işaretler.
Gereken izin invoices:write · veriyi değiştirir
403 machine_only).https://app.getera.io/api/v1/invoice_events/actions/settle_from_agreement- Asıl adres:
POST /api/v1/actions/invoices.settle_from_agreement
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
agreementId | uuid | evet | Sözleşme · kimliği: agreement |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_issued | Sözleşmenin kesilmiş bir faturası olmalı. |
invoice_not_fully_collected | Sözleşme tamamen tahsil edilmiş olmalı. |
Yayımladığı olaylar: invoices.paid
Neye yazar: invoice (update) — Marks it paid; invoice_event (insert) — Records the settlement
Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_issued, invoice_not_fully_collected · 429 çok sık istek
invoices.update_draft
Taslak faturayı düzenle — Satırları, vade tarihini veya notları değiştirir — yalnızca taslakken.
Gereken izin invoices:write · veriyi değiştirir
https://app.getera.io/api/v1/invoices/{id}/actions/update_draft- Asıl adres:
POST /api/v1/actions/invoices.update_draft
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
dueDate | date | Son tarih | |
notes | string | Notlar · en çok 4000 | |
taxCountry | string | Vergi ülkesi · en çok 2 | |
lines | object / array | Kalemler |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_not_draft | Yalnızca taslak düzenlenir. |
invoice_needs_lines | Faturanın en az bir satırı olmalı. |
invalid_invoice_lines | Her satırın bir açıklaması, pozitif bir miktarı ve fiyatı olmalı. |
Yayımladığı olaylar: invoices.updated
Neye yazar: invoice (update) — Updates the header and totals; invoice_line (upsert) — Rewrites the lines; invoice_event (insert) — Records the edit
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/update_draft \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"dueDate":"2026-11-02"}'{
"ok": true,
"result": "…",
"events": [
"invoices.updated"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.updateDraft("INVOICE_ID", {
dueDate: "2026-11-02"
})era invoices update_draft INVOICE_ID \
--due-date "2026-11-02"{
"name": "era__invoices__update_draft",
"arguments": {
"id": "INVOICE_ID",
"dueDate": "2026-11-02"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:write izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_not_draft, invoice_needs_lines, invalid_invoice_lines · 429 çok sık istek
invoices.void
Faturayı iptal et — Bir taslağı veya ödenmemiş kesilmiş faturayı geri çeker. Numarası kullanılmış kalır.
Gereken izin invoices:manage · siler ya da geri alınamaz · Era çalıştırırken bir kişiye onaylatır
https://app.getera.io/api/v1/invoices/{id}/actions/void- Asıl adres:
POST /api/v1/actions/invoices.void
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Fatura · kimliği: invoice |
reason | string | evet | Neden · en çok 2000 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
invoice_not_found | Fatura bulunmalı. |
invoice_already_void | Bir fatura bir kez iptal edilir. |
invoice_paid_needs_credit_note | Ödenmiş bir fatura iptal edilmez, iade faturası kesilir. |
Yayımladığı olaylar: invoices.voided
Neye yazar: invoice (update) — Marks it void; invoice_event (insert) — Records why
curl -X POST https://app.getera.io/api/v1/invoices/INVOICE_ID/actions/void \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"reason":"Reason"}'{
"ok": true,
"result": "…",
"events": [
"invoices.voided"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.invoices.void("INVOICE_ID", {
reason: "Reason"
})era invoices void INVOICE_ID \
--reason "Reason"{
"name": "era__invoices__void",
"arguments": {
"id": "INVOICE_ID",
"reason": "Reason"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde invoices:manage izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 invoice_not_found, invoice_already_void, invoice_paid_needs_credit_note · 429 çok sık istek
Veri modelleri
InvoiceAttachment
Tablo invoice_attachment · Kaynak invoice_attachments
GET /api/v1/invoice_attachmentsGET /api/v1/invoice_attachments/{id}
| Sütun | Tür | Boş olabilir | İzin verilen değerler | Bağlı olduğu tablo |
|---|---|---|---|---|
id | string (uuid) · uuid | |||
organization_id | string (uuid) · uuid | organization | ||
workspace_id | string (uuid) · uuid | workspace | ||
invoice_id | string (uuid) · uuid | invoice | ||
file_id | string (uuid) · uuid | file | ||
added_by_user_id | string (uuid) · uuid | evet | app_user | |
created_at | string (date-time) · timestamptz |
Birincil anahtar: id
Tekil: invoice_id, file_id
InvoiceEvent
Tablo invoice_event · Kaynak invoice_events
GET /api/v1/invoice_eventsGET /api/v1/invoice_events/{id}
| Sütun | Tür | Boş olabilir | İzin verilen değerler | Bağlı olduğu tablo |
|---|---|---|---|---|
id | string (uuid) · uuid | |||
organization_id | string (uuid) · uuid | organization | ||
workspace_id | string (uuid) · uuid | workspace | ||
invoice_id | string (uuid) · uuid | invoice | ||
type | string · text | created, updated, issued, sent, paid, voided, credited, note_added, attachment_added, attachment_removed, send_requested | ||
message | string · text | evet | ||
parameters | object · jsonb | |||
actor_user_id | string (uuid) · uuid | evet | app_user | |
occurred_at | string (date-time) · timestamptz |
Birincil anahtar: id
InvoiceLine
Tablo invoice_line · Kaynak invoice_lines
GET /api/v1/invoice_linesGET /api/v1/invoice_lines/{id}
| Sütun | Tür | Boş olabilir | İzin verilen değerler | Bağlı olduğu tablo |
|---|---|---|---|---|
id | string (uuid) · uuid | |||
organization_id | string (uuid) · uuid | organization | ||
workspace_id | string (uuid) · uuid | workspace | ||
invoice_id | string (uuid) · uuid | invoice | ||
description | string · text | |||
quantity | string (decimal) · numeric | |||
item_module | string · text | evet | ||
item_record_id | string (uuid) · uuid | evet | ||
currency | string · bpchar | en çok 3 | ||
unit_amount | string (int64) · int8 | |||
discount_amount | string (int64) · int8 | |||
tax_class_id | string (uuid) · uuid | evet | tax_class | |
tax_class_name | string · text | evet | ||
tax_rate | string (decimal) · numeric | |||
prices_entered_with_tax | boolean · bool | |||
net_amount | string (int64) · int8 | |||
tax_amount | string (int64) · int8 | |||
total_amount | string (int64) · int8 | |||
display_order | integer · int4 | |||
created_at | string (date-time) · timestamptz |
Birincil anahtar: id
Denetimler:
CHECK ((currency ~ '^[A-Z]{3}$'::text))CHECK ((discount_amount >= 0))CHECK ((net_amount >= 0))CHECK ((quantity > (0)::numeric))CHECK ((tax_amount >= 0))CHECK (((tax_rate >= (0)::numeric) AND (tax_rate <= (100)::numeric)))CHECK ((total_amount >= 0))CHECK ((unit_amount >= 0))
Invoice
Tablo invoice · Kaynak invoices
GET /api/v1/invoicesGET /api/v1/invoices/{id}
| Sütun | Tür | Boş olabilir | İzin verilen değerler | Bağlı olduğu tablo |
|---|---|---|---|---|
id | string (uuid) · uuid | |||
organization_id | string (uuid) · uuid | organization | ||
workspace_id | string (uuid) · uuid | workspace | ||
kind | string · text | invoice, credit_note | ||
status | string · text | draft, issued, paid, void | ||
number | string · text | evet | ||
customer_id | string (uuid) · uuid | customer | ||
agreement_id | string (uuid) · uuid | evet | agreement | |
credited_invoice_id | string (uuid) · uuid | evet | invoice | |
source_module | string · text | evet | ||
source_record_id | string (uuid) · uuid | evet | ||
currency | string · bpchar | en çok 3 | ||
subtotal_amount | string (int64) · int8 | |||
discount_total_amount | string (int64) · int8 | |||
tax_total_amount | string (int64) · int8 | |||
total_amount | string (int64) · int8 | |||
billing_name | string · text | evet | ||
billing_email | string · text | evet | ||
billing_address | string · text | evet | ||
tax_country | string · bpchar | evet | en çok 2 | |
issue_date | string (date) · date | evet | ||
due_date | string (date) · date | evet | ||
issued_at | string (date-time) · timestamptz | evet | ||
sent_at | string (date-time) · timestamptz | evet | ||
paid_at | string (date-time) · timestamptz | evet | ||
voided_at | string (date-time) · timestamptz | evet | ||
void_reason | string · text | evet | ||
notes | string · text | evet | ||
external_url | string · text | evet | ||
created_by_user_id | string (uuid) · uuid | evet | app_user | |
created_at | string (date-time) · timestamptz | |||
updated_at | string (date-time) · timestamptz | |||
due_notice_at | string (date-time) · timestamptz | evet | ||
overdue_notice_at | string (date-time) · timestamptz | evet |
Birincil anahtar: id
Denetimler:
CHECK (((kind <> 'credit_note'::text) OR (credited_invoice_id IS NOT NULL)))CHECK ((currency ~ '^[A-Z]{3}$'::text))CHECK ((discount_total_amount >= 0))CHECK (((status = ANY (ARRAY['draft'::text, 'void'::text])) OR (number IS NOT NULL)))CHECK ((subtotal_amount >= 0))CHECK (((tax_country IS NULL) OR (tax_country ~ '^[A-Z]{2}$'::text)))CHECK ((tax_total_amount >= 0))CHECK ((total_amount >= 0))CHECK (((status <> 'void'::text) OR (void_reason IS NOT NULL)))
Olaylar
İş akışları ve webhook'lar bu olaylara tepki verir.
| Olay | Ne olur | Taşıdığı alanlar |
|---|---|---|
invoices.attachments_changed | Bir faturanın dosyaları değişti. | id |
invoices.credit_note_issued | Bir iade faturası kesildi. | id, number, creditedInvoiceId |
invoices.draft_created | Taslak bir fatura başlatıldı. | id, customerId, agreementId |
invoices.due_soon | Kesilmiş bir faturanın vadesi yaklaşıyor. | id, number, customerId, customerName, email, totalAmount, currency, totalText, dueDate, ownerUserId, daysUntilDue |
invoices.issued | Bir fatura numaralandı ve kesildi. | id, number, customerId, agreementId, totalAmount, currency |
invoices.note_added | Bir faturaya not eklendi. | id |
invoices.overdue | Kesilmiş bir faturanın vadesi ödenmeden geçti. | id, number, customerId, customerName, email, totalAmount, currency, totalText, dueDate, ownerUserId, daysOverdue |
invoices.paid | Bir fatura ödendi. | id, agreementId |
invoices.send_requested | Bir fatura e-postayla gönderildi; bildirimler teslim eder. | id, eventId, to, subject, text |
invoices.sent | Bir fatura gönderildi. | id |
invoices.updated | Taslak bir fatura düzenlendi. | id |
invoices.voided | Bir fatura iptal edildi. | id, agreementId |