{"openapi":"3.1.0","info":{"title":"PUT /api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-mappings","version":"1.0.0","description":"Upsert managerial bucket assignments for GL accounts"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-mappings":{"put":{"tags":["cfo-portal"],"summary":"Upsert managerial bucket assignments for GL accounts","description":"Save bucket assignments edited on the Recipe Book page.\n\nThe response is the refreshed Recipe Book section so the frontend\ncan swap state in one round-trip without a follow-up GET.","operationId":"cfo_portal_upsert_managerial_mappings_api_v1_businesses__business_id__cfo_portal_recipe_book_managerial_mappings_put","parameters":[{"name":"business_id","in":"path","required":true,"schema":{"type":"string","title":"Business Id"}},{"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/ManagerialMappingUpsertRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CfoPortalSectionResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CfoPortalSectionResponse":{"properties":{"business_id":{"type":"string","title":"Business Id"},"section":{"type":"string","title":"Section"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"},"sources":{"items":{"$ref":"#/components/schemas/CfoPortalSource"},"type":"array","title":"Sources"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["business_id","section","generated_at"],"title":"CfoPortalSectionResponse","description":"Typed envelope for a CFO portal section payload."},"CfoPortalSource":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"status":{"type":"string","title":"Status","description":"available, empty, partial, or unavailable","default":"available"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["key","label"],"title":"CfoPortalSource","description":"Metadata for a CFO portal section's backing source."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ManagerialMappingItem":{"properties":{"ledger_id":{"type":"string","minLength":1,"title":"Ledger Id"},"bucket":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Bucket"}},"type":"object","required":["ledger_id"],"title":"ManagerialMappingItem","description":"Single GL ledger -> managerial bucket assignment.\n\nA ``bucket`` of ``None`` (or omitting the field on PUT) clears any\nexisting mapping for the ledger.  Otherwise it must be one of the\nallowed bucket keys validated in the service layer\n(``app.models.managerial_account_mappings.MANAGERIAL_BUCKETS``)."},"ManagerialMappingUpsertRequest":{"properties":{"mappings":{"items":{"$ref":"#/components/schemas/ManagerialMappingItem"},"type":"array","title":"Mappings"}},"type":"object","title":"ManagerialMappingUpsertRequest","description":"Bulk upsert payload for the Recipe Book bucket-mapping editor.\n\nSending an empty list is valid and is a no-op; sending a row with\n``bucket: null`` clears that ledger's mapping.  Ledgers not\nreferenced in the payload are left untouched, which lets the\nfrontend save one row at a time without re-sending the whole CoA."},"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":[]}]}