{"openapi":"3.1.0","info":{"title":"POST /api/v1/catalog-items","version":"1.0.0","description":"Create catalog item"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/catalog-items":{"post":{"tags":["catalog-items"],"summary":"Create catalog item","description":"Create a new Products & Services catalog item.","operationId":"create_catalog_item_api_v1_catalog_items_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/CatalogItemCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CatalogItemResponse_"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists","content":{"application/json":{"example":{"detail":"Resource already exists"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CatalogItemCreateRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Item name."},"item_type":{"type":"string","title":"Item Type","description":"One of: service, non_inventory, inventory, bundle.","default":"service"},"sku":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Sku","description":"Optional SKU/code."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Default sales description for line items."},"billing_rule":{"type":"string","title":"Billing Rule","description":"How this item bills: flat, per_unit, recurring, usage_metered, or prepaid_block.","default":"flat"},"unit_label":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Unit Label","description":"Unit-of-measure label, e.g. 'hour'."},"unit_price":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d{0,2}0*$"},{"type":"null"}],"title":"Unit Price","description":"Default sales price in cents (e.g. 15000 = $150.00); up to 2 decimal places of a cent for sub-cent rates (5.25 = $0.0525)."},"purchase_cost":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Purchase Cost","description":"Default purchase cost in cents."},"is_sold":{"type":"boolean","title":"Is Sold","description":"Item is available on sales documents.","default":true},"is_purchased":{"type":"boolean","title":"Is Purchased","description":"Item is available on purchase documents.","default":false},"taxable":{"type":"boolean","title":"Taxable","description":"Item is taxable by default.","default":false},"income_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Income Ledger Id","description":"Revenue ledger account used when this item is sold."},"expense_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expense Ledger Id","description":"Expense ledger account used when this item is purchased."}},"type":"object","required":["name"],"title":"CatalogItemCreateRequest","description":"Request schema for creating a catalog item."},"CatalogItemResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Catalog item UUID."},"business_id":{"type":"string","title":"Business Id","description":"Business UUID."},"name":{"type":"string","title":"Name"},"item_type":{"type":"string","title":"Item Type"},"billing_rule":{"type":"string","title":"Billing Rule","default":"flat"},"unit_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit Label"},"sku":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sku"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"unit_price":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Unit Price"},"purchase_cost":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Purchase Cost"},"is_sold":{"type":"boolean","title":"Is Sold"},"is_purchased":{"type":"boolean","title":"Is Purchased"},"taxable":{"type":"boolean","title":"Taxable"},"income_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Income Ledger Id"},"expense_ledger_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expense Ledger Id"},"income_ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Income Ledger Name"},"expense_ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expense Ledger Name"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","business_id","name","item_type","is_sold","is_purchased","taxable","is_active","created_at","updated_at"],"title":"CatalogItemResponse","description":"Response schema for a catalog item."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_CatalogItemResponse_":{"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/CatalogItemResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CatalogItemResponse]"},"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":[]}]}