Close a reference month into an immutable report
Closes a month that has ended and freezes its result as an immutable report, which the call returns.
The close fixes a cutoff 60 seconds before an instant that it reads from the database clock, and it reads the read replica when one is configured, and the primary otherwise. The replica must be a physical standby of the SPI database. A node that is not in recovery answers 503 (PIX-0727) before anything is claimed. A replica that has not applied every commit up to the cutoff answers 503 (PIX-0715) with Retry-After, and nothing is frozen. The cutoff is fixed on the first attempt, and every resend of the same close reuses it. A fact, a correction or a declaration recorded less than 60 seconds before the first attempt is after the cutoff: the report leaves it out, and it counts only after a reopen and a new close.
transactions comes from the settlements outside SPI and the outbound fraud refusals that you recorded as facts, each settlement classified by the declarations in force at the cutoff. refunds comes from the refunds outside SPI that you recorded as facts, and it is UNAVAILABLE when the month has none. transactionTimes comes from the SPI transfers and the settlements that the tenant paid. dictLookups and the p99KeyLookupTime indicator come from the key lookups recorded on key and QR code initiations, and their coverage is always PARTIAL or UNAVAILABLE. Every other block and indicator is UNAVAILABLE with its reason.
Only a past month can be closed. A future month answers 422 (PIX-0710) and the current month answers 422 (PIX-0713). A month already closed answers its current report with 200. A close under another X-Idempotency key while one runs, or a resend while the claim of an earlier failed attempt holds, answers 409 (PIX-0712) with Retry-After. Each serving instance computes one close for each tenant at a time, and each database one close at a time. When no slot is free, the route answers 429 (PIX-0006) with Retry-After before it claims anything. The month goes in the period of the body. An absent period answers 400 (PIX-0002). A period that is not YYYY-MM, or is before 2020-11, answers 400 (PIX-0003).
Headers
REQUIRED. Client-supplied replay key, at most 64 bytes. A request without it is refused with PIX-0030 @ 400 before the handler runs. An identical resend within 1 hour returns the original response, status included, with X-Idempotency-Replayed: true. Reusing the key with a divergent method, URL or body is PIX-0031 @ 412.
1 - 64Body
Response
OK

