{"openapi":"3.0.3","info":{"title":"Soldly Data API","version":"1.3.1","description":"REST API for Soldly call analytics: calls with scores and transcripts, managers, call types, checklist metrics.\n\n## Quick start\n1. A company administrator creates a key in the portal: [Integrations → API](https://app.soldly.ai/integrations/api). The key is shown once.\n2. Send the key in the header of every request:\n```\ncurl -H \"Authorization: Bearer <key>\" \"https://api.soldly.ai/v1/calls?days=7&limit=50\"\n```\n3. Click **Authorize** on this page, paste the key and try methods with **Try it out**.\n\n## Access\n- A key sees the data of its own company only.\n- The API is available on plans from €320 per month.\n- The API needs a company key. A personal key (made for AI assistants) only opens `/overview` with that manager’s own calls.\n- Reading is available to any key; changing metrics and call types requires a separate scope.\n- A key can have an expiry date and a list of allowed IP addresses.\n- Only a hash of the key is stored. A lost key cannot be recovered, only replaced with a new one.\n\n## Period\nMost methods accept `days` (last N days, default 30) or `from` and `to`. A date without time (`2026-11-20`) means the whole day. Times are in UTC.\n\n## Departments\nAlmost every method accepts `department`: a department name from `/departments` (a part of the name is enough). Only calls of managers in that department are then counted.\n\n## Pagination\nLists are returned in pages: `limit` (up to 200) and `offset`. To fetch everything, increase `offset` by `limit` until `returned` is smaller than `limit`.\n\n## Rate limits\n120 requests per minute per key, 20 for heavy methods. Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (seconds until reset). Exceeding the limit returns `429` with a `Retry-After` header.\n\n## Errors\nAn error response is JSON: `{ \"error\": \"...\", \"code\": \"...\", \"request_id\": \"...\" }`. `code` is stable and meant for programs; `error` is human-readable, in English by default and in Ukrainian with `Accept-Language: uk`. The request number is also in the `X-Request-Id` header: give it to support and we will find the request in the log.\n\n## Log\nEvery request is logged (method, path, status, IP address) and kept for 90 days. An administrator can see the log of their key in the portal.\n\n## Language\nData values (names, summaries, metric names) are returned as stored, usually in Ukrainian. This documentation: [Українською](?lang=uk)."},"servers":[{"url":"https://api.soldly.ai"}],"tags":[{"name":"Overview","description":"Company totals for a period and how they change over time."},{"name":"Calls","description":"Call list, full analysis of a single call, transcripts."},{"name":"Managers","description":"Team, manager summary and ranking, a deep dive into one manager."},{"name":"Departments","description":"Company structure: departments, their members and figures."},{"name":"Clients","description":"All conversations with one client by phone number."},{"name":"Call types","description":"Call types (analysis scenarios): list, statistics, configuration."},{"name":"Metrics","description":"Checklist items: definitions, value distribution, weakest spots."},{"name":"Quality","description":"Manager/client talk balance and stop words."},{"name":"Portal analytics","description":"The same calculations as the “Analytics” page in the portal. Company key only."},{"name":"Metrics (write)","description":"Changing metrics. Requires the `write_metrics` scope."},{"name":"Call types (write)","description":"Changing call types. Requires the `write_config` scope."}],"paths":{"/v1/overview":{"get":{"tags":["Overview"],"summary":"Totals for a period","operationId":"get_overview","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"scope":{"type":"string"},"period":{"type":"object","properties":{"to":{"type":"string","format":"date-time"},"from":{"type":"string","format":"date-time"}}},"analyzed":{"type":"integer"},"avg_score":{"type":"number"},"total_calls":{"type":"integer"},"by_direction":{"type":"object","properties":{"incoming":{"type":"integer"},"outgoing":{"type":"integer"}}}}},"example":{"scope":"company","period":{"to":"2026-11-20T23:59:59+00:00","from":"2026-11-13T00:00:00+00:00"},"analyzed":201,"avg_score":41.2,"total_calls":375,"by_direction":{"incoming":61,"outgoing":314}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/timeline":{"get":{"tags":["Overview"],"summary":"Score over time (day/week)","operationId":"get_timeline","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"bucket","in":"query","schema":{"type":"string","enum":["day","week"]},"description":"Grouping step"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string","format":"date"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"}}}},"example":[{"bucket":"2026-11-20","analyzed":49,"avg_score":38.4},{"bucket":"2026-11-20","analyzed":41,"avg_score":41.4}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/heatmap":{"get":{"tags":["Overview"],"summary":"Activity and score by day × hour","operationId":"get_heatmap","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"dow":{"type":"integer"},"hour":{"type":"integer"},"calls":{"type":"integer"},"avg_score":{"type":"integer"}}}},"example":[{"dow":0,"hour":12,"calls":2,"avg_score":40},{"dow":0,"hour":14,"calls":1,"avg_score":40}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/period-compare":{"get":{"tags":["Overview"],"summary":"This period vs the previous one","operationId":"get_period_compare","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"current":{"type":"object","properties":{"analyzed":{"type":"integer"},"avg_score":{"type":"number"},"total_calls":{"type":"integer"}}},"previous":{"type":"object","properties":{"analyzed":{"type":"integer"},"avg_score":{"type":"integer"},"total_calls":{"type":"integer"}}}}},"example":{"current":{"analyzed":201,"avg_score":41.2,"total_calls":375},"previous":{"analyzed":196,"avg_score":42,"total_calls":393}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/calls":{"get":{"tags":["Calls"],"summary":"Call list (filters + pagination)","operationId":"get_calls","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"manager","in":"query","schema":{"type":"string"},"description":"Manager name as returned by `/team`"},{"name":"call_type","in":"query","schema":{"type":"string"},"description":"Call type name as returned by `/call-types/list`"},{"name":"direction","in":"query","schema":{"type":"string","enum":["incoming","outgoing"]},"description":"Call direction"},{"name":"min_score","in":"query","schema":{"type":"number"},"description":"Minimum score (0–100)"},{"name":"max_score","in":"query","schema":{"type":"number"},"description":"Maximum score (0–100)"},{"name":"only_analyzed","in":"query","schema":{"type":"boolean"},"description":"Analyzed calls only"},{"name":"min_duration_sec","in":"query","schema":{"type":"integer"},"description":"Minimum duration, seconds"},{"name":"limit","in":"query","schema":{"type":"integer"},"description":"Number of rows to return (max 200)"},{"name":"offset","in":"query","schema":{"type":"integer"},"description":"Number of rows to skip, for paging"},{"name":"with_summary","in":"query","schema":{"type":"boolean"},"description":"Include a short summary for every call"},{"name":"phone","in":"query","schema":{"type":"string"},"description":"Client phone number in any format (the last 9 digits are matched)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"calls":{"type":"array","items":{"type":"object","properties":{"score":{"type":"integer"},"call_id":{"type":"string","format":"uuid"},"summary":{"type":"string"},"call_url":{"type":"string"},"duration":{"type":"string"},"call_type":{"type":"string"},"direction":{"type":"string"},"department":{"type":"string"},"client_name":{"type":"string"},"client_phone":{"type":"string"},"manager_name":{"type":"string"},"call_datetime":{"type":"string","format":"date-time"},"sip_extension":{"type":"string"},"call_direction":{"type":"string"},"analysis_reason":{"nullable":true},"analysis_status":{"type":"string"}}}},"limit":{"type":"integer"},"total":{"type":"integer"},"offset":{"type":"integer"},"returned":{"type":"integer"}}},"example":{"calls":[{"score":72,"call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок.","call_url":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","duration":"03:42","call_type":"Перший дзвінок","direction":"incoming","department":"Відділ продажів","client_name":"Клієнт","client_phone":"+380501234567","manager_name":"Андрій Мельник","call_datetime":"2026-11-20T10:15:00+00:00","sip_extension":"101","call_direction":"incoming","analysis_reason":null,"analysis_status":"analyzed"}],"limit":2,"total":375,"offset":0,"returned":2}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Paging: `limit` and `offset`; the response has `total` (all rows) and `returned` (rows in this page)."}},"/v1/calls/{id}":{"get":{"tags":["Calls"],"summary":"Full call analysis","operationId":"get_calls_id","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"string"},"call_id":{"type":"string","format":"uuid"},"summary":{"type":"string"},"call_url":{"type":"string"},"duration":{"type":"string"},"call_type":{"type":"string"},"direction":{"type":"string"},"department":{"nullable":true},"client_name":{"nullable":true},"client_phone":{"type":"string"},"core_metrics":{"type":"object","properties":{"next_action":{"nullable":true},"rejection_reason":{"nullable":true},"needs_identification":{"nullable":true}}},"manager_name":{"type":"string"},"call_datetime":{"type":"string","format":"date-time"},"sip_extension":{"type":"string"},"transcription":{"type":"string"},"analysis_stage":{"nullable":true},"call_direction":{"type":"string"},"custom_metrics":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"value":{"type":"string"},"details":{"type":"string"}}}},"analysis_reason":{"nullable":true},"analysis_status":{"type":"string"},"analysis_reason_code":{"nullable":true}}},"example":{"score":"72","call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок.","call_url":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","duration":"03:42","call_type":"Перший дзвінок","direction":"outgoing","department":null,"client_name":null,"client_phone":"+380501234567","core_metrics":{"next_action":null,"rejection_reason":null,"needs_identification":null},"manager_name":"Андрій Мельник","call_datetime":"2026-11-20T10:15:00+00:00","sip_extension":"101","transcription":"Менеджер: Добрий день! Чим можу допомогти?\nКлієнт: Доброго дня, цікавлять умови.","analysis_stage":null,"call_direction":"outgoing","custom_metrics":[{"name":"Олена Коваль","value":"Так","details":"Пояснення оцінки"}],"analysis_reason":null,"analysis_status":"analyzed","analysis_reason_code":null}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/calls/{id}/transcript":{"get":{"tags":["Calls"],"summary":"Call transcript","operationId":"get_calls_id_transcript","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"call_url":{"type":"string"},"duration":{"type":"string"},"direction":{"type":"string"},"department":{"nullable":true},"client_name":{"nullable":true},"client_phone":{"type":"string"},"manager_name":{"type":"string"},"call_datetime":{"type":"string","format":"date-time"},"sip_extension":{"type":"string"},"transcription":{"type":"string"},"call_direction":{"type":"string"}}},"example":{"call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","call_url":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","duration":"03:42","direction":"outgoing","department":null,"client_name":null,"client_phone":"+380501234567","manager_name":"Андрій Мельник","call_datetime":"2026-11-20T10:15:00+00:00","sip_extension":"101","transcription":"Менеджер: Добрий день! Чим можу допомогти?\nКлієнт: Доброго дня, цікавлять умови.","call_direction":"outgoing"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/transcripts":{"get":{"tags":["Calls"],"summary":"Batch of transcripts (limit is required)","operationId":"get_transcripts","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"limit","in":"query","required":true,"schema":{"type":"integer","maximum":200},"description":"Number of rows to return (max 200)"},{"name":"offset","in":"query","schema":{"type":"integer"},"description":"Number of rows to skip, for paging"},{"name":"manager","in":"query","schema":{"type":"string"},"description":"Manager name as returned by `/team`"},{"name":"call_type","in":"query","schema":{"type":"string"},"description":"Call type name as returned by `/call-types/list`"},{"name":"min_score","in":"query","schema":{"type":"number"},"description":"Minimum score (0–100)"},{"name":"max_score","in":"query","schema":{"type":"number"},"description":"Maximum score (0–100)"},{"name":"phone","in":"query","schema":{"type":"string"},"description":"Client phone number in any format (the last 9 digits are matched)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"calls":{"type":"array","items":{"type":"object","properties":{"score":{"type":"string"},"call_id":{"type":"string","format":"uuid"},"summary":{"type":"string"},"call_url":{"type":"string"},"duration":{"type":"string"},"call_type":{"type":"string"},"direction":{"type":"string"},"department":{"type":"string"},"client_name":{"type":"string"},"client_phone":{"type":"string"},"manager_name":{"type":"string"},"call_datetime":{"type":"string","format":"date-time"},"sip_extension":{"type":"string"},"transcription":{"type":"string"},"call_direction":{"type":"string"},"analysis_status":{"type":"string"}}}},"total":{"type":"integer"},"offset":{"type":"integer"},"returned":{"type":"integer"}}},"example":{"calls":[{"score":"72","call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок.","call_url":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","duration":"03:42","call_type":"Перший дзвінок","direction":"incoming","department":"Відділ продажів","client_name":"Клієнт","client_phone":"+380501234567","manager_name":"Андрій Мельник","call_datetime":"2026-11-20T10:15:00+00:00","sip_extension":"101","transcription":"Менеджер: Добрий день! Чим можу допомогти?\nКлієнт: Доброго дня, цікавлять умови.","call_direction":"incoming","analysis_status":"analyzed"}],"total":228,"offset":0,"returned":2}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Heavy method: its own limit of 20 requests per minute.\n\nPaging: `limit` and `offset`; the response has `total` (all rows) and `returned` (rows in this page)."}},"/v1/calls/{id}/reanalyze":{"post":{"tags":["Calls"],"summary":"Run the analysis again","operationId":"post_calls_id_reanalyze","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `manage_calls` scope (set when the key is created).\n\nHeavy method: its own limit of 20 requests per minute.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{"call_type":"Перший дзвінок"}}}}}},"/v1/team":{"get":{"tags":["Managers"],"summary":"Managers (name, user_id, number of calls)","operationId":"get_team","security":[{"bearerAuth":[]}],"parameters":[{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"calls":{"type":"integer"},"user_id":{"type":"string","format":"uuid"},"manager_name":{"type":"string"}}}},"example":[{"calls":2590,"user_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","manager_name":"Андрій Мельник"},{"calls":2428,"user_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","manager_name":"Андрій Мельник"}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/managers":{"get":{"tags":["Managers"],"summary":"Manager summary","operationId":"get_managers","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"calls":{"type":"integer"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"},"manager_name":{"type":"string"}}}},"example":[{"calls":141,"analyzed":88,"avg_score":41.2,"manager_name":"Олена Коваль"},{"calls":118,"analyzed":56,"avg_score":20,"manager_name":"Андрій Мельник"}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/managers/ranking":{"get":{"tags":["Managers"],"summary":"Leaderboard","operationId":"get_managers_ranking","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"by","in":"query","schema":{"type":"string","enum":["score","calls"]},"description":"What to rank by"},{"name":"min_calls","in":"query","schema":{"type":"integer"},"description":"Minimum calls to be ranked"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"calls":{"type":"integer"},"manager":{"type":"string"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"}}}},"example":[{"calls":4,"manager":"Олена Коваль","analyzed":4,"avg_score":67.2},{"calls":8,"manager":"Андрій Мельник","analyzed":6,"avg_score":53.1}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/managers/{name}":{"get":{"tags":["Managers"],"summary":"Manager deep dive","operationId":"get_managers_name","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"Name (URL-encoded)"},{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"best":{"type":"array","items":{"type":"object","properties":{"score":{"type":"string"},"call_id":{"type":"string","format":"uuid"},"summary":{"type":"string"}}}},"calls":{"type":"integer"},"worst":{"type":"array","items":{"type":"object","properties":{"score":{"type":"string"},"call_id":{"type":"string","format":"uuid"},"summary":{"nullable":true}}}},"weekly":{"type":"array","items":{"type":"object","properties":{"week":{"type":"string","format":"date"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"}}}},"by_type":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"calls":{"type":"integer"},"avg_score":{"type":"number"}}}},"manager":{"type":"string"},"analyzed":{"type":"integer"},"avg_score":{"type":"integer"},"talk_ratio":{"type":"object","properties":{"client_avg_pct":{"type":"number"},"manager_avg_pct":{"type":"number"}}}}},"example":{"best":[{"score":"72","call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок."}],"calls":56,"worst":[{"score":"72","call_id":"8c4d1b7a-2e6f-4a93-b5d0-1f9e3c7a6b42","summary":null}],"weekly":[{"week":"2026-11-20","analyzed":54,"avg_score":47.6}],"by_type":[{"type":"list","calls":27,"avg_score":51.4}],"manager":"Олена Коваль","analyzed":56,"avg_score":20,"talk_ratio":{"client_avg_pct":37.3,"manager_avg_pct":54.8}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/departments":{"get":{"tags":["Departments"],"summary":"Departments: leads and members","operationId":"get_departments","security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string"},"team_lead":{"type":"string"},"team_leads":{"type":"array","items":{"type":"string"}},"members_count":{"type":"integer"},"members":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"}}}}}}},"example":[{"id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","name":"Відділ продажів","description":"Вхідні заявки","team_lead":"Олена Коваль","team_leads":["Олена Коваль"],"members_count":2,"members":[{"name":"Андрій Мельник","role":"agent"},{"name":"Олена Коваль","role":"admin"}]}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/departments/stats":{"get":{"tags":["Departments"],"summary":"Statistics by department: calls, score, managers","operationId":"get_departments_stats","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"department":{"type":"string"},"members_count":{"type":"integer"},"calls":{"type":"integer"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"},"members":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"calls":{"type":"integer"},"analyzed":{"type":"integer"},"avg_score":{"type":"number"}}}}}}},"example":[{"department":"Відділ продажів","members_count":2,"calls":184,"analyzed":97,"avg_score":68.4,"members":[{"name":"Андрій Мельник","calls":102,"analyzed":55,"avg_score":71.2}]}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/clients/history":{"get":{"tags":["Clients"],"summary":"Client history: all calls with a phone number","operationId":"get_clients_history","security":[{"bearerAuth":[]}],"parameters":[{"name":"phone","in":"query","schema":{"type":"string"},"description":"Client phone number in any format (the last 9 digits are matched)","required":true},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD; without it, the whole history"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"limit","in":"query","schema":{"type":"integer"},"description":"Number of calls to return (max 100, default 50)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"phone_query":{"type":"string"},"matched_suffix":{"type":"string"},"total_calls":{"type":"integer"},"shown":{"type":"integer"},"calls":{"type":"array","items":{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"call_datetime":{"type":"string","format":"date-time"},"direction":{"type":"string"},"manager_name":{"type":"string"},"department":{"type":"string"},"sip_extension":{"type":"string"},"client_phone":{"type":"string"},"client_name":{"type":"string"},"duration":{"type":"string"},"call_type":{"type":"string"},"analysis_status":{"type":"string"},"analysis_reason":{"nullable":true},"score":{"type":"integer"},"summary":{"type":"string"},"call_url":{"type":"string"},"call_direction":{"type":"string"},"date":{"type":"string","format":"date-time"},"manager":{"type":"string"}}}}}},"example":{"phone_query":"+380501234567","matched_suffix":"501234567","total_calls":3,"shown":1,"calls":[{"call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","call_datetime":"2026-11-20T10:15:00+00:00","direction":"incoming","manager_name":"Андрій Мельник","department":"Відділ продажів","sip_extension":"101","client_phone":"+380501234567","client_name":"Клієнт","duration":"03:42","call_type":"Перший дзвінок","analysis_status":"analyzed","analysis_reason":null,"score":72,"summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок.","call_url":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","call_direction":"incoming","date":"2026-11-20T10:15:00+00:00","manager":"Андрій Мельник"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/call-types/list":{"get":{"tags":["Call types"],"summary":"Active call types","operationId":"get_call_types_list","security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"for_meeting":{"type":"boolean"}}}},"example":[{"id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","name":"Перший дзвінок","for_meeting":true},{"id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","name":"Перший дзвінок","for_meeting":false}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/call-types":{"get":{"tags":["Call types"],"summary":"Statistics by call type","operationId":"get_call_types","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"calls":{"type":"integer"},"avg_score":{"type":"number"}}}},"example":[{"type":"list","calls":108,"avg_score":44.5},{"type":"list","calls":30,"avg_score":29.5}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/call-types/config":{"get":{"tags":["Call types"],"summary":"Call type configuration (filters/weights)","operationId":"get_call_types_config","security":[{"bearerAuth":[]}],"parameters":[{"name":"call_type","in":"query","schema":{"type":"string"},"description":"Call type name as returned by `/call-types/list`"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"filters":{"type":"object","properties":{"direction":{"type":"string"},"filter_logic":{"type":"string"},"filter_action":{"type":"string"},"call_check_mode":{"type":"string"},"min_duration_sec":{"type":"integer"},"duration_condition":{"type":"string"},"target_call_numbers":{"type":"array","items":{"type":"integer"}},"call_direction":{"type":"string"}}},"metrics":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"weight":{"nullable":true},"in_scoring":{"type":"boolean"},"description":{"type":"string"}}}},"scoring":{"type":"object","properties":{"use_weights":{"type":"boolean"},"use_sum_score":{"type":"boolean"}}},"for_meeting":{"type":"boolean"},"output_language":{"type":"string"},"ai_selector_summary":{"type":"string"}}}},"example":[{"type":"list","filters":{"direction":"incoming","filter_logic":"both_conditions","filter_action":"analyze_if","call_check_mode":"specific_call","min_duration_sec":24,"duration_condition":"more_than","target_call_numbers":[1],"call_direction":"incoming"},"metrics":[{"name":"Перший дзвінок","type":"text","weight":null,"in_scoring":false,"description":"Чи з'ясував менеджер потребу клієнта"}],"scoring":{"use_weights":false,"use_sum_score":true},"for_meeting":true,"output_language":"uk","ai_selector_summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок."},{"type":"list","filters":{"direction":"incoming","filter_logic":"both_conditions","filter_action":"analyze_if","call_check_mode":"specific_call","min_duration_sec":24,"duration_condition":"more_than","target_call_numbers":[1],"call_direction":"incoming"},"metrics":[{"name":"Перший дзвінок","type":"list","weight":null,"in_scoring":true,"description":null}],"scoring":{"use_weights":false,"use_sum_score":true},"for_meeting":false,"output_language":"uk","ai_selector_summary":"Клієнт цікавився умовами, менеджер уточнив потребу й домовився про наступний крок."}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/metrics":{"get":{"tags":["Metrics"],"summary":"Checklist metric definitions","operationId":"get_metrics","security":[{"bearerAuth":[]}],"parameters":[{"name":"call_type","in":"query","schema":{"type":"string"},"description":"Call type name as returned by `/call-types/list`"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string"},"group":{"type":"string"},"config":{"type":"string"},"weight":{"nullable":true},"options":{"type":"array","items":{}},"subgroup":{"nullable":true},"is_active":{"type":"boolean"},"metric_id":{"type":"string"},"in_scoring":{"type":"boolean"},"description":{"type":"string"}}}},"example":[{"id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","name":"Виявлення потреби","type":"text","group":"overview","config":"Перший дзвінок","weight":null,"options":[],"subgroup":null,"is_active":true,"metric_id":"Виявлення потреби","in_scoring":false,"description":"Чи з'ясував менеджер потребу клієнта"},{"id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","name":"Виявлення потреби","type":"text","group":"overview","config":"Перший дзвінок","weight":null,"options":[],"subgroup":null,"is_active":true,"metric_id":"Виявлення потреби","in_scoring":false,"description":"Чи з'ясував менеджер потребу клієнта"}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"tags":["Metrics (write)"],"summary":"Create a metric","operationId":"post_metrics","security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `write_metrics` scope (set when the key is created).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"call_type":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"description":{"type":"string"},"weight":{"type":"number"},"include_in_scoring":{"type":"boolean"},"options":{"type":"array","items":{}}}},"example":{"call_type":"Перший дзвінок","name":"Запропонував зустріч","type":"list","description":"Чи запропонував менеджер зустріч або дзвінок","weight":10,"include_in_scoring":true,"options":["Так","Ні"]}}}}}},"/v1/metrics/stats":{"get":{"tags":["Metrics"],"summary":"Metric value distribution","operationId":"get_metrics_stats","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"metric","in":"query","schema":{"type":"string"},"description":"Metric name as returned by `/metrics`"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"total":{"type":"integer"},"metric":{"type":"string"},"values":{"type":"object","properties":{"Зараз":{"type":"integer"},"Виконано":{"type":"integer"},"Олена Коваль":{"type":"integer"},"Відкладено":{"type":"integer"},"Не виконано":{"type":"integer"}}}}}},"example":[{"total":118,"metric":"Виявлення потреби","values":{"Зараз":4,"Виконано":8,"Олена Коваль":10,"Відкладено":4,"Не виконано":99}},{"total":108,"metric":"Виявлення потреби","values":{"Виконано":21,"Не виконано":87}}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/metrics/failing":{"get":{"tags":["Metrics"],"summary":"Most failed checklist items","operationId":"get_metrics_failing","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"count":{"type":"integer"},"metric":{"type":"string"},"avg_pct":{"type":"integer"}}}},"example":[{"count":118,"metric":"Виявлення потреби","avg_pct":10},{"count":28,"metric":"Виявлення потреби","avg_pct":15.2}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/metrics/detail":{"get":{"tags":["Metrics"],"summary":"One metric broken down by manager and call type","operationId":"get_metrics_detail","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"metric","in":"query","required":true,"schema":{"type":"string"},"description":"Metric name as returned by `/metrics`"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"metric":{"type":"string"},"by_type":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"values":{"type":"object","properties":{"Олена Коваль":{"type":"integer"}}}}}},"overall":{"type":"object","properties":{"Олена Коваль":{"type":"integer"},"Андрій Мельник":{"type":"integer"}}},"by_manager":{"type":"array","items":{"type":"object","properties":{"values":{"type":"object","properties":{"Олена Коваль":{"type":"integer"}}},"manager":{"type":"string"}}}}}},"example":{"total":2,"metric":"Виявлення потреби","by_type":[{"type":"list","values":{"Олена Коваль":1}}],"overall":{"Олена Коваль":1,"Андрій Мельник":1},"by_manager":[{"values":{"Олена Коваль":1},"manager":"Олена Коваль"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/metrics/top":{"get":{"tags":["Metrics"],"summary":"Top values of a core metric","operationId":"get_metrics_top","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"field","in":"query","required":true,"schema":{"type":"string","enum":["rejection_reason","needs_identification","next_action","benefits_mentioned"]},"description":"Which core metric to show"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{}},"example":[]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/quality/talk-ratio":{"get":{"tags":["Quality"],"summary":"Manager/client talk balance","operationId":"get_quality_talk_ratio","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"manager","in":"query","schema":{"type":"string"},"description":"Manager name as returned by `/team`"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"samples":{"type":"integer"},"avg_client_pct":{"type":"number"},"overtalk_calls":{"type":"array","items":{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"manager_pct":{"type":"integer"},"manager_name":{"type":"string"}}}},"overtalk_total":{"type":"integer"},"avg_manager_pct":{"type":"integer"}}},"example":{"samples":201,"avg_client_pct":36.2,"overtalk_calls":[{"call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","manager_pct":40,"manager_name":"Андрій Мельник"}],"overtalk_total":37,"avg_manager_pct":23}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/quality/stop-words":{"get":{"tags":["Quality"],"summary":"Filler words / stop words","operationId":"get_quality_stop_words","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{}},"example":[]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/managers":{"get":{"tags":["Portal analytics"],"summary":"Manager statistics and working time, as in “Manager statistics” and “Working time analysis” in the portal","operationId":"get_analytics_managers","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"break_minutes","in":"query","schema":{"type":"integer"},"description":"Break threshold, minutes (default 5)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"talk_threshold_seconds":{"nullable":true},"break_threshold_minutes":{"type":"integer"},"managers":{"type":"array","items":{"type":"object","properties":{"manager_id":{"type":"string","format":"uuid"},"manager_name":{"type":"string"},"total_calls":{"type":"integer"},"missed_calls":{"type":"integer"},"short_calls":{"type":"integer"},"long_calls":{"type":"integer"},"answered_calls":{"type":"integer"},"missed_rate":{"type":"number"},"answer_rate":{"type":"number"},"average_duration_seconds":{"type":"number"},"total_duration_seconds":{"type":"integer"},"first_call_time":{"type":"string","format":"date-time"},"last_call_time":{"type":"string","format":"date-time"},"work_duration_seconds":{"type":"integer"},"total_wait_time_seconds":{"type":"integer"},"break_count":{"type":"integer"},"break_duration_seconds":{"type":"integer"},"talks_over":{"type":"integer"}}}}}},"example":{"talk_threshold_seconds":null,"break_threshold_minutes":5,"managers":[{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","manager_name":"Андрій Мельник","total_calls":584,"missed_calls":251,"short_calls":230,"long_calls":103,"answered_calls":334,"missed_rate":41.6,"answer_rate":54.4,"average_duration_seconds":65.6,"total_duration_seconds":40658,"first_call_time":"2026-11-20T10:15:00+00:00","last_call_time":"2026-11-20T10:15:00+00:00","work_duration_seconds":244088,"total_wait_time_seconds":6120,"break_count":180,"break_duration_seconds":176244,"talks_over":0}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/managers/daily":{"get":{"tags":["Portal analytics"],"summary":"Daily statistics by manager","operationId":"get_analytics_managers_daily","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"manager_id":{"type":"string","format":"uuid"},"date":{"type":"string","format":"date"},"total_calls":{"type":"integer"},"missed_calls":{"type":"integer"},"short_calls":{"type":"integer"},"long_calls":{"type":"integer"},"answered_calls":{"type":"integer"},"total_duration_seconds":{"type":"integer"},"average_duration_seconds":{"type":"number"},"manager_name":{"type":"string"}}}},"example":[{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","date":"2026-11-20","total_calls":29,"missed_calls":17,"short_calls":9,"long_calls":7,"answered_calls":12,"total_duration_seconds":796,"average_duration_seconds":27.9,"manager_name":"Андрій Мельник"},{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","date":"2026-11-20","total_calls":7,"missed_calls":10,"short_calls":7,"long_calls":1,"answered_calls":8,"total_duration_seconds":185,"average_duration_seconds":26.1,"manager_name":"Андрій Мельник"}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/managers/hourly":{"get":{"tags":["Portal analytics"],"summary":"Hourly statistics by manager","operationId":"get_analytics_managers_hourly","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"manager_id":{"type":"string","format":"uuid"},"date":{"type":"string","format":"date"},"total_calls":{"type":"integer"},"missed_calls":{"type":"integer"},"short_calls":{"type":"integer"},"long_calls":{"type":"integer"},"answered_calls":{"type":"integer"},"total_duration_seconds":{"type":"integer"},"average_duration_seconds":{"type":"integer"},"hour":{"type":"integer"},"manager_name":{"type":"string"}}}},"example":[{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","date":"2026-11-20","total_calls":6,"missed_calls":4,"short_calls":4,"long_calls":0,"answered_calls":4,"total_duration_seconds":67,"average_duration_seconds":13,"hour":16,"manager_name":"Андрій Мельник"},{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","date":"2026-11-20","total_calls":6,"missed_calls":10,"short_calls":5,"long_calls":0,"answered_calls":5,"total_duration_seconds":94,"average_duration_seconds":17.2,"hour":12,"manager_name":"Андрій Мельник"}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/managers/{id}/worktime":{"get":{"tags":["Portal analytics"],"summary":"Working time and breaks of a manager, day by day","operationId":"get_analytics_managers_id_worktime","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"manager_id":{"type":"string","format":"uuid"},"manager_name":{"type":"string"},"break_threshold_minutes":{"type":"integer"},"days":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"manager_id":{"type":"string","format":"uuid"},"total_calls":{"type":"integer"},"first_call_time":{"type":"string","format":"date-time"},"last_call_time":{"type":"string","format":"date-time"},"work_duration_seconds":{"type":"integer"},"total_duration_seconds":{"type":"integer"},"total_wait_time_seconds":{"type":"integer"},"break_count":{"type":"integer"},"break_duration_seconds":{"type":"integer"}}}}}},"example":{"manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","manager_name":"Андрій Мельник","break_threshold_minutes":5,"days":[{"date":"2026-11-20","manager_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","total_calls":7,"first_call_time":"2026-11-20T10:15:00+00:00","last_call_time":"2026-11-20T10:15:00+00:00","work_duration_seconds":11851,"total_duration_seconds":185,"total_wait_time_seconds":89,"break_count":9,"break_duration_seconds":11323}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Heavy method: its own limit of 20 requests per minute."}},"/v1/analytics/daily":{"get":{"tags":["Portal analytics"],"summary":"Daily call statistics of the company","operationId":"get_analytics_daily","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"total_calls":{"type":"integer"},"missed_calls":{"type":"integer"},"short_calls":{"type":"integer"},"long_calls":{"type":"integer"},"answered_calls":{"type":"integer"},"total_duration_seconds":{"type":"integer"},"average_duration_seconds":{"type":"integer"},"missed_rate":{"type":"number"},"answer_rate":{"type":"number"}}}},"example":[{"date":"2026-11-20","total_calls":38,"missed_calls":21,"short_calls":12,"long_calls":5,"answered_calls":17,"total_duration_seconds":5060,"average_duration_seconds":100,"missed_rate":53.2,"answer_rate":42.8},{"date":"2026-11-20","total_calls":45,"missed_calls":28,"short_calls":10,"long_calls":7,"answered_calls":17,"total_duration_seconds":5630,"average_duration_seconds":100,"missed_rate":58.7,"answer_rate":37.3}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/hourly":{"get":{"tags":["Portal analytics"],"summary":"Calls by hour of day","operationId":"get_analytics_hourly","security":[{"bearerAuth":[]}],"parameters":[{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date YYYY-MM-DD (as in the portal)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date YYYY-MM-DD, inclusive"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"hour":{"type":"integer"},"total_calls":{"type":"integer"},"missed_calls":{"type":"integer"},"short_calls":{"type":"integer"},"long_calls":{"type":"integer"},"answered_calls":{"type":"integer"},"answer_rate":{"type":"integer"}}}},"example":[{"hour":0,"total_calls":3,"missed_calls":3,"short_calls":0,"long_calls":0,"answered_calls":0,"answer_rate":0},{"hour":7,"total_calls":1,"missed_calls":0,"short_calls":0,"long_calls":1,"answered_calls":1,"answer_rate":40}]}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/missed":{"get":{"tags":["Portal analytics"],"summary":"Missed calls and callbacks, as in “Analytics → Missed”","operationId":"get_analytics_missed","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"status","in":"query","schema":{"type":"string","enum":["responded","not_responded"]},"description":"Whether the client was called back"},{"name":"manager","in":"query","schema":{"type":"string"},"description":"Manager name as returned by `/team`"},{"name":"limit","in":"query","schema":{"type":"integer"},"description":"Number of rows to return (max 200)"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"період":{"type":"object","properties":{"з":{"type":"string","format":"date"},"по":{"type":"string","format":"date"}}},"дзвінки":{"type":"array","items":{"type":"object","properties":{"call_id":{"type":"string","format":"uuid"},"лінк":{"type":"string"},"відділ":{"nullable":true},"дата_час":{"type":"string"},"передзвонили":{"type":"boolean"},"номер_клієнта":{"type":"string"},"відповідальний":{"nullable":true},"на_кого_прийшов":{"type":"string"},"час_до_передзвону_хв":{"nullable":true}}}},"визначення":{"type":"string"},"передзвонили":{"type":"integer"},"по_менеджерах":{"type":"array","items":{"type":"object","properties":{"відділ":{"nullable":true},"пропущених":{"type":"integer"},"передзвонили":{"type":"integer"},"без_передзвону":{"type":"integer"},"відповідальний":{"type":"string"},"середній_час_передзвону_хв":{"type":"integer"}}}},"без_передзвону":{"type":"integer"},"всього_пропущених":{"type":"integer"},"показано_дзвінків":{"type":"integer"},"відсоток_передзвонів":{"type":"integer"},"середній_час_передзвону_хв":{"type":"integer"}}},"example":{"період":{"з":"2026-11-20","по":"2026-11-20"},"дзвінки":[{"call_id":"3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","лінк":"https://app.soldly.ai/calls/3f2a9c1e-5b7d-4e2a-9c41-7d1e0a6b8f25","відділ":null,"дата_час":"20.11.2026 10:15","передзвонили":false,"номер_клієнта":"+380501234567","відповідальний":null,"на_кого_прийшов":"Олена Коваль","час_до_передзвону_хв":null}],"визначення":"Пропущений — вхідний дзвінок без відповіді","передзвонили":19,"по_менеджерах":[{"відділ":null,"пропущених":11,"передзвонили":7,"без_передзвону":10,"відповідальний":"Олена Коваль","середній_час_передзвону_хв":40}],"без_передзвону":11,"всього_пропущених":30,"показано_дзвінків":12,"відсоток_передзвонів":26,"середній_час_передзвону_хв":120}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/analytics/talk-time":{"get":{"tags":["Portal analytics"],"summary":"Talk hours by manager","operationId":"get_analytics_talk_time","security":[{"bearerAuth":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer"},"description":"Last N days (default 30)"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Start date (ISO)"},{"name":"to","in":"query","schema":{"type":"string"},"description":"End date (ISO)"},{"name":"min_answer_sec","in":"query","schema":{"type":"integer"},"description":"Count conversations from this many seconds"},{"name":"department","in":"query","schema":{"type":"string"},"description":"Department name as returned by `/departments` (a part of the name is enough)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","properties":{"legend":{"type":"string"},"totals":{"type":"object","properties":{"calls":{"type":"integer"},"answered":{"type":"integer"},"managers":{"type":"integer"},"talk_hours":{"type":"number"},"talk_minutes":{"type":"integer"}}},"managers":{"type":"array","items":{"type":"object","properties":{"calls":{"type":"integer"},"manager":{"type":"string"},"answered":{"type":"integer"},"no_answer":{"type":"integer"},"in_minutes":{"type":"number"},"talk_hours":{"type":"number"},"longest_sec":{"type":"integer"},"out_minutes":{"type":"integer"},"talk_minutes":{"type":"integer"},"answer_rate_pct":{"type":"number"},"avg_answered_sec":{"type":"integer"}}}}}},"example":{"legend":"Пояснення до показників","totals":{"calls":375,"answered":234,"managers":7,"talk_hours":32.6,"talk_minutes":100},"managers":[{"calls":141,"manager":"Олена Коваль","answered":108,"no_answer":33,"in_minutes":53.9,"talk_hours":11.6,"longest_sec":1474,"out_minutes":100,"talk_minutes":100,"answer_rate_pct":71.9,"avg_answered_sec":51}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/metrics/{id}":{"patch":{"tags":["Metrics (write)"],"summary":"Update a metric","operationId":"patch_metrics_id","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `write_metrics` scope (set when the key is created).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"weight":{"type":"number"},"include_in_scoring":{"type":"boolean"}}},"example":{"description":"Оновлений опис критерію","weight":15}}}}}},"/v1/metrics/{id}/toggle":{"post":{"tags":["Metrics (write)"],"summary":"Enable or disable a metric","operationId":"post_metrics_id_toggle","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier (UUID)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `write_metrics` scope (set when the key is created).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}}},"example":{"active":false}}}}}},"/v1/call-types/{name}/filters":{"patch":{"tags":["Call types (write)"],"summary":"Change call type filters","operationId":"patch_call_types_name_filters","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"Name (URL-encoded)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `write_config` scope (set when the key is created).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"direction":{"type":"string"},"min_duration_sec":{"type":"integer"},"target_call_numbers":{"type":"array","items":{}},"filter_action":{"type":"string"}}},"example":{"direction":"incoming","min_duration_sec":30}}}}}},"/v1/call-types/{name}/toggle":{"post":{"tags":["Call types (write)"],"summary":"Enable or disable a call type","operationId":"post_call_types_name_toggle","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"Name (URL-encoded)"}],"responses":{"200":{"description":"Successful response","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"description":"Requires the `write_config` scope (set when the key is created).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}}},"example":{"active":true}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Company access key. Paste the key itself, without the word Bearer."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"What happened"},"code":{"type":"string","description":"Stable machine-readable error code","enum":["missing_key","invalid_key","key_expired","ip_not_allowed","insufficient_scope","company_key_required","plan_required","rate_limited","unknown_endpoint","not_found","manager_not_found","call_not_found","invalid_phone","invalid_call_id","invalid_parameters","unavailable","internal_error"]},"request_id":{"type":"string","description":"Request number for support"}}}},"headers":{"X-RateLimit-Limit":{"description":"Requests per minute allowed for this method","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Seconds until the limit resets","schema":{"type":"integer"}}},"responses":{"BadRequest":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Invalid request parameters","code":"invalid_parameters","request_id":"01JD8Z6K3V"}}}},"Unauthorized":{"description":"The key is missing, invalid or expired","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Invalid or inactive key","code":"invalid_key","request_id":"01JD8Z6K3V"}}}},"Forbidden":{"description":"Insufficient permissions, or the request comes from an IP outside the allow list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Insufficient permissions: scope 'write_metrics' required","code":"insufficient_scope","request_id":"01JD8Z6K3V"}}}},"NotFound":{"description":"Not found or does not belong to your company","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Not found or does not belong to your company","code":"not_found","request_id":"01JD8Z6K3V"}}}},"TooManyRequests":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":"Rate limit exceeded: 120 requests per minute","code":"rate_limited","request_id":"01JD8Z6K3V"}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}}}}}}