{"openapi":"3.1.0","info":{"title":"POST /api/v1/accounting-periods/bulk-lock","version":"1.0.0","description":"Bulk close-and-lock accounting periods"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/accounting-periods/bulk-lock":{"post":{"tags":["accounting-periods"],"summary":"Bulk close-and-lock accounting periods","description":"Close and lock multiple accounting periods in one call. Designed for historical-data migration: any open period in the list is closed first, then transitioned to locked. Already-locked periods are skipped.","operationId":"bulk_lock_periods_api_v1_accounting_periods_bulk_lock_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkLockPeriodsRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkLockPeriodsResult"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BulkLockPeriodsRequest":{"properties":{"period_ids":{"items":{"type":"string"},"type":"array","maxItems":120,"minItems":1,"title":"Period Ids","description":"Period UUIDs to lock"},"lock_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lock Reason","description":"Reason recorded on each period. Defaults to 'Historical migration - bulk locked' when omitted."}},"type":"object","required":["period_ids"],"title":"BulkLockPeriodsRequest","description":"Bulk-close-and-lock a list of accounting periods.\n\nIntended for historical-data migration where the user already\nreviewed the months offline and just wants the periods locked."},"BulkLockPeriodsResult":{"properties":{"locked_count":{"type":"integer","minimum":0.0,"title":"Locked Count","description":"Periods that ended up locked"},"skipped_count":{"type":"integer","minimum":0.0,"title":"Skipped Count","description":"Periods skipped (already locked / not found)"},"locked_ids":{"items":{"type":"string"},"type":"array","title":"Locked Ids"},"skipped":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Skipped","description":"Per-period skip info: {period_id, reason}"}},"type":"object","required":["locked_count","skipped_count"],"title":"BulkLockPeriodsResult","description":"Outcome of a bulk lock operation."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}