{"openapi":"3.0.0","info":{"title":"Chatbots service API","description":"Using the API for Chatbots, you can integrate your system with SendPulse\u2019s chatbots service and get detailed information about your account, bots, dialogs.\n\n            \nOn the right, there is a button for authorizing requests made on this page. Click \u201cAuthorize,\u201d then insert the ID and Secret from your account.\n\n            \nTo perform a request directly from the page, click the \"Try it out\" button within each method block. Then fill in input fields if any (for URL parameters, the description is right below the URL request; for body parameters, the description is under the \u201cScheme\u201d button to the right of the example), and click \u201cRun.\u201d You'll find the server response and description of received parameters below.\n        ","version":"0.0.1"},"servers":[{"url":"https:\/\/api.sendpulse.com\/chatbots","description":""}],"tags":[{"name":"dialogs","description":""},{"name":"account","description":""},{"name":"bots","description":""},{"name":"operator-groups","description":""},{"name":"operators","description":""}],"paths":{"\/dialogs":{"get":{"summary":"Get dialogs list info","description":"Returns information about your dialogs from all channels","security":[{"Authorization by API key":[]}],"tags":["dialogs"],"parameters":[{"in":"query","name":"size","description":"The limit of pagination items that will be returned","schema":{"type":"integer"}},{"in":"query","name":"skip","description":"The offset of pagination items, indicating where the current batch starts","schema":{"type":"integer"}},{"in":"query","name":"search_after","description":"The ID of the last_inbox_message element after which elements will be returned","schema":{"type":"string"}},{"in":"query","name":"order","description":"Sort order ASC or DESC","schema":{"type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"list":{"type":"array","items":{"$ref":"#\/components\/schemas\/Dialog"}},"sort":{"type":"object"},"total":{"type":"integer"},"size":{"type":"integer"},"search_after":{"type":"string"},"order":{"type":"string","enum":["asc","desc"]}}}},"type":"object"}}}}}}},"\/account":{"get":{"summary":"Get account info","description":"Returns information about your current account pricing plan, the number of messages in your plan, bots, contacts, list of tags, and variables","security":[{"Authorization by API key":[]}],"tags":["account"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/Account"}},"type":"object"}}}}}}},"\/operators":{"get":{"summary":"Get a list of operators","description":"Returns the list of operators available on the account (the account owner and all active related operators) with information about each: user ID, username, email, avatar, and online status","security":[{"Authorization by API key":[]}],"tags":["operators"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Operator"}}}}}}}}}},"\/operator-groups":{"get":{"summary":"Get a list of operator groups","description":"Returns the list of operator groups created on the account with information about each: group ID, name, and the account owner's user ID","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/OperatorGroup"}}}}}}}}},"post":{"summary":"Create an operator group","description":"Creates a new operator group with the given name","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/OperatorGroup"}}}}}},"422":{"description":"Returned when the request is invalid, e.g. the name is missing, exceeds 255 characters, or an operator group with this name already exists"}}}},"\/operator-groups\/{operator_group}":{"put":{"summary":"Update an operator group","description":"Updates the name of the selected operator group","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"parameters":[{"in":"path","name":"operator_group","required":true,"description":"The operator group ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":255}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#\/components\/schemas\/OperatorGroup"}}}}}},"404":{"description":"Returned when the operator group with the given ID doesn't exist"},"422":{"description":"Returned when the request is invalid, e.g. the name is missing, exceeds 255 characters, or an operator group with this name already exists"}}},"delete":{"summary":"Delete an operator group","description":"Deletes the selected operator group along with all its members","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"parameters":[{"in":"path","name":"operator_group","required":true,"description":"The operator group ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"boolean"}}}}}},"404":{"description":"Returned when the operator group with the given ID doesn't exist"}}}},"\/operator-groups\/{operator_group}\/members":{"get":{"summary":"Get a list of operator group members","description":"Returns the list of members of the selected operator group with information about each: member ID, operator ID, auto distribution settings, and operator profile data","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"parameters":[{"in":"path","name":"operator_group","required":true,"description":"The operator group ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/OperatorGroupMember"}}}}}}},"404":{"description":"Returned when the operator group with the given ID doesn't exist"}}},"post":{"summary":"Add members to an operator group","description":"Adds the selected operators to the operator group. Operators already in the group are skipped","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"parameters":[{"in":"path","name":"operator_group","required":true,"description":"The operator group ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application\/json":{"schema":{"type":"object","required":["operator_ids"],"properties":{"operator_ids":{"type":"array","minItems":1,"items":{"type":"integer"}}}}}}},"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"boolean"}}}}}},"404":{"description":"Returned when the operator group with the given ID doesn't exist"},"422":{"description":"Returned when the request is invalid, e.g. operator_ids is empty or contains an operator ID that doesn't exist on the account"}}}},"\/operator-groups\/{operator_group}\/members\/{operator_group_member}":{"delete":{"summary":"Remove a member from an operator group","description":"Removes the selected member from the operator group","security":[{"Authorization by API key":[]}],"tags":["operator-groups"],"parameters":[{"in":"path","name":"operator_group","required":true,"description":"The operator group ID","schema":{"type":"string"}},{"in":"path","name":"operator_group_member","required":true,"description":"The operator group member ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"boolean"}}}}}},"404":{"description":"Returned when the operator group or the member doesn't exist, or the member doesn't belong to the specified operator group"}}}},"\/bots":{"get":{"summary":"Get a list of connected bots","description":"Returns lists of bots with information about each: bot ID, channel information, number of received and unread messages, bot status, and creation date","security":[{"Authorization by API key":[]}],"tags":["bots"],"responses":{"200":{"description":"Operation successful","content":{"application\/json":{"schema":{"properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#\/components\/schemas\/Bot"}}},"type":"object"}}}}}}}},"components":{"securitySchemes":{"Authorization by API key":{"type":"http","scheme":"bearer","description":"Paste your API key in the format sp_apikey_*** from the https:\/\/login.sendpulse.com\/settings\/api section"}},"schemas":{"SuccessResponse":{"properties":{"success":{"type":"boolean"},"data":{"anyOf":[{"type":"array","items":{"type":"object"}},{"type":"object"},{"type":"boolean"}]}},"type":"object"},"Dialog":{"properties":{"_id":{"type":"string"},"bot_id":{"type":"string"},"contact":{"type":"object","properties":{"id":{"type":"string"},"full_name":{"type":"string"},"profile_pic":{"type":"string"}}},"last_inbox_message":{"type":"object","properties":{"text":{"type":"string"},"date":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"last_outbox_message":{"type":"object","properties":{"text":{"type":"string"},"date":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"service":{"type":"integer"},"user_id":{"type":"integer"},"inbox_unread_count":{"type":"integer"},"is_chat_opened":{"type":"boolean"},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"},"updated_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}},"Account":{"properties":{"tariff":{"type":"object","description":"`-1` - unlimited","properties":{"code":{"type":"string","example":"messengers500"},"max_bots":{"type":"integer","example":-1},"max_contacts":{"type":"integer","example":500},"max_messages":{"type":"integer","example":-1},"max_tags":{"type":"integer","example":-1},"max_variables":{"type":"integer","example":-1},"branding":{"type":"boolean","example":false},"is_exceeded":{"type":"boolean","example":false},"is_expired":{"type":"boolean"},"expired_at":{"type":"string","example":"2026-01-15T11:11:11+00:00"}}},"statistics":{"type":"object","description":"","properties":{"messages":{"type":"integer"},"bots":{"type":"integer"},"contacts":{"type":"integer"},"variables":{"type":"integer"},"active_count_by_last_month":{"type":"integer"},"active_count_by_current_tariff_period":{"type":"integer"}}},"services":{"type":"array","description":"\n                    * `1` - Messenger\n\n                    * `3` - Telegram\n\n                    * `4` - WhatsApp\n\n                    * `5` - Instagram\n\n                    * `6` - Viber\n\n                    * `7` - Livechat\n\n                    * `8` - TikTok\n\n                    * `1000` - Bridge\n\n                    * `1001` - Telegram personal\n\n                ","items":{"type":"integer"},"example":[1,3,5]}}},"Operator":{"type":"object","properties":{"user_id":{"type":"integer","description":"The operator user ID"},"username":{"type":"string","description":"The operator full name"},"email":{"type":"string","description":"The operator email"},"avatar":{"type":"string","nullable":true,"description":"The operator avatar URL"},"online":{"type":"boolean","nullable":true,"description":"Whether the operator currently has an active websocket session"},"status":{"type":"string","description":"\n                    * `active_online` - active and online\n\n                    * `active_offline` - active but offline\n\n                    * `offline` - offline\n\n                    * `absent` - absent\n\n                "}}},"OperatorGroup":{"type":"object","properties":{"id":{"type":"string","description":"The operator group ID"},"name":{"type":"string","description":"The operator group name"},"user_id":{"type":"integer","description":"The account owner's user ID"}}},"OperatorGroupMember":{"type":"object","properties":{"member_id":{"type":"string","description":"The operator group member ID"},"operator_id":{"type":"integer","description":"The operator ID"},"auto_distribution_enabled":{"type":"boolean","description":"Whether auto distribution is enabled for the operator"},"auto_distribution_limit":{"type":"integer","nullable":true,"description":"The auto distribution limit for the operator"},"username":{"type":"string","nullable":true,"description":"The operator full name"},"email":{"type":"string","nullable":true,"description":"The operator email"},"avatar":{"type":"string","nullable":true,"description":"The operator avatar URL"}}},"Bot":{"properties":{"id":{"type":"string"},"channel_data":{"type":"object","properties":{"access_token":{"type":"string"},"id":{"type":"integer"},"name":{"type":"string"},"username":{"type":"string"}}},"inbox":{"type":"object","properties":{"total":{"type":"integer"},"unread":{"type":"integer"}}},"status":{"type":"integer","enum":[3,4],"description":"\n                    * `3` - active\n\n                    * `4` - inactive\n\n                "},"created_at":{"type":"string","example":"2020-12-12T00:00:00+03:00"}}}}},"security":[{"Authorization by API key":[]}]}