{"openapi":"3.1.0","info":{"title":"POST /api/v1/businesses/{business_id}/managerial-key-mappings/key-types","version":"1.0.0","description":"Create a managerial key type"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/businesses/{business_id}/managerial-key-mappings/key-types":{"post":{"tags":["managerial-key-mappings"],"summary":"Create a managerial key type","description":"Add a new key type (a column of the mapping table). The key is a lowercase slug and must be unique within the business.","operationId":"create_managerial_key_type_api_v1_businesses__business_id__managerial_key_mappings_key_types_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/ManagerialKeyTypeCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ManagerialKeyTypeResponse_"}}}},"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"}}}},"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":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ManagerialKeyTypeCreateRequest":{"properties":{"key":{"type":"string","maxLength":40,"minLength":1,"pattern":"^[a-z][a-z0-9_]*$","title":"Key","description":"Stable slug used in the API (lowercase, digits, underscores)."},"label":{"type":"string","maxLength":100,"minLength":1,"title":"Label"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"sort_order":{"type":"integer","maximum":999.0,"minimum":0.0,"title":"Sort Order","default":100}},"type":"object","required":["key","label"],"title":"ManagerialKeyTypeCreateRequest"},"ManagerialKeyTypeResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Definition row id. For an implicit default that has not been customised yet this equals ``key``."},"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"sort_order":{"type":"integer","title":"Sort Order"},"is_active":{"type":"boolean","title":"Is Active"},"is_default":{"type":"boolean","title":"Is Default","description":"True for the built-in defaults every business has.","default":false},"mapping_count":{"type":"integer","title":"Mapping Count","description":"Number of ledgers mapped under this key type.","default":0}},"type":"object","required":["id","key","label","sort_order","is_active"],"title":"ManagerialKeyTypeResponse","description":"One key type (a column of the mapping table)."},"SuccessEnvelope_ManagerialKeyTypeResponse_":{"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/ManagerialKeyTypeResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ManagerialKeyTypeResponse]"},"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":[]}]}