Raporlar API
Raporlar modülünün tüm işlemleri (5) ve veri modelleri (2): adresler, izinler, girdiler, ön koşullar, olaylar ve örnekler.
Satış ve finans raporları ile her birini kimlerin görebileceği.
Modül kodu reports · 5 işlem · 2 veri modeli · 4 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ı: reports (hepsi), reports:read (yalnız okuma) ya da reports:<yetenek>.
Kaynaklar
| Kaynak | Tablo | Listeleme ve okuma | POST | PATCH | DELETE |
|---|---|---|---|---|---|
report_exports | report_export | /api/v1/report_exports | |||
report_schedules | report_schedule | /api/v1/report_schedules |
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 |
|---|---|---|
reports.create_schedule | reports:manage | Raporu e-postayla zamanla |
reports.delete_schedule | reports:manage | Zamanlanmış raporu durdur |
reports.record_export | reports:export | Rapor dışa aktarımını kaydet |
reports.request_export | reports:export | Tüm satırları dışa aktar |
reports.send_digest | reports:manage | Zamanlanmış raporu gönder |
reports.create_schedule
Raporu e-postayla zamanla — Bir raporun ana sayılarını sabit bir takvimle bir bildirim kuralı üzerinden gönderir.
Gereken izin reports:manage · veriyi değiştirir
https://app.getera.io/api/v1/report_schedules/actions/create_schedule- Asıl adres:
POST /api/v1/actions/reports.create_schedule
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
report_key | string | evet | Rapor · en çok 64 |
rule_id | uuid | evet | Gönderim kanalı · kimliği: notification_rule |
frequency | string (enum) | evet | Ne sıklıkla · İzin verilen değerler: daily, weekly, monthly |
send_hour | number | Saat · Çalışma alanının saat dilimine göre yerel saat. · en az 0 · en çok 23 | |
weekday | number | Hafta günü · 0 = Pazar. Yalnızca haftalıkta kullanılır. · en az 0 · en çok 6 | |
window_months | number | Kapsanan aylar · en az 1 · en çok 24 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
unknown_report | Rapor kayıtlı raporlar arasında bulunmalı. |
rule_not_found | Bildirim kuralı bu çalışma alanında bulunmalı. |
rule_not_for_digests | Kural rapor özeti olayını kapsamalı. |
schedule_exists | Bu rapor aynı kuralla aynı sıklıkta zaten zamanlanmış. |
Yayımladığı olaylar: reports.schedule_created
Neye yazar: report_schedule (insert) — The schedule, with its first send time
curl -X POST https://app.getera.io/api/v1/report_schedules/actions/create_schedule \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"report_key":"Report","rule_id":"NOTIFICATION_RULE_ID","frequency":"daily"}'{
"ok": true,
"result": "…",
"events": [
"reports.schedule_created"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.reportSchedules.createSchedule({
report_key: "Report",
rule_id: "NOTIFICATION_RULE_ID",
frequency: "daily"
})era report_schedules create_schedule \
--report-key "Report" \
--rule-id "NOTIFICATION_RULE_ID" \
--frequency "daily"{
"name": "era__reports__create_schedule",
"arguments": {
"report_key": "Report",
"rule_id": "NOTIFICATION_RULE_ID",
"frequency": "daily"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde reports:manage izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 unknown_report, rule_not_found, rule_not_for_digests, schedule_exists · 429 çok sık istek
reports.delete_schedule
Zamanlanmış raporu durdur — Zamanlamayı kaldırır. Gönderilmiş özetler bildirim geçmişinde kalır.
Gereken izin reports:manage · siler ya da geri alınamaz
https://app.getera.io/api/v1/report_schedules/{id}/actions/delete_schedule- Asıl adres:
POST /api/v1/actions/reports.delete_schedule
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Zamanla · kimliği: report_schedule |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
schedule_not_found | Zamanlama bu çalışma alanında bulunmalı. |
Yayımladığı olaylar: reports.schedule_deleted
Neye yazar: report_schedule (delete) — The schedule row
curl -X POST https://app.getera.io/api/v1/report_schedules/REPORT_SCHEDULE_ID/actions/delete_schedule \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{}'{
"ok": true,
"result": "…",
"events": [
"reports.schedule_deleted"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.reportSchedules.deleteSchedule("REPORT_SCHEDULE_ID")era report_schedules delete_schedule REPORT_SCHEDULE_ID{
"name": "era__reports__delete_schedule",
"arguments": {
"id": "REPORT_SCHEDULE_ID"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde reports:manage izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 schedule_not_found · 429 çok sık istek
reports.record_export
Rapor dışa aktarımını kaydet — Biri bir raporu CSV olarak indirdiğinde dışa aktarım geçmişine satır ekler.
Gereken izin reports:export · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır)
https://app.getera.io/api/v1/report_exports/actions/record_export- Asıl adres:
POST /api/v1/actions/reports.record_export
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
report_key | string | evet | Rapor · en çok 64 |
window_months | number | Dönem (ay) · en az 1 · en çok 24 | |
compare | string | Karşılaştırılan · en çok 16 | |
row_count | number | evet | Satırlar · en az 0 · en çok 10000000 |
filename | string | Dosya adı · en çok 200 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
unknown_report | Rapor kayıtlı raporlar arasında bulunmalı. |
Yayımladığı olaylar: reports.exported
Neye yazar: report_export (insert) — One history row per download
curl -X POST https://app.getera.io/api/v1/report_exports/actions/record_export \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"report_key":"Report","row_count":1}'{
"ok": true,
"result": "…",
"events": [
"reports.exported"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.reportExports.recordExport({
report_key: "Report",
row_count: 1
})era report_exports record_export \
--report-key "Report" \
--row-count 1{
"name": "era__reports__record_export",
"arguments": {
"report_key": "Report",
"row_count": 1
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde reports:export izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 unknown_report · 429 çok sık istek
reports.request_export
Tüm satırları dışa aktar — Bir raporun bir dönemde kapsadığı tüm satırların CSV dosyasını sıraya alır; kısa süre sonra indirilmeye hazır olur.
Gereken izin reports:export · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır)
https://app.getera.io/api/v1/report_exports/actions/request_export- Asıl adres:
POST /api/v1/actions/reports.request_export
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
datasetKey | string | evet | Rapor · en çok 120 |
filters | object / array | Filtreler | |
from | date-time | evet | Nereden |
to | date-time | evet | Bitiş |
timezone | string | Saat dilimi · en çok 64 |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
dataset_not_found | Rapor bulunamadı ya da modülüne erişiminiz yok. |
invalid_report_config | Filtreler raporun kendi alanlarını kullanmalı ve dönemin bitişi başlangıcından sonra olmalı. |
Yayımladığı olaylar: reports.exported
Neye yazar: report_export (insert) — The request, queued; the worker fills in the file
curl -X POST https://app.getera.io/api/v1/report_exports/actions/request_export \
-H "Authorization: Bearer $ERA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"datasetKey":"Report","from":"2026-11-02T09:00:00Z","to":"2026-11-02T09:00:00Z"}'{
"ok": true,
"result": "…",
"events": [
"reports.exported"
]
}import { createEra } from "@getera/sdk"
const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.reportExports.requestExport({
datasetKey: "Report",
from: "2026-11-02T09:00:00Z",
to: "2026-11-02T09:00:00Z"
})era report_exports request_export \
--dataset-key "Report" \
--from "2026-11-02T09:00:00Z" \
--to "2026-11-02T09:00:00Z"{
"name": "era__reports__request_export",
"arguments": {
"datasetKey": "Report",
"from": "2026-11-02T09:00:00Z",
"to": "2026-11-02T09:00:00Z"
}
}Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde reports:export izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 dataset_not_found, invalid_report_config · 429 çok sık istek
reports.send_digest
Zamanlanmış raporu gönder — Otomatik: rapor zamanlayıcısı, zamanlama geldiğinde çalıştırır.
Gereken izin reports:manage · dışarıya ulaşır (gönderir, yayımlar ya da ücret alır)
403 machine_only).https://app.getera.io/api/v1/report_schedules/{id}/actions/send_digest- Asıl adres:
POST /api/v1/actions/reports.send_digest
Girdi
| Alan | Tür | Zorunlu | Açıklama |
|---|---|---|---|
id | uuid | evet | Doldurulduğu yer: adresteki {id} · Zamanla · kimliği: report_schedule |
Ön koşullar
Koşul tutmazsa işlem 409 ve şu kodlardan biriyle reddedilir:
| Kod | Ne zaman reddedilir |
|---|---|
schedule_not_found | Zamanlama bulunmalı ve aktif olmalı. |
Yayımladığı olaylar: reports.digest
Neye yazar: report_schedule (update) — Stamps the send and moves the next run on
Hatalar: 401 kimlik bilgisi yok ya da süresi dolmuş · 403 kimlik bilgisinde reports:manage izni yok · 404 kayıt ya da modül erişim dışında · 422 geçersiz girdi (problems[]) · 409 schedule_not_found · 429 çok sık istek
Veri modelleri
ReportExport
Tablo report_export · Kaynak report_exports
GET /api/v1/report_exportsGET /api/v1/report_exports/{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 | ||
report_key | string · text | |||
format | string · text | |||
window_months | integer · int4 | evet | ||
compare | string · text | evet | ||
row_count | integer · int4 | |||
filename | string · text | evet | ||
exported_by | string (uuid) · uuid | evet | app_user | |
created_at | string (date-time) · timestamptz | |||
dataset_key | string · text | evet | ||
query | object · jsonb | evet | ||
period_from | string (date-time) · timestamptz | evet | ||
period_to | string (date-time) · timestamptz | evet | ||
timezone | string · text | evet | ||
status | string · text | queued, running, done, failed | ||
content | string · text | evet | ||
error | string · text | evet | ||
finished_at | string (date-time) · timestamptz | evet |
Birincil anahtar: id
Denetimler:
CHECK ((format = 'csv'::text))CHECK ((row_count >= 0))
ReportSchedule
Tablo report_schedule · Kaynak report_schedules
GET /api/v1/report_schedulesGET /api/v1/report_schedules/{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 | ||
report_key | string · text | |||
rule_id | string (uuid) · uuid | notification_rule | ||
frequency | string · text | daily, weekly, monthly | ||
send_hour | integer · int4 | |||
weekday | integer · int4 | |||
window_months | integer · int4 | |||
active | boolean · bool | |||
next_run_at | string (date-time) · timestamptz | |||
last_sent_at | string (date-time) · timestamptz | evet | ||
created_by | string (uuid) · uuid | evet | app_user | |
created_at | string (date-time) · timestamptz | |||
updated_at | string (date-time) · timestamptz |
Birincil anahtar: id
Denetimler:
CHECK (((send_hour >= 0) AND (send_hour <= 23)))CHECK (((weekday >= 0) AND (weekday <= 6)))CHECK (((window_months >= 1) AND (window_months <= 24)))
Olaylar
İş akışları ve webhook'lar bu olaylara tepki verir.
| Olay | Ne olur | Taşıdığı alanlar |
|---|---|---|
reports.digest | Zamanlanmış bir rapor özeti hazır; yalnızca adını verdiği kurala teslim edilir. | schedule_id, report_key, title, route, lines, notificationRuleId |
reports.exported | Bir rapor CSV olarak indirildi. | export_id, report_key, row_count |
reports.schedule_created | Bir rapor teslim için zamanlandı. | schedule_id, report_key, frequency |
reports.schedule_deleted | Zamanlanmış bir rapor durduruldu. | schedule_id, report_key |