{"openapi":"3.1.0","info":{"title":"ClubBase studio integration API","version":"1.0.0"},"servers":[{"url":"/v1"}],"paths":{"/integrations/leads":{"post":{"operationId":"createLead","summary":"Створити заявку","security":[{"tenantApiKey":[]}],"x-required-scope":"leads.create","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCapture"},"example":{"displayName":"Приклад API","contact":{"type":"email","value":"api-example@example.test"},"sourceId":null,"note":"Контрольна заявка інтеграції"}}}},"responses":{"201":{"description":"Created, or the original successful response on replay.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"400":{"description":"Невідоме поле, неправильний контакт, cursor або відсутній UUID Idempotency-Key. Джерело заявки не належить цій студії або вимкнене.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"Ключ не передано, він відкликаний, замінений або строк дії минув.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"402":{"description":"Доступ до студії призупинено.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Ключ не дозволяє цю операцію. Поточні права того, хто видав ключ, більше не дозволяють інтеграцію.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Заявка недоступна у студії цього ключа.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Той самий Idempotency-Key використано з іншими даними. Контакт уже має відкриту заявку.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Зачекайте кількість секунд із Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"headers":{"Retry-After":{"description":"Seconds before retry","schema":{"type":"integer","minimum":1}}}},"503":{"description":"Перевірка квоти тимчасово недоступна; запис не виконано.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"get":{"operationId":"listLeads","summary":"Список заявок","security":[{"tenantApiKey":[]}],"x-required-scope":"leads.read","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":25,"minimum":1,"maximum":100}},{"name":"cursor","in":"query","schema":{"type":"string","maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"}}],"responses":{"200":{"description":"One bounded page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadList"}}}},"400":{"description":"Невідоме поле, неправильний контакт, cursor або відсутній UUID Idempotency-Key. Джерело заявки не належить цій студії або вимкнене.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"Ключ не передано, він відкликаний, замінений або строк дії минув.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"402":{"description":"Доступ до студії призупинено.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Ключ не дозволяє цю операцію. Поточні права того, хто видав ключ, більше не дозволяють інтеграцію.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Заявка недоступна у студії цього ключа.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Той самий Idempotency-Key використано з іншими даними. Контакт уже має відкриту заявку.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Зачекайте кількість секунд із Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"headers":{"Retry-After":{"description":"Seconds before retry","schema":{"type":"integer","minimum":1}}}},"503":{"description":"Перевірка квоти тимчасово недоступна; запис не виконано.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/integrations/leads/{id}":{"get":{"operationId":"getLead","summary":"Прочитати заявку","security":[{"tenantApiKey":[]}],"x-required-scope":"leads.read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The current authorized lead.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"400":{"description":"Невідоме поле, неправильний контакт, cursor або відсутній UUID Idempotency-Key. Джерело заявки не належить цій студії або вимкнене.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"401":{"description":"Ключ не передано, він відкликаний, замінений або строк дії минув.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"402":{"description":"Доступ до студії призупинено.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Ключ не дозволяє цю операцію. Поточні права того, хто видав ключ, більше не дозволяють інтеграцію.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Заявка недоступна у студії цього ключа.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Той самий Idempotency-Key використано з іншими даними. Контакт уже має відкриту заявку.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Зачекайте кількість секунд із Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}},"headers":{"Retry-After":{"description":"Seconds before retry","schema":{"type":"integer","minimum":1}}}},"503":{"description":"Перевірка квоти тимчасово недоступна; запис не виконано.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"securitySchemes":{"tenantApiKey":{"type":"http","scheme":"bearer","bearerFormat":"ClubBase API key"}},"schemas":{"LeadCapture":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"displayName":{"type":"string","minLength":1,"maxLength":160},"contact":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"email"},"value":{"type":"string","maxLength":254}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"phone"},"value":{"type":"string","minLength":5,"maxLength":64}},"required":["type","value"],"additionalProperties":false}]},"sourceId":{"default":null,"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"note":{"default":null,"anyOf":[{"type":"string","minLength":1,"maxLength":2000},{"type":"null"}]}},"required":["displayName","contact"],"additionalProperties":false},"LeadResponse":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"displayName":{"type":"string","minLength":1,"maxLength":160},"stage":{"type":"string","enum":["new","contacted","trial_booked","trial_attended","won","lost"]},"sourceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["id","displayName","stage","sourceId","note","createdAt","updatedAt"],"additionalProperties":false}},"required":["lead"],"additionalProperties":false},"LeadList":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"leads":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"displayName":{"type":"string","minLength":1,"maxLength":160},"stage":{"type":"string","enum":["new","contacted","trial_booked","trial_attended","won","lost"]},"sourceId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["id","displayName","stage","sourceId","note","createdAt","updatedAt"],"additionalProperties":false}},"nextCursor":{"anyOf":[{"type":"string","minLength":1,"maxLength":512,"pattern":"^[A-Za-z0-9_-]+$"},{"type":"null"}]}},"required":["leads","nextCursor"],"additionalProperties":false},"ProblemDetails":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string","minLength":1},"status":{"type":"integer","minimum":400,"maximum":599},"code":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"detail":{"type":"string","minLength":1},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string","minLength":1}}},"requestId":{"type":"string","minLength":1,"maxLength":128}},"required":["type","title","status","code","requestId"],"additionalProperties":false}}}}