{"openapi":"3.1.0","info":{"title":"Darhim Labs SaaS API","version":"2.0.0","description":"Publiczne API partnerowe, endpointy widgetu, webhooks oraz Developer Platform v3 dla app.darhimlabs.pl."},"servers":[{"url":"https://app.darhimlabs.pl"}],"tags":[{"name":"Widget","description":"Publiczne endpointy osadzanego widgetu"},{"name":"Public API","description":"REST API autoryzowane kluczem dl_sk_live_*"},{"name":"Public API v2","description":"Stabilny kontrakt /api/v2 dla SDK, CLI i Terraform"},{"name":"Developer Platform v3","description":"OAuth apps, API logs, event catalog, SDK i Terraform"},{"name":"Integrations","description":"Webhooki i integracje systemowe"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"dl_sk_live_*","description":"Klucz API Darhim Labs w formacie Bearer."}},"schemas":{},"parameters":{}},"paths":{"/api/bot/{id}/config":{"get":{"tags":["Widget"],"summary":"Publiczna konfiguracja widgetu","parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Konfiguracja publiczna bota","content":{"application/json":{"schema":{"type":"object","properties":{"bot":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"primary_color":{"type":"string"},"greeting":{"type":"string"},"greeting_en":{"type":["string","null"]},"language":{"type":"string","enum":["pl","en","both"]},"collect_lead_after_messages":{"type":"integer"},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"is_active":{"type":"boolean"},"cookie_banner_enabled":{"type":"boolean"},"offline_lead_enabled":{"type":"boolean"}},"required":["id","name","primary_color","greeting","language","collect_lead_after_messages","lead_fields","is_active","cookie_banner_enabled","offline_lead_enabled"]}},"required":["bot"]}}}},"404":{"description":"Bot nie istnieje","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/bot/{id}/chat":{"post":{"tags":["Widget"],"summary":"Publiczny chat SSE z RAG","parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4000},"session_id":{"type":"string","minLength":8,"maxLength":200},"conversation_id":{"type":"string","format":"uuid"},"language":{"type":"string","enum":["pl","en","both"]},"attachments":{"type":"array","items":{"type":"object","properties":{"storage_path":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"maxLength":255},"mime":{"type":"string","minLength":1,"maxLength":120},"size":{"type":"integer","minimum":1,"maximum":10485760},"extracted_text":{"type":["string","null"],"maxLength":12000}},"required":["storage_path","name","mime","size"]},"maxItems":3}},"required":["message","session_id"]}}}},"responses":{"200":{"description":"Strumien Server-Sent Events z odpowiedzia bota","content":{"text/event-stream":{"schema":{"type":"string","example":"data: {\"type\":\"token\",\"content\":\"Dzien dobry\"}\n\ndata: {\"type\":\"done\",\"content\":\"Dzien dobry\"}"}}}},"403":{"description":"Bot nieaktywny albo limit planu","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limit widgetu","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/bot/{id}/lead":{"post":{"tags":["Widget"],"summary":"Publiczny zapis leada z widgetu","parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","minLength":8,"maxLength":200},"conversation_id":{"type":"string","format":"uuid"},"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"string","enum":[""]}]},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"string","enum":[""]}]},"phone":{"anyOf":[{"type":"string","maxLength":40},{"type":"string","enum":[""]}]},"message":{"anyOf":[{"type":"string","maxLength":2000},{"type":"string","enum":[""]}]},"consent_timestamp":{"type":"string","format":"date-time"}},"required":["session_id","consent_timestamp"]}}}},"responses":{"201":{"description":"Lead zapisany","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"lead_id":{"type":["string","null"],"format":"uuid"}},"required":["ok"]}}}},"400":{"description":"Bledne dane leada","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/bots":{"get":{"tags":["Public API"],"summary":"Lista botow workspace","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Lista botow","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at"]}}},"required":["items"]}}}},"401":{"description":"Brak klucza API","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"tags":["Public API"],"summary":"Tworzenie bota","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120},"slug":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"website_url":{"type":"string"},"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#0ea5e9"},"greeting_pl":{"type":"string","minLength":6,"maxLength":500,"default":"Czesc! Jak moge pomoc?"},"personality":{"type":"string","enum":["professional","friendly","warm"],"default":"professional"},"language":{"type":"string","enum":["pl","en","both"],"default":"pl"},"is_active":{"type":"boolean","default":true}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Utworzony bot","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["item"]}}}}}}},"/api/v1/bots/{id}":{"get":{"tags":["Public API"],"summary":"Szczegoly jednego bota","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Szczegoly bota","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["item"]}}}},"404":{"description":"Bot nie istnieje","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"patch":{"tags":["Public API"],"summary":"Aktualizacja ustawien bota","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2},"slug":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"website_url":{"type":"string"},"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"greeting_pl":{"type":"string","minLength":6},"personality":{"type":"string","enum":["professional","friendly","warm","concise","educational","sales","custom"]},"language":{"type":"string","enum":["pl","en","de","es","fr","it","nl","cz","sk","ua","ru","ar","both"]},"collect_lead_after_messages":{"type":"integer","minimum":1,"maximum":10},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]},"minItems":1},"is_active":{"type":"boolean"},"cookie_banner_enabled":{"type":"boolean"},"widget_theme":{"type":"string","enum":["dark","light","auto"]}}}}}},"responses":{"200":{"description":"Zapisany bot","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["item"]}}}},"403":{"description":"Brak zakresu bots:write","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"delete":{"tags":["Public API"],"summary":"Usuniecie bota","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Bot usuniety","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deleted":{"type":"boolean"}},"required":["id","deleted"]}}}}}}},"/api/v1/bots/{id}/messages":{"post":{"tags":["Public API"],"summary":"Programatyczne wyslanie wiadomosci do bota","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4000},"session_id":{"type":"string","minLength":8,"maxLength":200},"conversation_id":{"type":"string","format":"uuid"},"language":{"type":"string","enum":["pl","en","both"]}},"required":["message","session_id"]}}}},"responses":{"200":{"description":"Odpowiedz bota w JSON","content":{"application/json":{"schema":{"type":"object","properties":{"conversation_id":{"type":"string","format":"uuid"},"message_id":{"type":["string","null"],"format":"uuid"},"response":{"type":"string"},"usage":{"type":"object","properties":{"prompt_tokens_estimate":{"type":"integer","minimum":0},"completion_tokens_estimate":{"type":"integer","minimum":0}},"required":["prompt_tokens_estimate","completion_tokens_estimate"]}},"required":["conversation_id","message_id","response","usage"]}}}},"403":{"description":"Bot nieaktywny albo limit planu","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/leads":{"get":{"tags":["Public API"],"summary":"Lista leadow z cursor pagination","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bot_id","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["new","processed","scheduled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Lista leadow","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"conversation_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"message":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["new","processed","scheduled"]},"consent_timestamp":{"type":"string"},"notified_at":{"type":["string","null"]},"created_at":{"type":["string","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"required":["id","bot_id","conversation_id","name","email","phone","message","status","consent_timestamp","notified_at","created_at","bot"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}}}}},"/api/v1/leads/{id}/status":{"post":{"tags":["Public API"],"summary":"Zmiana statusu leada","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"908fcb33-f8a0-4d5f-b404-775042fbf6b1"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","processed","scheduled"]}},"required":["status"]}}}},"responses":{"200":{"description":"Zaktualizowany lead","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"conversation_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"message":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["new","processed","scheduled"]},"consent_timestamp":{"type":"string"},"notified_at":{"type":["string","null"]},"created_at":{"type":["string","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"required":["id","bot_id","conversation_id","name","email","phone","message","status","consent_timestamp","notified_at","created_at","bot"]}},"required":["item"]}}}}}}},"/api/v1/conversations":{"get":{"tags":["Public API"],"summary":"Lista rozmow wraz z wiadomosciami","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bot_id","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Lista rozmow","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"session_id":{"type":"string"},"started_at":{"type":["string","null"]},"ended_at":{"type":["string","null"]},"message_count":{"type":["integer","null"]},"lead_captured":{"type":["boolean","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"},"created_at":{"type":["string","null"]}},"required":["id","role","content","created_at"]}}},"required":["id","bot_id","session_id","started_at","ended_at","message_count","lead_captured","bot","messages"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}}}}},"/api/v1/usage":{"get":{"tags":["Public API"],"summary":"Aktualne zuzycie i limity workspace","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Zuzycie konta","content":{"application/json":{"schema":{"type":"object","properties":{"workspace_id":{"type":"string","format":"uuid"},"plan":{"type":"string","enum":["starter","pro","business","enterprise"]},"subscription_status":{"type":"string"},"current_period_end":{"type":["string","null"]},"billing_cycle":{"type":"string","enum":["monthly","yearly"]},"usage":{"type":"object","properties":{"messages_count":{"type":"integer","minimum":0},"leads_count":{"type":"integer","minimum":0},"tokens_used":{"type":"integer","minimum":0},"overage_messages_count":{"type":"integer","minimum":0}},"required":["messages_count","leads_count","tokens_used","overage_messages_count"]},"limits":{"type":"object","properties":{"bots":{"type":"integer","exclusiveMinimum":0},"messages_per_month":{"type":"integer","exclusiveMinimum":0},"leads_per_month":{"type":"integer","exclusiveMinimum":0},"knowledge_items":{"type":"integer","exclusiveMinimum":0}},"required":["bots","messages_per_month","leads_per_month","knowledge_items"]},"bots_count":{"type":"integer","minimum":0},"api_keys_count":{"type":"integer","minimum":0}},"required":["workspace_id","plan","subscription_status","current_period_end","billing_cycle","usage","limits","bots_count","api_keys_count"]}}}}}}},"/api/v1/webhook-endpoints":{"get":{"tags":["Public API"],"summary":"Lista endpointow Webhooks v2","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Lista endpointow webhookow","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"api_version":{"type":"string"},"last_delivery_at":{"type":["string","null"]},"last_delivery_status":{"type":["integer","null"]},"total_deliveries":{"type":"integer"},"failed_deliveries":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","workspace_id","url","description","events","is_active","api_version","last_delivery_at","last_delivery_status","total_deliveries","failed_deliveries","created_at","updated_at"]}}},"required":["items"]}}}}}},"post":{"tags":["Public API"],"summary":"Tworzenie endpointu Webhooks v2","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":["string","null"],"maxLength":240},"events":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.score_changed","conversation.started","conversation.ended","conversation.handoff_requested","bot.created","bot.updated","bot.deleted","knowledge.crawl_completed","knowledge.sync_completed","billing.plan_changed","billing.invoice_paid","billing.payment_failed","agent.action_executed","voice.session_ended"]},"minItems":1,"maxItems":16},"custom_headers":{"type":"object","additionalProperties":{"type":"string","maxLength":500},"default":{}},"max_retries":{"type":"integer","minimum":1,"maximum":10,"default":5}},"required":["url","events"]}}}},"responses":{"201":{"description":"Utworzony endpoint webhooka","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"api_version":{"type":"string"},"last_delivery_at":{"type":["string","null"]},"last_delivery_status":{"type":["integer","null"]},"total_deliveries":{"type":"integer"},"failed_deliveries":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","workspace_id","url","description","events","is_active","api_version","last_delivery_at","last_delivery_status","total_deliveries","failed_deliveries","created_at","updated_at"]},"secret":{"type":["string","null"]}},"required":["item"]}}}}}}},"/api/v1/webhook-endpoints/{id}":{"get":{"tags":["Public API"],"summary":"Szczegoly endpointu Webhooks v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Endpoint webhooka","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"api_version":{"type":"string"},"last_delivery_at":{"type":["string","null"]},"last_delivery_status":{"type":["integer","null"]},"total_deliveries":{"type":"integer"},"failed_deliveries":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","workspace_id","url","description","events","is_active","api_version","last_delivery_at","last_delivery_status","total_deliveries","failed_deliveries","created_at","updated_at"]},"secret":{"type":["string","null"]}},"required":["item"]}}}}}},"patch":{"tags":["Public API"],"summary":"Aktualizacja endpointu Webhooks v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"description":{"type":["string","null"],"maxLength":240},"events":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.score_changed","conversation.started","conversation.ended","conversation.handoff_requested","bot.created","bot.updated","bot.deleted","knowledge.crawl_completed","knowledge.sync_completed","billing.plan_changed","billing.invoice_paid","billing.payment_failed","agent.action_executed","voice.session_ended"]},"minItems":1,"maxItems":16},"custom_headers":{"type":"object","additionalProperties":{"type":"string","maxLength":500},"default":{}},"max_retries":{"type":"integer","minimum":1,"maximum":10,"default":5},"is_active":{"type":"boolean"},"rotate_secret":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Zaktualizowany endpoint webhooka","content":{"application/json":{"schema":{"type":"object","properties":{"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"api_version":{"type":"string"},"last_delivery_at":{"type":["string","null"]},"last_delivery_status":{"type":["integer","null"]},"total_deliveries":{"type":"integer"},"failed_deliveries":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","workspace_id","url","description","events","is_active","api_version","last_delivery_at","last_delivery_status","total_deliveries","failed_deliveries","created_at","updated_at"]},"secret":{"type":["string","null"]}},"required":["item"]}}}}}},"delete":{"tags":["Public API"],"summary":"Usuniecie endpointu Webhooks v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Endpoint usuniety","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"deleted":{"type":"boolean"}},"required":["id","deleted"]}}}}}}},"/api/v2/bots":{"get":{"tags":["Public API v2"],"summary":"Lista botow workspace w kontrakcie v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Lista botow v2","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at"]}}},"required":["api_version","items"]}}}}}},"post":{"tags":["Public API v2"],"summary":"Tworzenie bota w API v2","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120},"slug":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"website_url":{"type":"string"},"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$","default":"#0ea5e9"},"greeting_pl":{"type":"string","minLength":6,"maxLength":500,"default":"Czesc! Jak moge pomoc?"},"personality":{"type":"string","enum":["professional","friendly","warm"],"default":"professional"},"language":{"type":"string","enum":["pl","en","both"],"default":"pl"},"is_active":{"type":"boolean","default":true}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Utworzony bot","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["api_version","item"]}}}}}}},"/api/v2/bots/{id}":{"get":{"tags":["Public API v2"],"summary":"Szczegoly bota w API v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Szczegoly bota","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["api_version","item"]}}}}}},"patch":{"tags":["Public API v2"],"summary":"Aktualizacja bota w API v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2},"slug":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"website_url":{"type":"string"},"primary_color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"greeting_pl":{"type":"string","minLength":6},"personality":{"type":"string","enum":["professional","friendly","warm","concise","educational","sales","custom"]},"language":{"type":"string","enum":["pl","en","de","es","fr","it","nl","cz","sk","ua","ru","ar","both"]},"collect_lead_after_messages":{"type":"integer","minimum":1,"maximum":10},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]},"minItems":1},"is_active":{"type":"boolean"},"cookie_banner_enabled":{"type":"boolean"},"widget_theme":{"type":"string","enum":["dark","light","auto"]}}}}}},"responses":{"200":{"description":"Zapisany bot","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"website_url":{"type":["string","null"]},"primary_color":{"type":["string","null"]},"greeting_pl":{"type":["string","null"]},"personality":{"type":["string","null"],"enum":["professional","friendly","warm"]},"language":{"type":["string","null"],"enum":["pl","en","both"]},"is_active":{"type":["boolean","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]},"embed_script":{"type":"string"},"collect_lead_after_messages":{"type":["integer","null"]},"lead_fields":{"type":"array","items":{"type":"string","enum":["name","email","phone","message"]}},"cookie_banner_enabled":{"type":["boolean","null"]},"widget_theme":{"type":["string","null"],"enum":["dark","light","auto"]},"booking_mode":{"type":"string","enum":["none","google_calendar","calendly"]},"booking_integration_id":{"type":["string","null"],"format":"uuid"}},"required":["id","workspace_id","name","slug","website_url","primary_color","greeting_pl","personality","language","is_active","created_at","updated_at","embed_script","collect_lead_after_messages","lead_fields","cookie_banner_enabled","widget_theme","booking_mode","booking_integration_id"]}},"required":["api_version","item"]}}}}}},"delete":{"tags":["Public API v2"],"summary":"Usuniecie bota w API v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Bot usuniety","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"id":{"type":"string","format":"uuid"},"deleted":{"type":"boolean"}},"required":["api_version","id","deleted"]}}}}}}},"/api/v2/bots/{id}/messages":{"post":{"tags":["Public API v2"],"summary":"Programatyczne wyslanie wiadomosci do bota w API v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"3b91db2b-bc58-461f-ae1a-d6b5b6998d78"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4000},"session_id":{"type":"string","minLength":8,"maxLength":200},"conversation_id":{"type":"string","format":"uuid"},"language":{"type":"string","enum":["pl","en","both"]}},"required":["message","session_id"]}}}},"responses":{"200":{"description":"Odpowiedz bota","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"conversation_id":{"type":"string","format":"uuid"},"message_id":{"type":["string","null"],"format":"uuid"},"response":{"type":"string"},"usage":{"type":"object","properties":{"prompt_tokens_estimate":{"type":"integer","minimum":0},"completion_tokens_estimate":{"type":"integer","minimum":0}},"required":["prompt_tokens_estimate","completion_tokens_estimate"]}},"required":["api_version","conversation_id","message_id","response","usage"]}}}}}}},"/api/v2/leads":{"get":{"tags":["Public API v2"],"summary":"Lista leadow v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bot_id","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["new","processed","scheduled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Lista leadow","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"conversation_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"message":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["new","processed","scheduled"]},"consent_timestamp":{"type":"string"},"notified_at":{"type":["string","null"]},"created_at":{"type":["string","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"required":["id","bot_id","conversation_id","name","email","phone","message","status","consent_timestamp","notified_at","created_at","bot"]}},"next_cursor":{"type":["string","null"]}},"required":["api_version","items","next_cursor"]}}}}}}},"/api/v2/leads/{id}/status":{"post":{"tags":["Public API v2"],"summary":"Zmiana statusu leada v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"908fcb33-f8a0-4d5f-b404-775042fbf6b1"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","processed","scheduled"]}},"required":["status"]}}}},"responses":{"200":{"description":"Zaktualizowany lead","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"item":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"conversation_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"message":{"type":["string","null"]},"status":{"type":["string","null"],"enum":["new","processed","scheduled"]},"consent_timestamp":{"type":"string"},"notified_at":{"type":["string","null"]},"created_at":{"type":["string","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]}},"required":["id","bot_id","conversation_id","name","email","phone","message","status","consent_timestamp","notified_at","created_at","bot"]}},"required":["api_version","item"]}}}}}}},"/api/v2/conversations":{"get":{"tags":["Public API v2"],"summary":"Lista rozmow v2","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bot_id","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Lista rozmow","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bot_id":{"type":"string","format":"uuid"},"session_id":{"type":"string"},"started_at":{"type":["string","null"]},"ended_at":{"type":["string","null"]},"message_count":{"type":["integer","null"]},"lead_captured":{"type":["boolean","null"]},"bot":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}},"required":["id","name","slug"]},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"},"created_at":{"type":["string","null"]}},"required":["id","role","content","created_at"]}}},"required":["id","bot_id","session_id","started_at","ended_at","message_count","lead_captured","bot","messages"]}},"next_cursor":{"type":["string","null"]}},"required":["api_version","items","next_cursor"]}}}}}}},"/api/v2/usage":{"get":{"tags":["Public API v2"],"summary":"Zuzycie i limity workspace v2","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Zuzycie konta","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"item":{"type":"object","properties":{"workspace_id":{"type":"string","format":"uuid"},"plan":{"type":"string","enum":["starter","pro","business","enterprise"]},"subscription_status":{"type":"string"},"current_period_end":{"type":["string","null"]},"billing_cycle":{"type":"string","enum":["monthly","yearly"]},"usage":{"type":"object","properties":{"messages_count":{"type":"integer","minimum":0},"leads_count":{"type":"integer","minimum":0},"tokens_used":{"type":"integer","minimum":0},"overage_messages_count":{"type":"integer","minimum":0}},"required":["messages_count","leads_count","tokens_used","overage_messages_count"]},"limits":{"type":"object","properties":{"bots":{"type":"integer","exclusiveMinimum":0},"messages_per_month":{"type":"integer","exclusiveMinimum":0},"leads_per_month":{"type":"integer","exclusiveMinimum":0},"knowledge_items":{"type":"integer","exclusiveMinimum":0}},"required":["bots","messages_per_month","leads_per_month","knowledge_items"]},"bots_count":{"type":"integer","minimum":0},"api_keys_count":{"type":"integer","minimum":0}},"required":["workspace_id","plan","subscription_status","current_period_end","billing_cycle","usage","limits","bots_count","api_keys_count"]}},"required":["api_version","item"]}}}}}}},"/api/v2/events":{"get":{"tags":["Developer Platform v3"],"summary":"Katalog eventow dla webhookow, SDK i integracji","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":80},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","enum":["active","deprecated"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Katalog eventow","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_type":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"payload_schema":{"type":"object","additionalProperties":{}},"sample_payload":{"type":"object","additionalProperties":{}},"pii_level":{"type":"string","enum":["none","low","medium","high"]},"available_in_webhooks":{"type":"boolean"},"available_in_api":{"type":"boolean"},"version":{"type":"string"},"status":{"type":"string","enum":["active","deprecated"]},"updated_at":{"type":"string"}},"required":["id","event_type","category","description","payload_schema","sample_payload","pii_level","available_in_webhooks","available_in_api","version","status","updated_at"]}}},"required":["api_version","items"]}}}}}}},"/api/v2/api-logs":{"get":{"tags":["Developer Platform v3"],"summary":"API logs explorer z cursor pagination","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["v1","v2","oauth","cli","dashboard"]},"required":false,"name":"api_version","in":"query"},{"schema":{"type":"string","enum":["GET","POST","PATCH","DELETE","PUT"]},"required":false,"name":"method","in":"query"},{"schema":{"type":"integer","minimum":100,"maximum":599},"required":false,"name":"status_code","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":120},"required":false,"name":"path_contains","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Logi API","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":0},"request_id":{"type":["string","null"]},"method":{"type":"string"},"path":{"type":"string"},"status_code":{"type":"integer"},"duration_ms":{"type":"integer","minimum":0},"api_version":{"type":"string","enum":["v1","v2","oauth","cli","dashboard"]},"route_id":{"type":["string","null"]},"latency_bucket":{"type":["string","null"]},"response_size_bytes":{"type":"integer","minimum":0},"ip":{"type":["string","null"]},"user_agent":{"type":["string","null"]},"created_at":{"type":["string","null"]}},"required":["id","request_id","method","path","status_code","duration_ms","api_version","route_id","latency_bucket","response_size_bytes","ip","user_agent","created_at"]}},"next_cursor":{"type":["string","null"]}},"required":["api_version","items","next_cursor"]}}}}}}},"/api/v2/oauth/apps":{"get":{"tags":["Developer Platform v3"],"summary":"Lista OAuth apps","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Aplikacje OAuth","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["api_version","items"]}}}}}},"post":{"tags":["Developer Platform v3"],"summary":"Tworzenie OAuth app","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120},"redirect_uris":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1,"maxItems":10},"allowed_origins":{"type":"array","items":{"type":"string","format":"uri"},"maxItems":10,"default":[]},"scopes":{"type":"array","items":{"type":"string","enum":["bots:read","bots:write","webhooks:read","webhooks:write","messages:write","leads:read","leads:write","conversations:read","usage:read","events:read","api_logs:read","sandbox:read","openapi:read","terraform:read"]},"minItems":1,"maxItems":14}},"required":["name","redirect_uris","scopes"]}}}},"responses":{"201":{"description":"OAuth app i sekret widoczny tylko raz","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"app":{"type":"object","additionalProperties":{}},"client_secret":{"type":"string"}},"required":["api_version","app","client_secret"]}}}}}},"patch":{"tags":["Developer Platform v3"],"summary":"Aktualizacja albo rotacja sekretu OAuth app","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":2,"maxLength":120},"redirect_uris":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1,"maxItems":10},"allowed_origins":{"type":"array","items":{"type":"string","format":"uri"},"maxItems":10},"scopes":{"type":"array","items":{"type":"string","enum":["bots:read","bots:write","webhooks:read","webhooks:write","messages:write","leads:read","leads:write","conversations:read","usage:read","events:read","api_logs:read","sandbox:read","openapi:read","terraform:read"]},"minItems":1,"maxItems":14},"status":{"type":"string","enum":["active","disabled","rotating","revoked"]},"rotate_secret":{"type":"boolean"}},"required":["id"]}}}},"responses":{"200":{"description":"Zaktualizowana OAuth app","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"app":{"type":"object","additionalProperties":{}},"client_secret":{"type":["string","null"]}},"required":["api_version","app","client_secret"]}}}}}}},"/api/v2/sandbox-workspaces":{"post":{"tags":["Developer Platform v3"],"summary":"Tworzenie sandbox workspace","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":120},"slug":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9-]+$"},"clone_bots":{"type":"boolean","default":false}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Sandbox workspace","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"sandbox":{"type":"object","additionalProperties":{}},"link":{"type":"object","additionalProperties":{}}},"required":["api_version","sandbox","link"]}}}}}}},"/api/v2/openapi-snapshots":{"post":{"tags":["Developer Platform v3"],"summary":"Zapis snapshotu OpenAPI i diff summary","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string","minLength":1,"maxLength":40,"default":"v2"},"ci_run_id":{"type":"string","minLength":1,"maxLength":120}}}}}},"responses":{"201":{"description":"Snapshot OpenAPI","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"snapshot":{"type":"object","additionalProperties":{}},"job_run":{"type":"object","additionalProperties":{}}},"required":["api_version","snapshot","job_run"]}}}}}}},"/api/v2/sdk-generations":{"post":{"tags":["Developer Platform v3"],"summary":"Rejestracja generacji SDK z OpenAPI","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","enum":["typescript","python","curl","terraform"]},"openapi_snapshot_id":{"type":"string","format":"uuid"}},"required":["language"]}}}},"responses":{"201":{"description":"Generacja SDK","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"generation":{"type":"object","additionalProperties":{}},"job_run":{"type":"object","additionalProperties":{}}},"required":["api_version","generation","job_run"]}}}}}}},"/api/v2/terraform-resources":{"get":{"tags":["Developer Platform v3"],"summary":"Pokrycie zasobow Terraform provider","security":[{"ApiKeyAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["supported","partial","blocked"]},"required":false,"name":"coverage_status","in":"query"}],"responses":{"200":{"description":"Lista zasobow Terraform","content":{"application/json":{"schema":{"type":"object","properties":{"api_version":{"type":"string","enum":["v2"]},"items":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["api_version","items"]}}}}}}},"/api/integrations/calendly/webhook":{"post":{"tags":["Integrations"],"summary":"Inbound webhook z Calendly","responses":{"200":{"description":"Webhook obsluzony"},"401":{"description":"Nieprawidlowy podpis webhooka","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}}},"webhooks":{}}