{"openapi":"3.1.0","paths":{"/api/v1/contexts/{type}/{id}/api-keys":{"post":{"summary":"Create a new API key","tags":["apiKeys"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"expiresAt":{"type":"string","format":"date-time"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"createdBy":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"webhookSecret":{"type":"string","nullable":true}},"required":["id","context","name","createdAt","expiresAt","lastUsedAt","createdBy","webhookSecret"]},"key":{"type":"string"}},"required":["apiKey","key"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"get":{"summary":"List all API keys for a context","tags":["apiKeys"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"lastUsedAt":{"type":"string","format":"date-time","nullable":true},"createdBy":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"webhookSecret":{"type":"string","nullable":true}},"required":["id","context","name","createdAt","expiresAt","lastUsedAt","createdBy","webhookSecret"]}}},"required":["data"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/contexts/{type}/{id}/api-keys/{apiKeyId}":{"delete":{"summary":"Revoke an API key","tags":["apiKeys"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"apiKeyId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"204","content":{"application/json":{"schema":{}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}/customers/{customerId}/applications":{"get":{"summary":"Get all applications for a customer","tags":["applications"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"environment":{"default":"production","type":"string","enum":["production","sandbox"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","customerId","name","slugId","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["total","page","pageSize","totalPages"]}},"required":["data","meta"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"post":{"summary":"Create a new application","tags":["applications"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":1},"environment":{"default":"production","type":"string","enum":["production","sandbox"]}},"required":["customerId","name","slugId"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"environment":{"default":"production","type":"string","enum":["production","sandbox"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","customerId","name","slugId","createdAt","updatedAt"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}/customers/{customerId}/applications/{id}":{"get":{"summary":"Get an application by ID","tags":["applications"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"environment":{"default":"production","type":"string","enum":["production","sandbox"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","customerId","name","slugId","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"patch":{"summary":"Update an application","tags":["applications"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":1},"environment":{"type":"string","enum":["production","sandbox"]}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"environment":{"default":"production","type":"string","enum":["production","sandbox"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","customerId","name","slugId","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"summary":"Delete an application","tags":["applications"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"environment":{"default":"production","type":"string","enum":["production","sandbox"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","customerId","name","slugId","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers":{"get":{"summary":"Search customers by name, legal name, emails, contact, etc","tags":["customers"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"customerId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"page","in":"query","schema":{"default":1,"type":"number","minimum":1}},{"name":"limit","in":"query","schema":{"default":100,"type":"number","minimum":1}},{"name":"dateRange","in":"query","style":"deepObject","schema":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}}},{"name":"refresh","in":"query","schema":{"type":"boolean","nullable":true}},{"name":"status","in":"query","schema":{"type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"]}},{"name":"excludeArchived","in":"query","description":"When true, archived customers are excluded from results. Ignored if status is provided.","schema":{"type":"boolean","nullable":true}},{"name":"customerName","in":"query","schema":{"type":"string"}},{"name":"sortBy","in":"query","schema":{"type":"string","enum":["customernumber","name"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","legalName","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["total","page","pageSize","totalPages"]}},"required":["data","meta"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers/{id}":{"get":{"summary":"Get a customer by ID","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","legalName","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/customers":{"post":{"summary":"Create a new customer","tags":["customers"],"parameters":[{"name":"organizationId","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"}},"required":["legalName"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","legalName","createdAt","updatedAt"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/customers/{id}":{"patch":{"summary":"Update a customer","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","legalName","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"summary":"Delete a customer","tags":["customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"nullable":true},"legalName":{"type":"string","minLength":1},"url":{"oneOf":[{"type":"string","nullable":true},{"type":"string","enum":[""]}],"nullable":true},"regNo":{"type":"string","nullable":true,"description":"Registration number"},"vat":{"type":"object","properties":{"number":{"type":"string","description":"VAT number"},"type":{"type":"string","enum":["SEVAT","SEREVERSEDVAT","EUREVERSEDVAT","EUVAT","EXPORT"],"description":"VAT type"}},"nullable":true,"description":"VAT number and type"},"address1":{"type":"string","nullable":true,"description":"Address 1"},"address2":{"type":"string","nullable":true,"description":"Address 2"},"zipCode":{"type":"string","nullable":true},"city":{"type":"string","minLength":1,"nullable":true},"state":{"type":"string","nullable":true},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"],"nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"financeEmail":{"type":"string","format":"email","nullable":true},"contact":{"type":"string","nullable":true},"contactEmail":{"oneOf":[{"type":"string","format":"email"},{"type":"string","enum":[""],"nullable":true}],"nullable":true},"erpId":{"type":"string","nullable":true},"crmId":{"type":"string","nullable":true},"relatedCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"default":"ACTIVE","type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"],"description":"Customer status"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","legalName","createdAt","updatedAt"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/dashboards":{"get":{"description":"Returns a paginated list of dashboards the user can access based on their current context and permissions","summary":"List dashboards accessible in current context","tags":["dashboards"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"customerId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"page","in":"query","schema":{"default":1,"type":"number","minimum":1}},{"name":"limit","in":"query","schema":{"default":100,"type":"number","minimum":1}},{"name":"dateRange","in":"query","style":"deepObject","schema":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}}},{"name":"refresh","in":"query","schema":{"type":"boolean","nullable":true}},{"name":"sortBy","in":"query","schema":{"type":"string","enum":["customernumber","name"]}},{"name":"visibility","in":"query","schema":{"type":"string","enum":["private","internal","public"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contextType":{"default":"organization","type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string","format":"uuid"},"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["contextId","name"]}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["total","page","pageSize","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"post":{"description":"Creates a new dashboard in the current context or specified context","summary":"Create a new dashboard","tags":["dashboards"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contextType":{"default":"organization","type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string","format":"uuid"},"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["contextId","name"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/dashboards/home":{"get":{"description":"Returns the home page dashboard for the current user's context. Priority: private > internal > public.","summary":"Get the home page dashboard","tags":["dashboards"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contextType":{"default":"organization","type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string","format":"uuid"},"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["contextId","name"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/dashboards/{dashboardId}":{"get":{"description":"Returns a single dashboard by its ID if the user has access to it","summary":"Get a dashboard by ID","tags":["dashboards"],"parameters":[{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contextType":{"default":"organization","type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string","format":"uuid"},"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["contextId","name"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"put":{"description":"Updates an existing dashboard if the user has permission","summary":"Update a dashboard","tags":["dashboards"],"parameters":[{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contextType":{"default":"organization","type":"string","enum":["organization","partner","customer","user"]},"contextId":{"type":"string","format":"uuid"},"visibility":{"default":"internal","type":"string","enum":["private","internal","public"]},"name":{"type":"string","minLength":1},"description":{"type":"string"},"layoutType":{"default":"grid","type":"string","enum":["grid","flex","fixed"]},"isHomePage":{"default":false,"type":"boolean"},"globalFilters":{"type":"array","items":{"discriminator":{"propertyName":"type"},"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["date_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"default":{"type":"object","properties":{"preset":{"type":"string"},"custom":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"timezone":{"type":"string"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["text"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"string"}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["multi_select"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"default":{"type":"array","items":{"type":"string"}}},"required":["id","type","label","options"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["number_range"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"default":{"type":"object","properties":{"from":{"type":"number"},"to":{"type":"number"}}}},"required":["id","type","label"]},{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["search_filter"]},"label":{"type":"string"},"enabled":{"default":true,"type":"boolean"},"placeholder":{"type":"string"},"default":{"type":"string"},"negate":{"type":"boolean"}},"required":["id","type","label"]}]}},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"widgetType":{"type":"string","enum":["counter","piechart","table","timeseries","note"]},"title":{"type":"string"},"description":{"type":"string"},"query":{"type":"string"},"dataset":{"type":"string"},"positionX":{"type":"integer","minimum":0},"positionY":{"type":"integer","minimum":0},"width":{"type":"integer","minimum":1},"height":{"type":"integer","minimum":1},"config":{"oneOf":[{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"chartType":{"type":"string","enum":["line","area","bar"]},"xAxis":{"type":"object","properties":{"dataKey":{"type":"string"},"label":{"type":"string"}},"required":["dataKey"]},"yAxis":{"type":"object","properties":{"label":{"type":"string"},"min":{"type":"number"},"max":{"type":"number"}}}},"required":["chartType","xAxis","yAxis"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"format":{"type":"string","enum":["number","currency","percentage"]},"prefix":{"type":"string"},"suffix":{"type":"string"},"decimals":{"type":"number"},"size":{"type":"string","enum":["small","medium","large","xlarge"]},"currency":{"type":"string"},"locale":{"type":"string"},"accentColor":{"type":"string"},"icon":{"type":"string"},"comparison":{"type":"object","properties":{"enabled":{"type":"boolean"},"type":{"type":"string","enum":["percentage","absolute"]},"period":{"type":"string","enum":["previous","year_ago"]},"invertColors":{"type":"boolean"}},"required":["enabled","type","period"]},"customCss":{"type":"string"}},"required":["format"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"donut":{"type":"boolean"},"labelKey":{"type":"string"},"valueKey":{"type":"string"},"showPercentage":{"type":"boolean"},"legendPosition":{"type":"string","enum":["top","bottom","left","right"]},"maxSize":{"type":"integer","minimum":1}},"required":["labelKey","valueKey"]},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"content":{"default":"","type":"string"}}},{"type":"object","properties":{"legend":{"type":"boolean"},"tooltip":{"type":"boolean"},"colors":{"type":"array","items":{"type":"string"}},"borderStyle":{"type":"string","enum":["none","solid","dashed","dotted"]},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"header":{"type":"string"},"width":{"type":"number"},"format":{"type":"string","enum":["text","number","currency","date","boolean"]}},"required":["key","header"]}},"pagination":{"type":"boolean"},"pageSize":{"type":"number"}},"required":["columns"]},{"type":"object","additionalProperties":{"nullable":true}}]},"filterMapping":{"type":"object","additionalProperties":{"type":"object","properties":{"enabled":{"type":"boolean"},"mapTo":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["enabled"]}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","widgetType","title","query","dataset","positionX","positionY","width","height","config"]}},"pages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["dashboardId","name","sequenceNumber"]}},"createdBy":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["contextId","name"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"description":"Deletes a dashboard and all associated widgets if the user has permission","summary":"Delete a dashboard","tags":["dashboards"],"parameters":[{"name":"dashboardId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"204","content":{"application/json":{"schema":{}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables":{"post":{"summary":"Create a new decision table","tags":["decisionTables"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":1,"pattern":"^[a-z0-9-]+$","maxLength":100},"description":{"type":"string"},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"default":"first","type":"string","enum":["first","collect"]},"inputs":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}}},"required":["name","slugId"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"get":{"summary":"List all decision tables","tags":["decisionTables"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}},"required":["data"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/{decisionTableId}":{"get":{"summary":"Get a specific decision table by ID","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"summary":"Delete a decision table","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"204","content":{"application/json":{"schema":{}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/by-slug/{slugId}":{"get":{"summary":"Get a specific decision table by slug ID","tags":["decisionTables"],"parameters":[{"name":"slugId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"put":{"summary":"Upsert (create or update) a decision table by slug ID","tags":["decisionTables"],"parameters":[{"name":"slugId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}}},"required":["name","hitPolicy","inputs","outputs","rules"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/{decisionTableId}/metadata":{"patch":{"summary":"Update decision table metadata (name, description, hit policy, slugId)","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":1,"pattern":"^[a-z0-9-]+$","maxLength":100},"description":{"type":"string","nullable":true},"hitPolicy":{"type":"string","enum":["first","collect"]},"kind":{"type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"type":"boolean"},"priority":{"type":"integer"},"preConditions":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/{decisionTableId}/schema":{"put":{"summary":"Update decision table schema (columns) - replaces all columns","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}}},"required":["inputs","outputs"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/{decisionTableId}/rules":{"put":{"summary":"Update decision table rules - replaces all rules","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}}},"required":["rules"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/reorder":{"post":{"summary":"Reorder decision tables of a given kind by setting their priority","tags":["decisionTables"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"decisionTableIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["kind","decisionTableIds"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"slugId":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"default":"generic","type":"string","enum":["generic","fraud-block","routing","fees","emi-fees"]},"enabled":{"default":true,"type":"boolean"},"priority":{"default":0,"type":"integer"},"preConditions":{"default":[],"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1},"op":{"default":"in","type":"string","enum":["in","not-in"]},"values":{"default":[],"type":"array","items":{"type":"string"}}},"required":["field"]}},"hitPolicy":{"type":"string","enum":["first","collect"]},"inputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"outputs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"field":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","select","multiselect","regex","function"]},"enumName":{"type":"string"},"options":{"type":"array","items":{"type":"string"}},"functionName":{"type":"string"},"functionParams":{"type":"array","items":{"type":"string"}},"validation":{"type":"object","properties":{"required":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"pattern":{"type":"string"}}}},"required":["id","label"]}},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"enabled":{"type":"boolean"},"inputs":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"object","properties":{"value":{"type":"string"},"operator":{"type":"string"}},"required":["value"]}]}},"outputs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["id","inputs","outputs"]}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string","nullable":true}},"required":["id","context","name","slugId","description","hitPolicy","inputs","outputs","rules","createdAt","updatedAt","createdBy"]}}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/decision-tables/{decisionTableId}/test":{"post":{"summary":"Test a decision table with input values","tags":["decisionTables"],"parameters":[{"name":"decisionTableId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"matchedRuleIds":{"type":"array","items":{"type":"string"}},"outputs":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}}}},"required":["matchedRuleIds","outputs"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations":{"get":{"summary":"List organizations the user has access to","tags":["organizations"],"parameters":[{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"pageSize","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":500}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","createdAt","updatedAt"]}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["total","page","pageSize","totalPages"]}},"required":["data","meta"]}}}}}},"post":{"summary":"Create a new organization","tags":["organizations"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]}},"required":["name","status"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","createdAt","updatedAt"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}":{"get":{"summary":"Get an organization by ID","tags":["organizations"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","createdAt","updatedAt"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"patch":{"summary":"Update an organization","tags":["organizations"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string","enum":["ACTIVE","INACTIVE","SUSPENDED"]},"locale":{"default":"en","type":"string","enum":["en","sv","no","da","fi","de","fr","es","it","nl","pl","pt","ru","ja","zh","ko","ar","he"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","createdAt","updatedAt"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}/customers/sync":{"get":{"summary":"Sync organization's customers from Financial system","tags":["organizations"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"nullable":true}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/services/definitions":{"get":{"summary":"Get all available service definitions","tags":["serviceConnections"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"interfaces":{"type":"array","items":{"type":"string","enum":["erp","payment","analytics","crm","iplookup","binlookup","cardinspect"]}},"contexts":{"type":"array","items":{"type":"string","enum":["organization","partner","customer"]}},"authTypes":{"type":"array","items":{"type":"string","enum":["oauth","api_key"]}},"allowsMultipleConnections":{"default":true,"type":"boolean"},"uiMetadata":{"type":"object","properties":{"icon":{"type":"string"},"category":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","password","select","textarea","number","email","url","checkbox"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"description":{"type":"string"},"default":{"nullable":true},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"validation":{"type":"object","additionalProperties":{"nullable":true}}},"required":["name","label","type"]}},"description":{"type":"string"}}}},"required":["id","name","description","interfaces","contexts","authTypes"]}}}}}}}},"/api/v1/services/interfaces/{interface}":{"get":{"summary":"Get services implementing a specific interface","tags":["serviceConnections"],"parameters":[{"name":"interface","in":"path","required":true,"schema":{"type":"string","enum":["erp","payment","analytics","crm","iplookup","binlookup","cardinspect"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"interfaces":{"type":"array","items":{"type":"string","enum":["erp","payment","analytics","crm","iplookup","binlookup","cardinspect"]}},"contexts":{"type":"array","items":{"type":"string","enum":["organization","partner","customer"]}},"authTypes":{"type":"array","items":{"type":"string","enum":["oauth","api_key"]}},"allowsMultipleConnections":{"default":true,"type":"boolean"},"uiMetadata":{"type":"object","properties":{"icon":{"type":"string"},"category":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","password","select","textarea","number","email","url","checkbox"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"description":{"type":"string"},"default":{"nullable":true},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"validation":{"type":"object","additionalProperties":{"nullable":true}}},"required":["name","label","type"]}},"description":{"type":"string"}}}},"required":["id","name","description","interfaces","contexts","authTypes"]}}}}}}}},"/api/v1/services/contexts/{context}":{"get":{"summary":"Get services available for a specific context","tags":["serviceConnections"],"parameters":[{"name":"context","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"interfaces":{"type":"array","items":{"type":"string","enum":["erp","payment","analytics","crm","iplookup","binlookup","cardinspect"]}},"contexts":{"type":"array","items":{"type":"string","enum":["organization","partner","customer"]}},"authTypes":{"type":"array","items":{"type":"string","enum":["oauth","api_key"]}},"allowsMultipleConnections":{"default":true,"type":"boolean"},"uiMetadata":{"type":"object","properties":{"icon":{"type":"string"},"category":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","password","select","textarea","number","email","url","checkbox"]},"required":{"type":"boolean"},"placeholder":{"type":"string"},"description":{"type":"string"},"default":{"nullable":true},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"validation":{"type":"object","additionalProperties":{"nullable":true}}},"required":["name","label","type"]}},"description":{"type":"string"}}}},"required":["id","name","description","interfaces","contexts","authTypes"]}}}}}}}},"/api/v1/service-connections":{"get":{"summary":"List service connections for current context","tags":["serviceConnections"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"discriminator":{"propertyName":"authenticationType"},"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt","clientId","tokenExpiry"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"clientSecret":{"type":"string"},"refreshToken":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt"]}]}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/service-connections/{slugId}":{"get":{"summary":"Get a service connection by slugId (context from auth header)","tags":["serviceConnections"],"parameters":[{"name":"slugId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"discriminator":{"propertyName":"authenticationType"},"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt","clientId","tokenExpiry"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"clientSecret":{"type":"string"},"refreshToken":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/service-connections/oauth":{"post":{"summary":"Initiate an OAuth service connection flow","tags":["serviceConnections"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"config":{"type":"object","additionalProperties":{"nullable":true}}},"required":["serviceId","contextType","contextId","authenticationType","name","config"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"authorizationUrl":{"type":"string","format":"uri"},"state":{"type":"string"}},"required":["authorizationUrl","state"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/oauth/callback":{"get":{"summary":"Complete a service connection OAuth flow","tags":["serviceConnections"],"parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string"}},{"name":"state","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"discriminator":{"propertyName":"authenticationType"},"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt","clientId","tokenExpiry"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"clientSecret":{"type":"string"},"refreshToken":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt"]}]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/service-connections/api-key":{"post":{"summary":"Create an API key service connection","tags":["serviceConnections"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"config":{"type":"object","additionalProperties":{"nullable":true}}},"required":["serviceId","contextType","contextId","authenticationType","name","config"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"discriminator":{"propertyName":"authenticationType"},"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt","clientId","tokenExpiry"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"clientSecret":{"type":"string"},"refreshToken":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt"]}]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/service-connections/{id}/test":{"post":{"summary":"Test a service connection","tags":["serviceConnections"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"message":{"type":"string"}},"required":["status"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/service-connections/{id}":{"put":{"summary":"Update a service connection","tags":["serviceConnections"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"config":{"type":"object","additionalProperties":{"nullable":true}}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"discriminator":{"propertyName":"authenticationType"},"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["oauth"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt","clientId","tokenExpiry"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"serviceId":{"type":"string"},"slugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"authenticationType":{"type":"string","enum":["api_key"]},"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["ACTIVE","INACTIVE","PENDING","ERROR","EXPIRED"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"lastSyncedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"},"clientSecret":{"type":"string"},"refreshToken":{"type":"string"},"tokenExpiry":{"type":"string","format":"date-time"}},"required":["id","serviceId","slugId","contextType","contextId","authenticationType","name","status","config","createdAt","updatedAt"]}]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"summary":"Delete a service connection","tags":["serviceConnections"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/settings/groups":{"get":{"summary":"Get all registered settings group definitions","tags":["settings"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"group":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"contexts":{"type":"array","items":{"type":"string","enum":["organization","partner","customer","application"]}},"multiple":{"type":"boolean"},"jsonSchema":{"nullable":true}},"required":["group","label","description","contexts"]}}}}}}}},"/api/v1/settings/{group}":{"get":{"summary":"Get settings for a group in a context","tags":["settings"],"parameters":[{"name":"group","in":"path","required":true,"schema":{"type":"string"}},{"name":"contextType","in":"query","required":true,"schema":{"type":"string","enum":["organization","partner","customer","application"]}},{"name":"contextId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer","application"]},"contextId":{"type":"string"},"data":{"nullable":true},"updatedAt":{"type":"string"}},"required":["group","contextType","contextId"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"put":{"summary":"Update settings for a group in a context","tags":["settings"],"parameters":[{"name":"group","in":"path","required":true,"schema":{"type":"string"}},{"name":"contextType","in":"query","required":true,"schema":{"type":"string","enum":["organization","partner","customer","application"]}},{"name":"contextId","in":"query","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"nullable":true}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"group":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer","application"]},"contextId":{"type":"string"},"data":{"nullable":true},"updatedAt":{"type":"string"}},"required":["group","contextType","contextId"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"summary":"Delete (reset) settings for a group in a context","tags":["settings"],"parameters":[{"name":"group","in":"path","required":true,"schema":{"type":"string"}},{"name":"contextType","in":"query","required":true,"schema":{"type":"string","enum":["organization","partner","customer","application"]}},{"name":"contextId","in":"query","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}/usage-events":{"post":{"summary":"Record a one or more usage events","tags":["usageEvents"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"continueOnFailure","in":"query","schema":{"default":false,"type":"boolean","nullable":true}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"_time":{"type":"string","format":"date-time","description":"ISO 8601; Format: 2025-05-21T10:31:04+02:00 (Sweden UTC+2)\tor 2025-05-21T08:31:04Z (UTC)"},"metricId":{"type":"string","description":"Slug ID of the billable metric"},"customerId":{"type":"string","format":"uuid","description":"Customer ID that generated the event"},"applicationId":{"type":"string","description":"Application slug ID that generated the event"},"userId":{"type":"string","description":"User ID that generated the event"},"refId":{"type":"string","description":"Reference ID that generated the event"},"props":{"type":"object","additionalProperties":{"nullable":true},"description":"Custom properties"}},"required":["_time","metricId"]},"description":"Array of usage events"}},"required":["events"]}}}},"responses":{"201":{"description":"Usage event ingest response","content":{"application/json":{"schema":{"type":"object","properties":{"ingested":{"type":"integer","description":"Number of events successfully ingested"},"failed":{"type":"integer","description":"Number of events that failed to ingest"},"failures":{"type":"array","items":{"type":"object","properties":{"error":{"type":"string","description":"Error message describing why the event failed to ingest"},"index":{"type":"integer","description":"Optional: Index or identifier of the failed event"},"event":{"type":"object","additionalProperties":{"nullable":true},"description":"Optional: The actual event data that failed"}},"required":["error"],"description":"Array of failure details for any events that failed to ingest"}},"processedBytes":{"type":"integer","description":"Total bytes processed during the ingestion operation"},"blocksCreated":{"type":"integer","description":"Number of new storage blocks created during ingestion"},"walLength":{"type":"integer","description":"Current length of the Write-Ahead Log (WAL)"},"savedCount":{"type":"integer","description":"Number of events that were successfully saved to Axiom"}},"required":["ingested","failed","failures","processedBytes","blocksCreated","walLength","savedCount"],"description":"Usage event ingest response"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"failedEvents":{"type":"array","items":{"type":"object","properties":{"event":{"nullable":true},"reason":{"type":"string"}},"required":["reason"]}},"totalEvents":{"type":"integer"},"failedCount":{"type":"integer"},"savedCount":{"type":"integer"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/analytics/query":{"post":{"description":"Structured query interface for Analytics Engine","summary":"Execute a query against the Analytics Engine","tags":["analytics"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"dataset":{"type":"string","minLength":1},"query":{"type":"string","minLength":1},"startDate":{"type":"string"},"endDate":{"type":"string"},"f":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"operator":{"type":"string"},"value":{"nullable":true}},"required":["field","operator"]}}},"required":["dataset","query"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"datasetNames":{"type":"array","items":{"type":"string"}},"status":{"type":"object","properties":{"elapsedTime":{"type":"number"},"blocksExamined":{"type":"number"},"rowsExamined":{"type":"number"},"rowsMatched":{"type":"number"},"numGroups":{"type":"number"},"isPartial":{"type":"boolean"},"cacheStatus":{"type":"number"},"minBlockTime":{"type":"string"},"maxBlockTime":{"type":"string"}},"required":["elapsedTime","blocksExamined","rowsExamined","rowsMatched","numGroups","isPartial","cacheStatus","minBlockTime","maxBlockTime"]},"buckets":{"type":"object","properties":{"series":{"type":"array","items":{"type":"object","properties":{"interval":{"type":"string"},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"group":{"type":"object","additionalProperties":{"nullable":true}},"aggregations":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string"},"value":{"type":"number"}},"required":["alias","value"]}}},"required":["id","group","aggregations"]}}},"required":["interval","groups"]}},"totals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"group":{"type":"object","additionalProperties":{"nullable":true}},"aggregations":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string"},"value":{"type":"number"}},"required":["alias","value"]}}},"required":["id","group","aggregations"]}}},"required":["series","totals"]},"fieldsMetaMap":{"type":"object","additionalProperties":{"type":"object","properties":{"type":{"type":"string"},"unit":{"type":"string"},"description":{"type":"string"}},"required":["type"]}},"request":{"type":"object","properties":{"endTime":{"type":"string"},"resolution":{"type":"string"},"startTime":{"type":"string"},"aggregations":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string"},"argument":{"type":"string"},"field":{"type":"string"},"op":{"type":"string"}},"required":["alias","field","op"]}},"filter":{"type":"object","additionalProperties":{"nullable":true}},"groupBy":{"type":"array","items":{"type":"string"}},"limit":{"type":"number"},"order":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"desc":{"type":"boolean"}},"required":["field","desc"]}},"project":{"type":"array","items":{"type":"string"}},"virtualFields":{"type":"array","items":{"type":"object","properties":{"alias":{"type":"string"},"expr":{"type":"string"}},"required":["alias","expr"]}}},"required":["endTime","resolution","startTime"]},"tables":{"type":"array","items":{"type":"object","properties":{"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"agg":{"oneOf":[{"type":"boolean"},{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}]}},"required":["name","type"]}},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"group":{"type":"object","additionalProperties":{"nullable":true}}},"required":["id","group"]}},"name":{"type":"string"},"order":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"desc":{"type":"boolean"}},"required":["field","desc"]}},"sources":{"type":"array","items":{"type":"string"}},"columns":{"type":"array","items":{"type":"array","items":{"nullable":true}}},"range":{"type":"object","properties":{"field":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"}},"required":["field","start","end"]}},"required":["fields","groups","name","order","sources","columns","range"]}}},"required":["datasetNames","status","buckets","fieldsMetaMap","request","tables"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/analytics/schema":{"get":{"description":"Returns column metadata (name, type, ordinal, column type) for the specified datasets","summary":"Get schema for one or more datasets","tags":["analytics"],"parameters":[{"name":"datasets","in":"query","description":"Comma-separated list of dataset names","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"columnName":{"type":"string"},"dataType":{"type":"string"},"columnOrdinal":{"type":"number"},"columnType":{"type":"string"}},"required":["columnName","dataType","columnOrdinal","columnType"]}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/analytics/datasets":{"get":{"description":"Retrieve a list of available datasets with their IDs and names","summary":"List available datasets","tags":["analytics"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/organizations/{organizationId}/customers/{customerId}/overview":{"get":{"summary":"Get customer overview dashboard data","tags":["customerOverview"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"object","properties":{"totalSpend":{"type":"number"},"currency":{"default":"USD","type":"string"},"activeApplications":{"type":"number"},"openSupportTickets":{"type":"number"},"activePricePlans":{"type":"number"},"customerSince":{"type":"string"},"status":{"type":"string","enum":["ONBOARDING","ACTIVE","DORMANT","SUSPENDED","INACTIVE","ARCHIVED"]},"healthScore":{"type":"number","minimum":0,"maximum":100}},"required":["totalSpend","activeApplications","openSupportTickets","activePricePlans","customerSince","status","healthScore"]},"usage":{"type":"object","properties":{"currentMonthUsage":{"type":"number"},"previousMonthUsage":{"type":"number"},"percentageChange":{"type":"number"},"currency":{"default":"USD","type":"string"},"trend":{"type":"string","enum":["up","down","stable"]},"topMetrics":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"usage":{"type":"number"},"limit":{"type":"number"},"percentageUsed":{"type":"number"}},"required":["name","usage","percentageUsed"]}}},"required":["currentMonthUsage","previousMonthUsage","percentageChange","trend","topMetrics"]},"invoices":{"type":"object","properties":{"total":{"type":"number"},"paid":{"type":"number"},"overdue":{"type":"number"},"pending":{"type":"number"},"currency":{"default":"USD","type":"string"},"recentInvoices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"date":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"status":{"type":"string","enum":["Paid","Overdue","Pending"]}},"required":["id","date","amount","currency","status"]}}},"required":["total","paid","overdue","pending","recentInvoices"]},"crm":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"}},"required":["id","name","role","email"]}},"recentInteractions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["Email","Call","Meeting"]},"date":{"type":"string"},"summary":{"type":"string"}},"required":["id","type","date","summary"]}}},"required":["contacts","recentInteractions"]},"support":{"type":"object","properties":{"activeTickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"priority":{"type":"string","enum":["Low","Medium","High","Critical"]},"status":{"type":"string","enum":["Open","In Progress","Waiting"]},"created":{"type":"string"}},"required":["id","title","priority","status","created"]}},"ticketMetrics":{"type":"object","properties":{"avgResponseTime":{"type":"string"},"avgResolutionTime":{"type":"string"},"satisfactionScore":{"type":"number"}},"required":["avgResponseTime","avgResolutionTime","satisfactionScore"]}},"required":["activeTickets","ticketMetrics"]},"pricePlans":{"type":"object","properties":{"active":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pricePlanId":{"type":"string"},"name":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"},"monthlyValue":{"type":"number"},"planType":{"type":"string","enum":["STANDARD","CUSTOMER_OVERRIDE"]}},"required":["id","pricePlanId","name","startDate","monthlyValue"]}}},"required":["active"]},"applications":{"type":"object","properties":{"list":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["Active","Inactive","Pending"]},"usage":{"type":"number"},"lastActive":{"type":"string"}},"required":["id","name","status","usage","lastActive"]}}},"required":["list"]}},"required":["summary","usage","invoices","crm","support","pricePlans","applications"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/permissions":{"get":{"description":"Returns all resources and permissions available to the current user across all contexts","summary":"Get current user permissions for UI control","tags":["authorization"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string","format":"uuid"},"permissions":{"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}}},"required":["contextType","contextId","permissions"]}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts":{"get":{"description":"Returns all contexts (organizations, customers, etc.) that the current user has access to, with their names","summary":"Get current user contexts","tags":["authorization"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"contexts":{"type":"array","items":{"type":"object","properties":{"context":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]},"name":{"type":"string"},"description":{"type":"string"}},"required":["context","name"]}}},"required":["contexts"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/roles":{"get":{"description":"Returns paginated list of roles available in the specified context","summary":"Get all roles for a context","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":100}},{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"permissions":{"default":[],"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}},"isSystemRole":{"type":"boolean"},"parentRoleId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","contextType","isSystemRole","createdAt","updatedAt"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["roles","total","page","pageSize","totalPages"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"post":{"description":"Creates a new custom role with specified permissions in the context","summary":"Create a custom role","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"permissions":{"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}},"parentRoleId":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"permissions":{"default":[],"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}},"isSystemRole":{"type":"boolean"},"parentRoleId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","contextType","isSystemRole","createdAt","updatedAt"]},"message":{"type":"string"}},"required":["role"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/subjects":{"get":{"description":"Returns paginated list of users and API keys with their assigned roles in the specified context","summary":"Get all subjects with roles in a context","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":100}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"subjectType","in":"query","schema":{"type":"string","enum":["user","api_key"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"subjects":{"type":"array","items":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"status":{"type":"string"},"disabledAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"assignedAt":{"type":"string","format":"date-time"},"assignedBy":{"type":"string"}},"required":["subjectType","subjectId","roles","assignedAt","assignedBy"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["subjects","total","page","pageSize","totalPages"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/roles/assign":{"post":{"description":"Assigns a predefined role to a user or API key in the specified context","summary":"Assign a role to a subject","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleIds":{"type":"array","items":{"type":"string"}}},"required":["subjectType","subjectId","roleIds"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"assignment":{"type":"object","properties":{"id":{"type":"string"},"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"assignedBy":{"type":"string"},"assignedByType":{"oneOf":[{"type":"string","enum":["user","api_key"]},{"type":"string","enum":["system"]}]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","subjectType","subjectId","roleId","contextType","contextId","assignedBy","assignedByType","createdAt","updatedAt"]}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/users/add":{"post":{"description":"Adds users from Clerk by email and assigns specified roles to them in the context","summary":"Add users and assign roles","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string","format":"email"}},"roleIds":{"type":"array","items":{"type":"string"}}},"required":["emails","roleIds"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"success":{"type":"boolean"},"error":{"type":"string"},"subjectId":{"type":"string"},"roleAssignments":{"type":"array","items":{"type":"object","properties":{"roleId":{"type":"string"},"success":{"type":"boolean"},"error":{"type":"string"}},"required":["roleId","success"]}}},"required":["email","success"]}}},"required":["success","message","results"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/roles/revoke":{"post":{"description":"Revokes a role assignment from a user or API key in the specified context","summary":"Revoke a role from a subject","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleIds":{"type":"array","items":{"type":"string"}}},"required":["subjectType","subjectId","roleIds"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/roles/bulk-assign":{"post":{"description":"Assigns roles to multiple users or API keys in a single operation","summary":"Bulk assign roles to multiple subjects","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"assignments":{"type":"array","items":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string","format":"uuid"}},"required":["subjectType","subjectId","roleId"]}}},"required":["assignments"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string"},"success":{"type":"boolean"},"error":{"type":"string"},"assignment":{"type":"object","properties":{"id":{"type":"string"},"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"assignedBy":{"type":"string"},"assignedByType":{"oneOf":[{"type":"string","enum":["user","api_key"]},{"type":"string","enum":["system"]}]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","subjectType","subjectId","roleId","contextType","contextId","assignedBy","assignedByType","createdAt","updatedAt"]}},"required":["subjectType","subjectId","roleId","success"]}}},"required":["success","message","results"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/roles/{roleId}":{"patch":{"description":"Updates an existing role's name, description, or permissions","summary":"Update a role","tags":["authorization"],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"permissions":{"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}},"parentRoleId":{"type":"string"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"permissions":{"default":[],"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"nullable":true}},"isRegex":{"type":"boolean"}},"required":["resourceId"]}},"isSystemRole":{"type":"boolean"},"parentRoleId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","contextType","isSystemRole","createdAt","updatedAt"]},"message":{"type":"string"}},"required":["role"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"description":"Deletes a custom role (system roles cannot be deleted)","summary":"Delete a role","tags":["authorization"],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/permissions/check":{"post":{"description":"Checks if a specific subject has permission to perform an action on a resource in a context","summary":"Check if a subject has permission for an action","tags":["authorization"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"resourceId":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"}},"required":["resourceId","contextType","contextId"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"type":"boolean"}},"required":["allowed"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/audit":{"get":{"description":"Returns paginated audit log of all permission-related changes","summary":"Get audit log for permission changes","tags":["authorization"],"parameters":[{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":100}},{"name":"ctx","in":"query","style":"deepObject","schema":{"type":"object","properties":{"type":{"type":"string","enum":["organization","partner","customer"]},"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"}},"required":["type","id"]}},{"name":"subjectType","in":"query","schema":{"type":"string","enum":["user","api_key"]}},{"name":"subjectId","in":"query","schema":{"type":"string"}},{"name":"action","in":"query","schema":{"type":"string","enum":["assigned","revoked","role_created","role_deleted","permission_granted","permission_revoked"]}},{"name":"performedBy","in":"query","schema":{"type":"string"}},{"name":"startDate","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"endDate","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string","enum":["assigned","revoked","role_created","role_deleted","permission_granted","permission_revoked"]},"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"performedBy":{"type":"string"},"performedByType":{"oneOf":[{"type":"string","enum":["user","api_key"]},{"type":"string","enum":["system"]}]},"details":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","action","performedBy","performedByType","createdAt"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["entries","total","page","pageSize","totalPages"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/resources":{"get":{"description":"Returns paginated list of all resources stored in the authorization system","summary":"Get all stored resources","tags":["authorization"],"parameters":[{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":100,"type":"number","minimum":1,"maximum":1000}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"resources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"parameters":{"type":"array","items":{"type":"string"}},"group":{"type":"string"}},"required":["id","method","path","contextType"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["resources","total","page","pageSize","totalPages"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/{subjectType}/{subjectId}/assignments":{"get":{"description":"Returns all role assignments for a specific user or API key","summary":"Get all role assignments for a subject","tags":["authorization"],"parameters":[{"name":"subjectType","in":"path","required":true,"schema":{"type":"string","enum":["user","api_key"]}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"query","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"assignments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"subjectType":{"type":"string","enum":["user","api_key"]},"subjectId":{"type":"string"},"roleId":{"type":"string"},"contextType":{"type":"string","enum":["organization","partner","customer"]},"contextId":{"type":"string"},"assignedBy":{"type":"string"},"assignedByType":{"oneOf":[{"type":"string","enum":["user","api_key"]},{"type":"string","enum":["system"]}]},"expiresAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","subjectType","subjectId","roleId","contextType","contextId","assignedBy","assignedByType","createdAt","updatedAt"]}},"subject":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]}},"required":["assignments","subject"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/{id}":{"get":{"description":"Returns subject metadata by internal subject ID","summary":"Get subject by ID","tags":["authorization"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]}},"required":["subject"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"patch":{"description":"Updates subject metadata fields","summary":"Update subject metadata","tags":["authorization"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"externalUserId":{"type":"string","minLength":1},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"primaryEmail":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]},"message":{"type":"string"}},"required":["subject","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"description":"Deletes a subject record (only if no assignments exist)","summary":"Delete a subject","tags":["authorization"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/external/{externalUserId}":{"get":{"description":"Returns subject metadata by Clerk user ID","summary":"Get subject by external user ID","tags":["authorization"],"parameters":[{"name":"externalUserId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]}},"required":["subject"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/search":{"get":{"description":"Search subjects by name, email, or external user ID","summary":"Search subjects","tags":["authorization"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":100}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"subjects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["subjects","total","page","pageSize","totalPages"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/sync/clerk-user":{"post":{"description":"Sync user data from Clerk to the subjects table","summary":"Sync a single Clerk user","tags":["authorization"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"clerkUserId":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"primaryEmail":{"type":"string"}},"required":["clerkUserId"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"subject":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"default":"user","type":"string","enum":["user","api_key"]},"externalUserId":{"type":"string","minLength":1,"description":"Clerk user ID - null for invited users","nullable":true},"firstName":{"type":"string","minLength":1,"nullable":true},"lastName":{"type":"string","minLength":1,"nullable":true},"primaryEmail":{"type":"string","format":"email","description":"Required for invitations"},"status":{"default":"active","type":"string","enum":["invited","active","disabled","revoked","expired"]},"clerkInvitationId":{"type":"string","nullable":true,"description":"Clerk invitation ID for tracking"},"invitedBy":{"type":"string","nullable":true,"description":"Subject ID of the inviter"},"invitedAt":{"type":"string","format":"date-time","nullable":true,"description":"When invitation was sent"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Invitation expiration"},"disabledAt":{"type":"string","format":"date-time","nullable":true,"description":"When user was disabled"},"disabledBy":{"type":"string","nullable":true,"description":"Subject ID of admin who disabled"},"notes":{"type":"string","nullable":true,"description":"Notes such as disable reason"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalUserId","firstName","lastName","primaryEmail","createdAt","updatedAt"]},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/subjects/sync/all-clerk-users":{"post":{"description":"Trigger a full sync of all users from Clerk (placeholder implementation)","summary":"Sync all Clerk users","tags":["authorization"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"stats":{"type":"object","properties":{"totalSubjects":{"type":"number"},"subjectsWithEmail":{"type":"number"},"subjectsWithNames":{"type":"number"}},"required":["totalSubjects","subjectsWithEmail","subjectsWithNames"]}},"required":["success","message","stats"]}}}}}}},"/api/v1/authz/subjects/sync/stats":{"get":{"description":"Get statistics about subject data synchronization","summary":"Get sync statistics","tags":["authorization"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"totalSubjects":{"type":"number"},"subjectsWithEmail":{"type":"number"},"subjectsWithNames":{"type":"number"},"lastSyncDate":{"type":"string"}},"required":["totalSubjects","subjectsWithEmail","subjectsWithNames"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/invitations":{"get":{"description":"Returns paginated list of pending user invitations for the specified context","summary":"List pending invitations","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"default":1,"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"default":50,"type":"number","minimum":1,"maximum":100}},{"name":"status","in":"query","schema":{"default":"pending","type":"string","enum":["pending","expired","all"]}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"status":{"type":"string"},"roles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"invitedBySubjectId":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"expiresAt":{"type":"string","nullable":true}},"required":["id","email","status","roles"]}},"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["invitations","total","page","pageSize","totalPages"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/invitations/{subjectId}/resend":{"post":{"description":"Resends an invitation email to a user with a pending invitation","summary":"Resend invitation","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"newExpiresAt":{"type":"string","format":"date-time"}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/invitations/{subjectId}":{"delete":{"description":"Revokes a pending invitation and removes the subject from the context","summary":"Revoke invitation","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/users/{subjectId}/disable":{"post":{"description":"Disables a user, preventing them from logging in","summary":"Disable user","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"disabledAt":{"type":"string","format":"date-time"}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/authz/contexts/{type}/{id}/users/{subjectId}/enable":{"post":{"description":"Re-enables a previously disabled user, allowing them to log in again","summary":"Enable user","tags":["authorization"],"parameters":[{"name":"type","in":"path","required":true,"schema":{"type":"string","enum":["organization","partner","customer"]}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"subjectId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/auth":{"post":{"description":"Creates an authorization hold on a card for a specified amount without capturing the funds.\n\n## Test Cards\n\n### Approved (no 3DS)\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4242424242424242 | approved | 0 |\n| 4111111111111111 | approved | 0 |\n| 5555555555554444 | approved | 0 |\n| 378282246310005 | approved | 0 |\n\n### Approved (3DS challenge)\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4000000000003220 | approved | 0 |\n| 4000002500003155 | approved | 0 |\n| 5200828282828210 | approved | 0 |\n\n### Declined\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4000000000000002 | do_not_honor | 5 |\n| 4000000000009995 | insufficient_funds | 51 |\n| 4000000000000069 | expired_card | 54 |\n| 4000000000000127 | invalid_cvv | 79 |\n| 4000000000000119 | psp_malfunction | 96 |\n| 4100000000000019 | suspected_fraud | 59 |\n| 4000000000000259 | issuer_err | 91 |\n| 4000000000000341 | 3ds_auth_failure | 103 |\n| 4000000000000051 | psp_timeout | 105 |","summary":"Authorize a card","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":0,"maximum":1000000000,"exclusiveMinimum":0,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"device":{"type":"object","properties":{"ip":{"type":"string"},"userAgent":{"type":"string"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet","unknown"]}},"required":["ip"],"description":"Enduser device details"},"user":{"type":"object","properties":{"userId":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","minLength":1,"maxLength":100},"middleName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":500,"description":"Email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","description":"Phone number in E.164 format"},"dateOfBirth":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"},"shippingAddress":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"}},"required":["firstName","lastName"],"description":"User details for the payment"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"successUrl":{"type":"string","format":"uri"},"failureUrl":{"type":"string","format":"uri"},"callbackUrl":{"type":"string","format":"uri"},"card":{"type":"object","properties":{"cardNumber":{"description":"Credit or debit card number","type":"string"},"expiryMonth":{"type":"integer","minimum":1,"maximum":12,"description":"Card expiry month (1-12)"},"expiryYear":{"type":"integer","minimum":1970,"maximum":2100,"description":"Card expiry year (4 digits)"},"cvv":{"description":"Card verification value (CVV/CVC)","type":"string"},"cardHolderName":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$","description":"Name of the cardholder as it appears on the card"},"cardBrand":{"type":"string","enum":["VISA","MASTERCARD","AMEX","DINERS","DISCOVER","JCB","UNIONPAY","MAESTRO","ELO","MIR","HIPERCARD","HIPER","DANKORT","RUPAY","ELECTRON","UNKNOWN"]},"iin":{"oneOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"string","minLength":8,"maxLength":8}]},"save":{"type":"boolean"}},"required":["cardNumber","expiryMonth","expiryYear","cvv"],"description":"Credit or debit card details"}},"required":["appId","amount","device","txRefId","card"],"description":"Request schema for debiting a card. Note: when routing to the PSP simulator (non-production environments only), card outcomes are driven by the card PAN and/or amount last-2-digits as documented below.","example":{"appId":"towl-test-app","txRefId":"TOWL-42-DENT-DONT-PANIC-001","amount":{"amt":24.42,"cy":"USD"},"device":{"ip":"42.42.42.42"},"card":{"cardNumber":"4242424242424242","expiryMonth":1,"expiryYear":2029,"cvv":"123","cardHolderName":"Authur Dent"},"user":{"userId":"DontPanic42","firstName":"Arthur","middleName":"Urban","lastName":"Dent","email":"arthur.urban@babelfish.io","phone":"+46701234567","address":{"line1":"Handduksvägen 42, lgh 1101","city":"Stockholm","state":"Stockholm","postalCode":"11122","countryCode":"SWE"}},"successUrl":"https://your-domain.com/success?id=${id}&statusCode=${statusCode}","failureUrl":"https://your-domain.com/failed?id=${id}&statusCode=${statusCode}","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/debit":{"post":{"description":"Creates an authorization hold on a card for a specified amount without capturing the funds.\n\n## Test Cards\n\n### Approved (no 3DS)\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4242424242424242 | approved | 0 |\n| 4111111111111111 | approved | 0 |\n| 5555555555554444 | approved | 0 |\n| 378282246310005 | approved | 0 |\n\n### Approved (3DS challenge)\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4000000000003220 | approved | 0 |\n| 4000002500003155 | approved | 0 |\n| 5200828282828210 | approved | 0 |\n\n### Declined\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4000000000000002 | do_not_honor | 5 |\n| 4000000000009995 | insufficient_funds | 51 |\n| 4000000000000069 | expired_card | 54 |\n| 4000000000000127 | invalid_cvv | 79 |\n| 4000000000000119 | psp_malfunction | 96 |\n| 4100000000000019 | suspected_fraud | 59 |\n| 4000000000000259 | issuer_err | 91 |\n| 4000000000000341 | 3ds_auth_failure | 103 |\n| 4000000000000051 | psp_timeout | 105 |","summary":"Debit a card","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":0,"maximum":1000000000,"exclusiveMinimum":0,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"device":{"type":"object","properties":{"ip":{"type":"string"},"userAgent":{"type":"string"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet","unknown"]}},"required":["ip"],"description":"Enduser device details"},"user":{"type":"object","properties":{"userId":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","minLength":1,"maxLength":100},"middleName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":500,"description":"Email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","description":"Phone number in E.164 format"},"dateOfBirth":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"},"shippingAddress":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"}},"required":["firstName","lastName"],"description":"User details for the payment"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"successUrl":{"type":"string","format":"uri"},"failureUrl":{"type":"string","format":"uri"},"callbackUrl":{"type":"string","format":"uri"},"card":{"type":"object","properties":{"cardNumber":{"description":"Credit or debit card number","type":"string"},"expiryMonth":{"type":"integer","minimum":1,"maximum":12,"description":"Card expiry month (1-12)"},"expiryYear":{"type":"integer","minimum":1970,"maximum":2100,"description":"Card expiry year (4 digits)"},"cvv":{"description":"Card verification value (CVV/CVC)","type":"string"},"cardHolderName":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$","description":"Name of the cardholder as it appears on the card"},"cardBrand":{"type":"string","enum":["VISA","MASTERCARD","AMEX","DINERS","DISCOVER","JCB","UNIONPAY","MAESTRO","ELO","MIR","HIPERCARD","HIPER","DANKORT","RUPAY","ELECTRON","UNKNOWN"]},"iin":{"oneOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"string","minLength":8,"maxLength":8}]},"save":{"type":"boolean"}},"required":["cardNumber","expiryMonth","expiryYear","cvv"],"description":"Credit or debit card details"}},"required":["appId","amount","device","txRefId","card"],"description":"Request schema for debiting a card. Note: when routing to the PSP simulator (non-production environments only), card outcomes are driven by the card PAN and/or amount last-2-digits as documented below.","example":{"appId":"towl-test-app","txRefId":"TOWL-42-DENT-DONT-PANIC-001","amount":{"amt":24.42,"cy":"USD"},"device":{"ip":"42.42.42.42"},"card":{"cardNumber":"4242424242424242","expiryMonth":1,"expiryYear":2029,"cvv":"123","cardHolderName":"Authur Dent"},"user":{"userId":"DontPanic42","firstName":"Arthur","middleName":"Urban","lastName":"Dent","email":"arthur.urban@babelfish.io","phone":"+46701234567","address":{"line1":"Handduksvägen 42, lgh 1101","city":"Stockholm","state":"Stockholm","postalCode":"11122","countryCode":"SWE"}},"successUrl":"https://your-domain.com/success?id=${id}&statusCode=${statusCode}","failureUrl":"https://your-domain.com/failed?id=${id}&statusCode=${statusCode}","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/credit":{"post":{"description":"Push funds directly to a card (Original Credit Transaction / payout). Card details are supplied by the caller — no prior transaction reference is required. 3DS authentication does not apply to outbound credit flows.\n\n## Test Cards\n\n### Approved\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4242424242424242 | approved | 0 |\n| 4111111111111111 | approved | 0 |\n| 5555555555554444 | approved | 0 |\n| 378282246310005 | approved | 0 |\n\n### Declined\n| PAN | statusCode | responseCode |\n|-----|------------|--------------|\n| 4000000000000002 | do_not_honor | 5 |\n| 4000000000009995 | insufficient_funds | 51 |\n| 4000000000000069 | expired_card | 54 |\n| 4000000000000127 | invalid_cvv | 79 |\n| 4000000000000119 | psp_malfunction | 96 |\n| 4100000000000019 | suspected_fraud | 59 |\n| 4000000000000259 | issuer_err | 91 |\n| 4000000000000051 | psp_timeout | 105 |","summary":"Credit a card (OCT / payout)","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":0,"maximum":1000000000,"exclusiveMinimum":0,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"device":{"type":"object","properties":{"ip":{"type":"string"},"userAgent":{"type":"string"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet","unknown"]}},"required":["ip"],"description":"Enduser device details"},"user":{"type":"object","properties":{"userId":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","minLength":1,"maxLength":100},"middleName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":500,"description":"Email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","description":"Phone number in E.164 format"},"dateOfBirth":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"},"shippingAddress":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"}},"required":["firstName","lastName"],"description":"User details for the payment"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"successUrl":{"type":"string","format":"uri"},"failureUrl":{"type":"string","format":"uri"},"callbackUrl":{"type":"string","format":"uri"},"card":{"type":"object","properties":{"cardNumber":{"description":"Credit or debit card number","type":"string"},"expiryMonth":{"type":"integer","minimum":1,"maximum":12,"description":"Card expiry month (1-12)"},"expiryYear":{"type":"integer","minimum":1970,"maximum":2100,"description":"Card expiry year (4 digits)"},"cvv":{"description":"Card verification value (CVV/CVC)","type":"string"},"cardHolderName":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$","description":"Name of the cardholder as it appears on the card"},"cardBrand":{"type":"string","enum":["VISA","MASTERCARD","AMEX","DINERS","DISCOVER","JCB","UNIONPAY","MAESTRO","ELO","MIR","HIPERCARD","HIPER","DANKORT","RUPAY","ELECTRON","UNKNOWN"]},"iin":{"oneOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"string","minLength":8,"maxLength":8}]},"save":{"type":"boolean"}},"required":["cardNumber","expiryMonth","expiryYear"],"description":"Credit or debit card details"}},"required":["appId","amount","device","txRefId","card"],"description":"Request schema for crediting (paying out to) a card. No 3DS is required for OCT/payout flows.","example":{"appId":"towl-test-app","txRefId":"TOWL-42-DENT-PAYOUT-001","amount":{"amt":24.42,"cy":"USD"},"device":{"ip":"42.42.42.42"},"card":{"cardNumber":"4242424242424242","expiryMonth":1,"expiryYear":2029,"cvv":"123","cardHolderName":"Authur Dent"},"user":{"userId":"DontPanic42","firstName":"Arthur","middleName":"Urban","lastName":"Dent","email":"arthur.urban@babelfish.io","phone":"+46701234567","address":{"line1":"Handduksvägen 42, lgh 1101","city":"Stockholm","state":"Stockholm","postalCode":"11122","countryCode":"SWE"}},"callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/refund":{"post":{"description":"Refunds a previously captured charge.","summary":"Refund a charge","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"callbackUrl":{"type":"string","format":"uri","description":"URL to receive webhook callback with transaction result"}},"required":["id"],"example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/void":{"post":{"description":"Cancels an authorization hold without capturing.","summary":"Void an authorization","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"callbackUrl":{"type":"string","format":"uri","description":"URL to receive webhook callback with transaction result"}},"required":["id"],"example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/capture":{"post":{"description":"Captures funds from a previously authorized charge.","summary":"Capture an authorization","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"callbackUrl":{"type":"string","format":"uri","description":"URL to receive webhook callback with transaction result"}},"required":["id"],"example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/card/cancel":{"post":{"description":"Cancels a payment transaction.","summary":"Cancel a transaction","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"callbackUrl":{"type":"string","format":"uri","description":"URL to receive webhook callback with transaction result"}},"required":["id"],"example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","callbackUrl":"https://your-server.com/webhooks/payment-callback"}}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/status/{id}":{"get":{"description":"Get the status of a payment transaction by its ID.","summary":"Get payment status","tags":["payments"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"USD"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/payment/checkout-tokens":{"post":{"description":"Creates a checkout API client token for use with checkout API.","summary":"Create checkout API client token","tags":["payments"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"appId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$","description":"Application slug ID"},"expiresIn":{"default":300,"type":"integer","minimum":60,"maximum":3600,"description":"Token expiry in seconds (default 5 minutes)"},"allowedOrigins":{"type":"array","items":{"type":"string"},"maxItems":10,"description":"List of allowed origins for CORS and Origin header enforcement. The browser SDK must send requests from one of these origins."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Optional metadata"},"user":{"type":"object","properties":{"userId":{"type":"string","minLength":1,"maxLength":100},"firstName":{"type":"string","minLength":1,"maxLength":100},"middleName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":500,"description":"Email"},"phone":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$","description":"Phone number in E.164 format"},"dateOfBirth":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"address":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"},"shippingAddress":{"type":"object","properties":{"line1":{"type":"string","maxLength":200},"line2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20},"countryCode":{"type":"string","enum":["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BIH","BWA","BRA","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CAF","TCD","CHL","CHN","COL","COM","COG","COD","CRI","CIV","HRV","CUB","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FJI","FIN","FRA","GAB","GMB","GEO","DEU","GHA","GRC","GRD","GTM","GIN","GNB","GUY","HTI","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","ISR","ITA","JAM","JPN","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MRT","MUS","MEX","FSM","MDA","MCO","MNG","MNE","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NZL","NIC","NER","NGA","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","POL","PRT","QAT","ROU","RUS","RWA","KNA","LCA","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SVK","SVN","SLB","SOM","ZAF","SSD","ESP","LKA","SDN","SUR","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TON","TTO","TUN","TUR","TKM","TUV","UGA","UKR","ARE","GBR","USA","URY","UZB","VUT","VAT","VEN","VNM","YEM","ZMB","ZWE","ZZZ"]}},"required":["line1","city","postalCode","countryCode"],"description":"Address"}},"required":["firstName","lastName"],"description":"User details for the payment"},"successUrl":{"type":"string","format":"uri"},"failureUrl":{"type":"string","format":"uri"},"callbackUrl":{"type":"string","format":"uri"},"checkoutUrl":{"type":"boolean","description":"If true, the response includes a fully-qualified checkout URL that can be used to redirect or embed the hosted checkout."},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":0,"maximum":1000000000,"exclusiveMinimum":0,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Payment amount. When set, the amount is locked into the session and cannot be changed on the client side."},"embedMode":{"type":"string","enum":["redirect","iframe"],"description":"Embedding mode for the hosted checkout. Included in the checkout URL when checkoutUrl is true."},"parentOrigin":{"type":"string","description":"Origin of the merchant page embedding the checkout (iframe). Included in the checkout URL when checkoutUrl is true."}},"required":["appId","allowedOrigins","user"],"description":"Request schema for creating a checkout token","example":{"appId":"towl-test-app","expiresIn":300,"allowedOrigins":["https://your-domain.com"],"user":{"userId":"DontPanic42","firstName":"Arthur","middleName":"Urban","lastName":"Dent","email":"arthur.urban@babelfish.io","phone":"+46701234567","address":{"line1":"Handduksvägen 42, lgh 1101","city":"Stockholm","state":"Stockholm","postalCode":"11122","countryCode":"SWE"}},"successUrl":"https://your-domain.com/success?id=${id}&statusCode=${statusCode}","failureUrl":"https://your-domain.com/failed?id=${id}&statusCode=${statusCode}","callbackUrl":"https://your-server.com/webhooks/payment-callback","checkoutUrl":true,"amount":{"amt":100,"cy":"EUR"},"embedMode":"iframe","parentOrigin":"https://your-domain.com"}}}}},"responses":{"200":{"description":"Response schema for checkout token creation","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Checkout token"},"expiresAt":{"type":"string","description":"Token expiry timestamp in ISO format"},"allowedOrigins":{"type":"array","items":{"type":"string"},"description":"Allowed origins bound to this session token"},"url":{"type":"string","format":"uri","description":"Fully-qualified hosted checkout URL. Only present when the request set checkoutUrl=true."}},"required":["token","expiresAt","allowedOrigins"],"description":"Response schema for checkout token creation"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/transactions":{"get":{"description":"Search and retrieve transactions with pagination and filtering.","summary":"Search transactions","tags":["transactions"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"customerId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"sort","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"page","in":"query","schema":{"default":1,"type":"number","minimum":1}},{"name":"limit","in":"query","schema":{"default":100,"type":"number","minimum":1}},{"name":"dateRange","in":"query","style":"deepObject","schema":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}}},{"name":"refresh","in":"query","schema":{"type":"boolean","nullable":true}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"customerName":{"type":"string"},"applicationId":{"type":"string","format":"uuid"},"appSlugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"txRefId":{"type":"string","maxLength":255},"originTxId":{"type":"string","format":"uuid"},"paymentType":{"type":"string","enum":["card","bank","ewallet","crypto","invoice","other"]},"transactionType":{"type":"string","enum":["debit","credit","refund","auth","capture","void","cancel","3ds"]},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"extStatusCode":{"type":"string"},"statusMessage":{"type":"string"},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"user":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"maskedAccount":{"type":"string"},"countryCode":{"type":"string"},"customerRefId":{"type":"string"}},"description":"User information"},"provider":{"type":"string","enum":["citigate","cc7995","circoflow","blueemi","worldpay","zimpler","paypal","simulator"]},"providerAccount":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"providerTxId":{"type":"string"},"providerUserId":{"type":"string"},"card":{"type":"object","properties":{"cardNumber":{"type":"string"},"cvv":{"type":"string"},"expiryMonth":{"type":"integer"},"expiryYear":{"type":"integer"},"cardHolderName":{"type":"string"}},"required":["cardNumber"]},"callbackUrl":{"type":"string","format":"uri"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet","unknown"]},"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["organizationId","customerId","id","createdAt","updatedAt"],"description":"Transaction data"}},"meta":{"type":"object","properties":{"total":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"totalPages":{"type":"number"}},"required":["total","page","pageSize","totalPages"]}},"required":["data","meta"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/transactions/{id}":{"get":{"description":"Retrieve a single transaction by its ID.","summary":"Get transaction by ID","tags":["transactions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Transaction data","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"customerName":{"type":"string"},"applicationId":{"type":"string","format":"uuid"},"appSlugId":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"txRefId":{"type":"string","maxLength":255},"originTxId":{"type":"string","format":"uuid"},"paymentType":{"type":"string","enum":["card","bank","ewallet","crypto","invoice","other"]},"transactionType":{"type":"string","enum":["debit","credit","refund","auth","capture","void","cancel","3ds"]},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"extStatusCode":{"type":"string"},"statusMessage":{"type":"string"},"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"user":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string"},"maskedAccount":{"type":"string"},"countryCode":{"type":"string"},"customerRefId":{"type":"string"}},"description":"User information"},"provider":{"type":"string","enum":["citigate","cc7995","circoflow","blueemi","worldpay","zimpler","paypal","simulator"]},"providerAccount":{"type":"string","minLength":3,"maxLength":256,"pattern":"^[a-z0-9-]+$"},"providerTxId":{"type":"string"},"providerUserId":{"type":"string"},"card":{"type":"object","properties":{"cardNumber":{"type":"string"},"cvv":{"type":"string"},"expiryMonth":{"type":"integer"},"expiryYear":{"type":"integer"},"cardHolderName":{"type":"string"}},"required":["cardNumber"]},"callbackUrl":{"type":"string","format":"uri"},"deviceType":{"type":"string","enum":["desktop","mobile","tablet","unknown"]},"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["organizationId","customerId","id","createdAt","updatedAt"],"description":"Transaction data"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/transactions/{id}/workflow-steps":{"get":{"description":"Retrieve workflow step events for a specific transaction.","summary":"Get workflow steps for a transaction","tags":["transactions"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"workflowId":{"type":"string"},"workflowName":{"type":"string"},"stepName":{"type":"string"},"status":{"type":"string"},"data":{"nullable":true},"error":{"type":"string"},"completedAt":{"type":"string"},"durationMs":{"type":"number"},"order":{"type":"number"}},"required":["timestamp","workflowId","workflowName","stepName","status"],"additionalProperties":true,"description":"Workflow step event"}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/transactions/export/csv":{"get":{"description":"Stream a CSV export of transactions matching the given filters.","summary":"Export transactions as CSV","tags":["transactions"],"parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"customerId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"dateRange","in":"query","style":"deepObject","schema":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"nullable":true}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/api-adaptor-definitions":{"get":{"description":"List all available API Adaptor definitions that can be configured.","summary":"List API Adaptor Definitions","tags":["apiAdaptors"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"definitions":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"slugId":{"type":"string"},"providerApiUrl":{"type":"string","format":"uri"},"subdomain":{"type":"string"},"uiMetadata":{"type":"object","properties":{"icon":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"providerKeyLabel":{"type":"string"}}}},"required":["name","slugId","providerApiUrl","subdomain"]}},"apiAdaptorDomain":{"type":"string"}},"required":["definitions","apiAdaptorDomain"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers/{customerId}/api-adaptors":{"get":{"description":"List all API Adaptors for a customer.","summary":"List API Adaptors","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"post":{"description":"Create a new API Adaptor for a customer.","summary":"Create API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]}},"required":["name","definitionSlugId","providerApiKey","applicationId","trafficPercentage"]}}}},"responses":{"201":{"description":"201","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers/{customerId}/api-adaptors/{adaptorId}":{"get":{"description":"Get a single API Adaptor by ID.","summary":"Get API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"adaptorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"patch":{"description":"Update an existing API Adaptor.","summary":"Update API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"adaptorId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}},"delete":{"description":"Delete an API Adaptor.","summary":"Delete API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"adaptorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers/{customerId}/api-adaptors/{adaptorId}/enable":{"post":{"description":"Enable an API Adaptor.","summary":"Enable API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"adaptorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/customers/{customerId}/api-adaptors/{adaptorId}/disable":{"post":{"description":"Disable an API Adaptor.","summary":"Disable API Adaptor","tags":["apiAdaptors"],"parameters":[{"name":"customerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"adaptorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"adaptorId":{"type":"string","format":"uuid"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1},"definitionSlugId":{"type":"string","minLength":1},"providerApiKey":{"type":"string","minLength":1},"applicationId":{"type":"string","minLength":1},"babelpayApiKey":{"type":"string","minLength":1},"babelpayApiUrl":{"type":"string","format":"uri"},"trafficPercentage":{"type":"integer","minimum":0,"maximum":100},"routePatterns":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"disabledFallback":{"type":"string","enum":["decline","proxy"]},"fallbackOnBabelpayFailure":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnBabelpayDecline":{"type":"string","enum":["none","proxy","babelpay"]},"fallbackOnProxyFailure":{"type":"string","enum":["none","proxy","babelpay"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["adaptorId","ownerId","name","definitionSlugId","providerApiKey","applicationId","babelpayApiKey","babelpayApiUrl","trafficPercentage","enabled","createdAt","updatedAt"]}},"required":["data"]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/checkout/options":{"get":{"description":"Returns a list of available payment options with their required fields.","summary":"List available payment options","tags":["checkout"],"parameters":[],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["card-debit-new","card-debit-token","card-credit-token","open-banking-debit"],"description":"Payment option type identifier"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Field name"},"type":{"type":"string","enum":["string","number","boolean"],"description":"Field type"},"required":{"type":"boolean","description":"Whether the field is required"},"label":{"type":"string","description":"Display label for the field"},"placeholder":{"type":"string","description":"Placeholder text"},"regex":{"type":"string","description":"Validation regex pattern"}},"required":["name","type","required","label"],"description":"Schema for a payment option field"},"description":"Fields required for this payment option"},"icon":{"type":"string","description":"Icon URL or name"}},"required":["type","fields"],"description":"Schema for a payment option","example":{"type":"card-debit-new","fields":[{"name":"encCardNumber","type":"string","required":true,"label":"Encrypted card number"},{"name":"encCvv","type":"string","required":true,"label":"Encrypted CVV"},{"name":"expiryMonth","type":"number","required":true,"label":"Card expiry month (1-12)","regex":"^(1[0-2]|[1-9])$"},{"name":"expiryYear","type":"number","required":true,"label":"Card expiry year (4 digits)","regex":"^(202[6-9]|20[3-9]\\d|2100)$"},{"name":"cardholderName","type":"string","required":false,"label":"Name of the cardholder as it appears on the card","regex":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$"}]}},"example":[{"type":"card-debit-new","fields":[{"name":"encCardNumber","type":"string","required":true,"label":"Encrypted card number"},{"name":"encCvv","type":"string","required":true,"label":"Encrypted CVV"},{"name":"expiryMonth","type":"number","required":true,"label":"Card expiry month (1-12)","regex":"^(1[0-2]|[1-9])$"},{"name":"expiryYear","type":"number","required":true,"label":"Card expiry year (4 digits)","regex":"^(202[6-9]|20[3-9]\\d|2100)$"},{"name":"cardholderName","type":"string","required":false,"label":"Name of the cardholder as it appears on the card","regex":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$"}]},{"type":"card-debit-token","fields":[{"name":"tokenId","type":"string","required":true,"label":"Encrypted card number"},{"name":"encCvv","type":"string","required":true,"label":"Encrypted CVV"},{"name":"expiryMonth","type":"number","required":false,"label":"Card expiry month (1-12)","regex":"^(1[0-2]|[1-9])$"},{"name":"expiryYear","type":"number","required":false,"label":"Card expiry year (4 digits)","regex":"^(202[6-9]|20[3-9]\\d|2100)$"}]},{"type":"card-credit-token","fields":[{"name":"encCardNumber","type":"string","required":true,"label":"Encrypted card number"},{"name":"encCvv","type":"string","required":true,"label":"Encrypted CVV"},{"name":"expiryMonth","type":"number","required":false,"label":"Card expiry month (1-12)","regex":"^(1[0-2]|[1-9])$"},{"name":"expiryYear","type":"number","required":false,"label":"Card expiry year (4 digits)","regex":"^(202[6-9]|20[3-9]\\d|2100)$"}]},{"type":"open-banking-debit","fields":[]}]}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/checkout/debit":{"post":{"description":"Processes a debit payment using the checkout API.","summary":"Process debit payment","tags":["checkout"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"discriminator":{"propertyName":"paymentType"},"oneOf":[{"type":"object","properties":{"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Amount to process"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"paymentType":{"type":"string","enum":["card-debit-new"]},"encCardNumber":{"type":"string","minLength":1,"maxLength":256,"description":"Encrypted card number"},"encCvv":{"type":"string","minLength":1,"maxLength":256,"description":"Encrypted CVV"},"expiryMonth":{"type":"integer","minimum":1,"maximum":12,"description":"Card expiry month (1-12)"},"expiryYear":{"type":"integer","minimum":1970,"maximum":2100,"description":"Card expiry year (4 digits)"},"cardholderName":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[A-Za-zÀ-ÖØ-öø-ÿ'\\- ]+$","description":"Name of the cardholder as it appears on the card"},"save":{"type":"boolean","description":"Save card for future payments"}},"required":["amount","paymentType","encCardNumber","encCvv","expiryMonth","expiryYear","cardholderName"],"description":"Checkout payload for a new card debit","example":{"paymentType":"card-debit-new","amount":{"amt":24.42,"cy":"USD"},"encCardNumber":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA","encCvv":"ev:tok:FpYAxV4Ag7P1WtXM4ABCDE:XYZ123","expiryMonth":1,"expiryYear":2029,"cardholderName":"Arthur Dent","save":false}},{"type":"object","properties":{"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Amount to process"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"paymentType":{"type":"string","enum":["card-debit-token"]},"tokenId":{"type":"string","minLength":1,"maxLength":256,"description":"Encrypted card number"},"encCvv":{"type":"string","minLength":1,"maxLength":256,"description":"Encrypted CVV"},"expiryMonth":{"type":"integer","minimum":1,"maximum":12,"description":"Card expiry month (1-12)"},"expiryYear":{"type":"integer","minimum":1970,"maximum":2100,"description":"Card expiry year (4 digits)"}},"required":["amount","paymentType","tokenId","encCvv"],"description":"Checkout payload for a tokenized card debit","example":{"paymentType":"card-debit-token","amount":{"amt":99,"cy":"EUR"},"tokenId":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA","encCvv":"ev:tok:FpYAxV4Ag7P1WtXM4ABCDE:XYZ123"}},{"type":"object","properties":{"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Amount to process"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"paymentType":{"type":"string","enum":["open-banking-debit"]}},"required":["amount","paymentType"],"description":"Checkout payload for an open banking debit","example":{"paymentType":"open-banking-debit","amount":{"amt":150,"cy":"SEK"}}}],"description":"Request schema for checkout debit","examples":[{"paymentType":"card-debit-new","amount":{"amt":24.42,"cy":"USD"},"encCardNumber":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA","encCvv":"ev:tok:FpYAxV4Ag7P1WtXM4ABCDE:XYZ123","expiryMonth":1,"expiryYear":2029,"cardholderName":"Arthur Dent"},{"paymentType":"card-debit-token","amount":{"amt":99,"cy":"EUR"},"tokenId":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA","encCvv":"ev:tok:FpYAxV4Ag7P1WtXM4ABCDE:XYZ123"},{"paymentType":"open-banking-debit","amount":{"amt":150,"cy":"SEK"}}]}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/checkout/credit":{"post":{"description":"Processes a credit payment using the checkout API.","summary":"Process credit payment","tags":["checkout"],"parameters":[],"requestBody":{"description":"Body","content":{"application/json":{"schema":{"discriminator":{"propertyName":"paymentType"},"oneOf":[{"type":"object","properties":{"amount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Amount to process"},"txRefId":{"type":"string","maxLength":255,"description":"External transaction reference ID"},"paymentType":{"type":"string","enum":["card-credit-token"]},"encCardNumber":{"type":"string","minLength":1,"maxLength":256,"description":"Encrypted card number"}},"required":["amount","paymentType","encCardNumber"],"description":"Checkout payload for a tokenized card credit","example":{"paymentType":"card-credit-token","amount":{"amt":50,"cy":"EUR"},"encCardNumber":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA"}}],"description":"Request schema for checkout credit","examples":[{"paymentType":"card-credit-token","amount":{"amt":50,"cy":"EUR"},"encCardNumber":"ev:tok:QpEAxV4Ag7P1WtXM4FXQKQ:BQIDBA","encCvv":"ev:tok:FpYAxV4Ag7P1WtXM4ABCDE:XYZ123","expiryMonth":6,"expiryYear":2028}]}}}},"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/checkout/status/{id}":{"get":{"description":"Get the status of a checkout payment transaction by its ID.","summary":"Get payment status","tags":["checkout"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"API response schema for payment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"API response schema for payment"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}},"/api/v1/checkout/revoke/{tokenId}":{"delete":{"description":"Marks a saved card as revoked and removes encrypted data.","summary":"Revoke a saved card","tags":["checkout"],"parameters":[{"name":"tokenId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Response schema for checkout revoke","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the revocation was successful"}},"required":["success"],"description":"Response schema for checkout revoke"}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"500":{"description":"500","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}}}}},"info":{"title":"API","version":"1.0.0"},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"}}},"security":[{"BearerAuth":[]}],"servers":[{"url":"https://api-dev.babelpay.io","description":"Current environment"}],"webhooks":{"paymentCallback":{"post":{"summary":"Payment webhook callback","description":"**Note: Never trust the callback data without signature verification!** The callback is sent to the callbackUrl provided in the payment request when the transaction reaches a final state. Delivered with up to 3 retries.\n\n## Signature verification\n\nEvery webhook request includes two headers for signature verification:\n\n| Header | Description |\n| --- | --- |\n| `X-Webhook-Signature` | `sha256=<hex-encoded HMAC-SHA256>` |\n| `X-Webhook-Timestamp` | Unix epoch seconds when the request was signed |\n\nThe HMAC is computed over `{timestamp}.{raw JSON body}` using the `webhookSecret` (`whsec_…`) returned when the API key was created.\n\n### Verification steps\n\n1. Read `X-Webhook-Timestamp` and `X-Webhook-Signature` from the request headers.\n2. Reject the request if the timestamp is more than 5 minutes old (replay protection).\n3. Concatenate `{timestamp}.{raw request body}` (UTF-8).\n4. Compute `HMAC-SHA256(webhookSecret, concatenated string)` and hex-encode the result.\n5. Compare with the signature value after the `sha256=` prefix using a constant-time comparison.\n\n### Quick test — TypeScript Playground\n\nPaste the snippet below into [TypeScript Playground](https://www.typescriptlang.org/play), fill in the three values from an actual webhook request, and check the **Logs** tab.\n\n```typescript\n// ---- paste your values here ----\nconst webhookSecret    = \"whsec_...\";           // from API key creation\nconst signatureHeader  = \"sha256=...\";          // X-Webhook-Signature header\nconst timestampHeader  = \"1717344000\";          // X-Webhook-Timestamp header\nconst rawBody          = '{\"id\":\"...\"}';       // raw JSON body\n\n// ---- verify ----\n(async () => {\n  const enc = new TextEncoder();\n  const key = await crypto.subtle.importKey(\n    \"raw\", enc.encode(webhookSecret),\n    { name: \"HMAC\", hash: \"SHA-256\" }, false, [\"sign\"],\n  );\n  const sig = await crypto.subtle.sign(\n    \"HMAC\", key, enc.encode(`${timestampHeader}.${rawBody}`),\n  );\n  const expected = Array.from(new Uint8Array(sig))\n    .map(b => b.toString(16).padStart(2, \"0\")).join(\"\");\n  const received = signatureHeader.replace(/^sha256=/, \"\");\n\n  console.log(\"Expected:\", expected);\n  console.log(\"Received:\", received);\n  console.log(\"Valid:\", expected === received);\n})();\n```\n","requestBody":{"description":"The webhook callback payload containing the payment result.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"txAmount":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txFee":{"type":"object","properties":{"amt":{"type":"number","minimum":-1000000000,"maximum":1000000000,"description":"Amount"},"cy":{"type":"string","enum":["USD","EUR","GBP","JPY","CHF","CAD","AUD","SEK","NOK","DKK","PLN","CZK","HUF","RUB","CNY","INR","KRW","SGD","HKD","NZD","MXN","BRL","ZAR","TRY","ILS","THB","MYR","IDR","PHP","VND","JOD","KWD","BHD","OMR","TND","LYD","CLP","COP","PEN","ARS","UYU","EGP","MAD","NGN","KES","GHS","BWP","ZMW","UGX","TZS","ETB","RWF","MUR","SCR","BTC","ETH","LTC","BCH","XRP","ADA","DOT","LINK","XLM","DOGE","BNB","SOL","MATIC","AVAX","ATOM","ALGO","TRX","USDT","USDC","DAI"]}},"required":["amt","cy"],"description":"Monetary amount with currency"},"txRefId":{"type":"string","maxLength":255},"state":{"type":"string","enum":["success","processing","waiting","approval","declined","unknown","error","cancelled"],"description":"Payment transaction state"},"statusCode":{"type":"string","enum":["approved","do_not_honor","suspected_fraud","invalid_trx","invalid_amt","invalid_account","invalid_response","no_transaction","restricted_card","insufficient_funds","expired_card","trx_not_permitted","exceeds_limit","exceeds_frequency","invalid_cvv","issuer_err","dest_not_found","psp_malfunction","unable_to_authorize","3ds_auth_failure","psp_limits_reached","psp_timeout","user_aborted_trx","avs_response","no_auth_corresponding","already_captured","already_cancelled","already_refunded","unknown_card","currency_not_supported","amt_over_max","amt_under_min","mobile_block","email_block","ip_block","bin_block","device_block","user_block","account_block","risk_block","duplicate_trx","already_chargedback","too_old_to_refund","no_partial_refund","partial_refund_over","redirect","redirect_timeout","processing","routing_error","system_error","psp_error","bad_request","other"],"description":"Harmonized response codes"},"statusMessage":{"type":"string"},"redirectUrl":{"type":"string","format":"uri"}},"required":["id"],"description":"Webhook callback payload sent to the customer callbackUrl","example":{"id":"f47ac10b-58cc-4372-a567-0e02b2c3d479","txAmount":{"amt":23.56,"cy":"EUR"},"txRefId":"TOWL-42-DENT-DONT-PANIC-001","state":"success","statusCode":"approved","statusMessage":"Transaction approved"}}}}},"parameters":[{"name":"X-Webhook-Signature","in":"header","required":false,"description":"HMAC-SHA256 signature: `sha256=<hex>`","schema":{"type":"string","example":"sha256=a1b2c3d4..."}},{"name":"X-Webhook-Timestamp","in":"header","required":false,"description":"Unix epoch seconds when the signature was computed","schema":{"type":"string","example":"1717344000"}}],"responses":{"200":{"description":"Callback received successfully. Any 2xx response is treated as success."}}}}}}