{"openapi":"3.1.0","info":{"title":"POST /api/v1/fixed-assets","version":"1.0.0","description":"Create fixed asset"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/fixed-assets":{"post":{"tags":["fixed-assets"],"summary":"Create fixed asset","description":"Create a new fixed asset.\n\n**Request Body:**\n- `name`: Asset name, 1-255 chars (required)\n- `purchase_date`: Purchase date in YYYY-MM-DD format (required)\n- `original_cost`: Original cost in cents, must be >= 0 (required)\n- `description`: Asset description (optional)\n- `asset_number`: Asset number, max 50 chars (optional)\n- `serial_number`: Serial number, max 100 chars (optional)\n- `salvage_value`: Salvage value in cents, must be >= 0 and < original_cost (optional, defaults to 0)\n- `useful_life_months`: Useful life in months, 1-600 (optional, defaults to 60)\n- `depreciation_method`: Depreciation method - straight_line, declining_balance, double_declining, units_of_production (optional, defaults to 'straight_line')\n- `location`: Asset location, max 255 chars (optional)\n- `notes`: Additional notes (optional)\n- `category_id`: Asset category UUID (optional)\n- `vendor_id`: Vendor UUID (optional)\n- `in_service_date`: Date asset was placed in service, YYYY-MM-DD format (optional)\n- `total_expected_units`: Total expected units for units_of_production method, must be >= 1 (optional)\n\n**Note:** The asset starts in 'draft' status. Use POST /fixed-assets/{id}/place-in-service\nto begin depreciation.\n\n**Returns:** Created fixed asset.","operationId":"create_fixed_asset","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/FixedAssetCreate"},"example":{"asset_number":"FA-0042","category_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f50","depreciation_method":"straight_line","in_service_date":"2026-01-20","name":"MacBook Pro 16-inch","original_cost":349900,"purchase_date":"2026-01-15","salvage_value":50000,"serial_number":"C02XG1ABCD12","useful_life_months":36,"vendor_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f02"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_FixedAssetResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"create_fixed_asset_api_v1_fixed_assets_post"}}},"components":{"schemas":{"AssetStatus":{"type":"string","enum":["draft","active","fully_depreciated","disposed"],"title":"AssetStatus","description":"Fixed asset lifecycle status."},"DepreciationMethod":{"type":"string","enum":["straight_line","declining_balance","double_declining","units_of_production"],"title":"DepreciationMethod","description":"Depreciation calculation methods."},"DisposalMethod":{"type":"string","enum":["sold","traded","scrapped","lost","donated"],"title":"DisposalMethod","description":"How an asset was disposed."},"FixedAssetCreate":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Asset name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Asset description"},"asset_number":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Asset Number","description":"User-defined asset tracking number"},"serial_number":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Serial Number","description":"Manufacturer serial number"},"purchase_date":{"type":"string","format":"date","title":"Purchase Date","description":"Date the asset was purchased"},"original_cost":{"type":"integer","minimum":0.0,"title":"Original Cost","description":"Purchase cost in cents"},"salvage_value":{"type":"integer","minimum":0.0,"title":"Salvage Value","description":"Estimated salvage value in cents","default":0},"useful_life_months":{"type":"integer","maximum":600.0,"minimum":1.0,"title":"Useful Life Months","description":"Expected useful life in months","default":60},"depreciation_method":{"$ref":"#/components/schemas/DepreciationMethod","description":"Depreciation calculation method","default":"straight_line"},"location":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Location","description":"Physical location of the asset"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Additional notes"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"Asset category ID"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id","description":"Vendor the asset was purchased from"},"in_service_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"In Service Date","description":"Date the asset was placed in service (starts depreciation)"},"total_expected_units":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Total Expected Units","description":"Total expected units for units-of-production depreciation"},"opening_accumulated_depreciation":{"type":"integer","minimum":0.0,"title":"Opening Accumulated Depreciation","description":"Depreciation/amortization already recognised before go-live, in cents. Counts toward accumulated depreciation but never posts a journal entry (it is already on the books).","default":0},"go_live_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Go Live Date","description":"First month DayZero posts depreciation for this asset. Required with an opening accumulated balance; earlier months are never queued."},"depreciation_expense_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Depreciation Expense Ledger Id","description":"Per-asset expense account override (falls back to the category, then the system Depreciation Expense ledger)"}},"type":"object","required":["name","purchase_date","original_cost"],"title":"FixedAssetCreate","description":"Schema for creating a fixed asset.","example":{"asset_number":"FA-0042","category_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f50","depreciation_method":"straight_line","in_service_date":"2026-01-20","name":"MacBook Pro 16-inch","original_cost":349900,"purchase_date":"2026-01-15","salvage_value":50000,"serial_number":"C02XG1ABCD12","useful_life_months":36,"vendor_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f02"},"examples":[{"asset_number":"FA-0042","category_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f50","depreciation_method":"straight_line","in_service_date":"2026-01-20","name":"MacBook Pro 16-inch","original_cost":349900,"purchase_date":"2026-01-15","salvage_value":50000,"serial_number":"C02XG1ABCD12","useful_life_months":36,"vendor_id":"0192a4f0-1b2c-7d3e-8f4a-5b6c7d8e9f02"}]},"FixedAssetResponse":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Asset name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Asset description"},"asset_number":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Asset Number","description":"User-defined asset tracking number"},"serial_number":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Serial Number","description":"Manufacturer serial number"},"purchase_date":{"type":"string","format":"date","title":"Purchase Date","description":"Date the asset was purchased"},"original_cost":{"type":"integer","minimum":0.0,"title":"Original Cost","description":"Purchase cost in cents"},"salvage_value":{"type":"integer","minimum":0.0,"title":"Salvage Value","description":"Estimated salvage value in cents","default":0},"useful_life_months":{"type":"integer","maximum":600.0,"minimum":1.0,"title":"Useful Life Months","description":"Expected useful life in months","default":60},"depreciation_method":{"$ref":"#/components/schemas/DepreciationMethod","description":"Depreciation calculation method","default":"straight_line"},"location":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Location","description":"Physical location of the asset"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes","description":"Additional notes"},"id":{"type":"string","title":"Id","description":"Asset ID"},"category_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Id","description":"Asset category ID"},"category_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category Name","description":"Asset category name"},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id","description":"Vendor ID"},"in_service_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"In Service Date","description":"Date placed in service"},"total_expected_units":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Expected Units","description":"Total expected units (units-of-production method)"},"units_used_to_date":{"type":"integer","title":"Units Used To Date","description":"Cumulative units used to date","default":0},"status":{"$ref":"#/components/schemas/AssetStatus","description":"Asset lifecycle status: draft, active, fully_depreciated, disposed"},"disposal_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Disposal Date","description":"Date the asset was disposed"},"disposal_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Disposal Amount","description":"Sale/trade proceeds in cents"},"disposal_method":{"anyOf":[{"$ref":"#/components/schemas/DisposalMethod"},{"type":"null"}],"description":"How the asset was disposed"},"depreciable_amount":{"type":"integer","title":"Depreciable Amount","description":"Cost minus salvage value, in cents"},"accumulated_depreciation":{"type":"integer","title":"Accumulated Depreciation","description":"Total depreciation taken to date, in cents"},"book_value":{"type":"integer","title":"Book Value","description":"Current book value (cost - accumulated depreciation), in cents"},"monthly_depreciation_amount":{"type":"integer","title":"Monthly Depreciation Amount","description":"Monthly depreciation amount, in cents"},"remaining_life_months":{"type":"integer","title":"Remaining Life Months","description":"Remaining useful life in months"},"opening_accumulated_depreciation":{"type":"integer","title":"Opening Accumulated Depreciation","description":"Depreciation recognised before go-live (no JE), in cents","default":0},"opening_book_value":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Opening Book Value","description":"Book value at go-live, in cents"},"go_live_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Go Live Date","description":"First month DayZero posts for this asset"},"depreciation_expense_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Depreciation Expense Ledger Id","description":"Per-asset expense account override"},"schedule_kind":{"type":"string","enum":["depreciation","amortization"],"title":"Schedule Kind","description":"'amortization' when the schedule draws down a current-asset (prepaid) account, else 'depreciation'","default":"depreciation"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Record creation timestamp"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Last update timestamp"}},"type":"object","required":["name","purchase_date","original_cost","id","status","depreciable_amount","accumulated_depreciation","book_value","monthly_depreciation_amount","remaining_life_months","created_at","updated_at"],"title":"FixedAssetResponse","description":"Schema for fixed asset response."},"SuccessEnvelope_FixedAssetResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/FixedAssetResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[FixedAssetResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}