{"openapi":"3.1.0","info":{"title":"POST /api/v1/businesses/{business_id}/cfo-portal/buckets","version":"1.0.0","description":"Create a custom managerial bucket"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/cfo-portal/buckets":{"post":{"tags":["cfo-portal"],"summary":"Create a custom managerial bucket","description":"Create a new custom managerial bucket for categorizing GL accounts.\n\nThe bucket key must be unique and cannot conflict with default\nbucket keys. Use lowercase letters, numbers, and underscores only.","operationId":"cfo_portal_create_bucket_api_v1_businesses__business_id__cfo_portal_buckets_post","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/CustomBucketCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomBucketResponse"}}}},"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":{"CustomBucketCreateRequest":{"properties":{"key":{"type":"string","maxLength":40,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Key","description":"Unique slug for the bucket (lowercase, underscores allowed)"},"label":{"type":"string","maxLength":100,"minLength":1,"title":"Label","description":"Display name for the bucket"},"color":{"type":"string","maxLength":20,"title":"Color","description":"Color theme: green, orange, indigo, accent, gray","default":"gray"},"classification":{"type":"string","maxLength":40,"title":"Classification","description":"Bucket classification: operating_revenue, cogs, operating_expense, other_income, other_expense","default":"operating_expense"},"sort_order":{"type":"integer","maximum":999.0,"minimum":0.0,"title":"Sort Order","default":100}},"type":"object","required":["key","label"],"title":"CustomBucketCreateRequest","description":"Request payload for creating a new custom managerial bucket."},"CustomBucketResponse":{"properties":{"id":{"type":"string","title":"Id"},"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"color":{"type":"string","title":"Color"},"classification":{"type":"string","title":"Classification"},"sort_order":{"type":"integer","title":"Sort Order"},"is_active":{"type":"boolean","title":"Is Active"},"is_default":{"type":"boolean","title":"Is Default","description":"True for built-in default buckets","default":false},"can_delete":{"type":"boolean","title":"Can Delete","description":"Whether the bucket can be deleted from Recipe Book. Some built-in buckets are locked.","default":true}},"type":"object","required":["id","key","label","color","classification","sort_order","is_active"],"title":"CustomBucketResponse","description":"A managerial bucket (built-in or custom).\n\nBuilt-in buckets have stable ``key`` values; optional ``label`` /\n``color`` edits come from per-business display overrides."},"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":[]}]}