agency-time
POST /v1/agency/time/billing-runs
Bill now — turn unbilled time into a draft invoice.
Πισtoποίηση
Στείλτε ένα κλειδί API ως διακριτικό φορέα (bearer token). Αυτό το τελικό σημείο δεν ορίζει μια συγκεκριμένη άδεια στην προδιαγραφή, οπότε δώστε στο κλειδί σας τα ελάχιστα δυνατά δικαιώματα και ελέγξτε την απόκριση αντί να κάνετε υποθέσεις.
Πού μπαίνει το αναγνωριστικό του οργανισμού σας
Αυτό το endpoint δέχεται το πεδίο org_id στο σώμα JSON.
Το αναγνωριστικό του οργανισμού σας βρίσκεται στην οθόνη των κλειδιών API στον πίνακα ελέγχου σας, δίπλα στο ίδιο το κλειδί. Είναι το ίδιο αναγνωριστικό σε κάθε κλήση που πραγματοποιείτε.
Δοκιμάστε το
Ατικatastήstε ό,τι βρίskεtai μέσα σe γώniaδeς μe τis δikές sas timές, kai to placeholder klεidioύ μe éna klεidi apó ton pinaka ελέgchou sas.
curl -X POST https://api.zinndigital.com/v1/agency/time/billing-runs \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "client_id": <string>, "currency": <string> }'Συνδεθήκατε; Η κονσόλα API στον πίνακα ελέγχου σας συμπληρώνει το πραγματικό αναγνωριστικό του οργανισμού σας και το δικό σας κλειδί, και εκτελεί το αίτημα στο ζωντανό API, ώστε να μπορείτε να δείτε την πραγματική απόκριση. Ανοίξτε αυτό το τελικό σημείο στην κονσόλα API
Λεπτομέρειες
The owner's *"as well as sending on demand invoices"*. Claims the client's unbilled, priced work, hands it to the agency invoicing suite as a **draft**, and records what came back. ⛔ The entries are claimed in a committed transaction **before** the invoicing suite is called, so no other trigger can select them while the call is in flight. The idempotency key handed to the suite is derived from the sorted entry ids rather than minted, so a retry after a crash is given back the invoice that already exists instead of raising a second one for the same hours. `reconcile_state` is `ok` only when the invoice's total for these lines equals our own exact arithmetic. `mismatch` means do not send it.
Σώμα αίτησης
| Όνομα | Τύpος | Υποχρεωτικό | Τι είναι |
|---|---|---|---|
client_id | string | Ναι | — |
currency | string | Ναι | — |
until | string | Όχι | Bill work up to and including this date — "everything to the end of last month". |
notes | string | Όχι | — |
org_id | string | Όχι | — |
Απάντηση
| Όνομα | Τύpος | Υποχρεωτικό | Τι είναι |
|---|---|---|---|
id | string | Ναι | — |
client_id | string | Όχι | — |
currency | string | Ναι | — |
period_start | string | Όχι | — |
period_end | string | Όχι | — |
trigger | string<manual, on_log, day_of_month, threshold> | Ναι | — |
status | string<claimed, invoiced, failed, released> | Ναι | `claimed` is the state between claiming the time and the invoicing suite's reply — a process that dies there leaves one, and the recovery pass finishes it with the same derived… |
subtotal_minor | integer | Ναι | Our own exact arithmetic, before tax. What the invoice is reconciled against. |
minutes_total | integer | Ναι | — |
duration_label | string | Όχι | — |
entry_count | integer | Όχι | — |
fixed_line_count | integer | Όχι | — |
invoice_id | string | Όχι | — |
invoice_number | string | Όχι | — |
invoice_created | boolean | Όχι | FALSE means the invoicing suite's idempotency key fired and handed back an invoice an earlier attempt had already raised. Surfaced rather than hidden: it is the observable that… |
reconcile_state | string<pending, ok, mismatch, unavailable> | Όχι | Whether the invoice's total for these lines equals our own arithmetic **exactly**. There is no "close enough": both sides compute from the same two integers, so any difference i… |
reconcile_detail | string | Όχι | — |
invoiced_at | string | Όχι | — |
released_at | string | Όχι | — |
last_error | string | Όχι | — |
created_at | string | Ναι | — |
actual | object | Όχι | What this run actually consumed, derived from the time entries rather than read off the run's stored columns — so a divergence is visible on the screen. |
Σφάλματα που μπορεί να επιστρέψει αυτό το τελικό σημείο
401 · 403 · 422