@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Intercom API
@base https://api.intercom.io
@version 2.11
@auth Bearer bearer
@common_fields {Intercom-Version: str}
@endpoints 108
@hint download_for_search
@toc me(1), admins(4), articles(6), help_center(7), companies(9), contacts(21), conversations(14), data_attributes(3), events(3), export(3), download(1), messages(1), news(8), notes(1), segments(2), subscription_types(1), phone_call_redirects(1), tags(4), teams(2), ticket_types(6), tickets(7), visitors(3)

@group me
@endpoint GET /me
@desc Identify an admin
@returns(200) {type: str, id: str, name: str, email: str, job_title: str, away_mode_enabled: bool, away_mode_reassign: bool, has_inbox_seat: bool, team_ids: [int], avatar: map{type: str, image_url: str(uri)?}, email_verified: bool?, app: map{type: str, id_code: str, name: str, region: str, timezone: str, created_at: int, identity_verification: bool}} # Successful response

@endgroup

@group admins
@endpoint PUT /admins/{admin_id}/away
@desc Set an admin to away
@required {admin_id: str # The unique identifier of a given admin, away_mode_enabled: bool=true # Set to "true" to change the status of the admin to away., away_mode_reassign: bool=false # Set to "true" to assign any new conversation replies to your default inbox.}
@returns(200) {type: str, id: str, name: str, email: str, job_title: str, away_mode_enabled: bool, away_mode_reassign: bool, has_inbox_seat: bool, team_ids: [int], avatar: map?{image_url: str(uri)}, team_priority_level: map{primary_team_ids: [int]?, secondary_team_ids: [int]?}} # Successful response
@errors {401: Unauthorized, 404: Admin not found}
@example_request {"away_mode_enabled":true,"away_mode_reassign":true}

@endpoint GET /admins/activity_logs
@desc List all activity logs
@required {created_at_after: str # The start date that you request data for. It must be formatted as a UNIX timestamp.}
@optional {created_at_before: str # The end date that you request data for. It must be formatted as a UNIX timestamp.}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, activity_logs: [map]} # Successful response
@errors {401: Unauthorized}

@endpoint GET /admins
@desc List all admins
@returns(200) {type: str, admins: [map]} # Successful response
@errors {401: Unauthorized}

@endpoint GET /admins/{admin_id}
@desc Retrieve an admin
@required {admin_id: str # The unique identifier of a given admin}
@returns(200) {type: str, id: str, name: str, email: str, job_title: str, away_mode_enabled: bool, away_mode_reassign: bool, has_inbox_seat: bool, team_ids: [int], avatar: map?{image_url: str(uri)}, team_priority_level: map{primary_team_ids: [int]?, secondary_team_ids: [int]?}} # Admin found
@errors {401: Unauthorized, 404: Admin not found}

@endgroup

@group articles
@endpoint GET /articles
@desc List all articles
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # successful
@errors {401: Unauthorized}

@endpoint POST /articles
@desc Create an article
@required {title: str # The title of the article.For multilingual articles, this will be the title of the default language's content., author_id: int # The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace.}
@optional {description: str # The description of the article. For multilingual articles, this will be the description of the default language's content., body: str # The content of the article. For multilingual articles, this will be the body of the default language's content., state: str(published/draft) # Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content., parent_id: int # The id of the article's parent collection or section. An article without this field stands alone., parent_type: str # The type of parent, which can either be a `collection` or `section`., translated_content: map{type: str, ar: map, bg: map, bs: map, ca: map, cs: map, da: map, de: map, el: map, en: map, es: map, et: map, fi: map, fr: map, he: map, hr: map, hu: map, id: map, it: map, ja: map, ko: map, lt: map, lv: map, mn: map, nb: map, nl: map, pl: map, pt: map, ro: map, ru: map, sl: map, sr: map, sv: map, tr: map, vi: map, pt-BR: map, zh-CN: map, zh-TW: map} # The Translated Content of an Article. The keys are the locale codes and the values are the translated content of the article.}
@returns(200) {statistics: map{type: str, views: int, conversions: int, reactions: int, happy_reaction_percentage: num(float), neutral_reaction_percentage: num(float), sad_reaction_percentage: num(float)}} # article created
@errors {400: Bad Request, 401: Unauthorized}
@example_request {"title":"Thanks for everything","description":"Description of the Article","body":"Body of the Article","author_id":991267407,"state":"published","parent_id":145,"parent_type":"collection","translated_content":{"fr":{"title":"Merci pour tout","description":"Description de l'article","body":"Corps de l'article","author_id":991267407,"state":"published"}}}

@endpoint GET /articles/{article_id}
@desc Retrieve an article
@required {article_id: str # The unique identifier for the article which is given by Intercom.}
@returns(200) {statistics: map{type: str, views: int, conversions: int, reactions: int, happy_reaction_percentage: num(float), neutral_reaction_percentage: num(float), sad_reaction_percentage: num(float)}} # Article found
@errors {401: Unauthorized, 404: Article not found}

@endpoint PUT /articles/{article_id}
@desc Update an article
@required {article_id: str # The unique identifier for the article which is given by Intercom.}
@optional {title: str # The title of the article.For multilingual articles, this will be the title of the default language's content., description: str # The description of the article. For multilingual articles, this will be the description of the default language's content., body: str # The content of the article. For multilingual articles, this will be the body of the default language's content., author_id: int # The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace., state: str(published/draft) # Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content., parent_id: str # The id of the article's parent collection or section. An article without this field stands alone., parent_type: str # The type of parent, which can either be a `collection` or `section`., translated_content: map{type: str, ar: map, bg: map, bs: map, ca: map, cs: map, da: map, de: map, el: map, en: map, es: map, et: map, fi: map, fr: map, he: map, hr: map, hu: map, id: map, it: map, ja: map, ko: map, lt: map, lv: map, mn: map, nb: map, nl: map, pl: map, pt: map, ro: map, ru: map, sl: map, sr: map, sv: map, tr: map, vi: map, pt-BR: map, zh-CN: map, zh-TW: map} # The Translated Content of an Article. The keys are the locale codes and the values are the translated content of the article.}
@returns(200) {statistics: map{type: str, views: int, conversions: int, reactions: int, happy_reaction_percentage: num(float), neutral_reaction_percentage: num(float), sad_reaction_percentage: num(float)}} # successful
@errors {401: Unauthorized, 404: Article Not Found}
@example_request {"title":"Christmas is here!","body":"<p>New gifts in store for the jolly season</p>"}

@endpoint DELETE /articles/{article_id}
@desc Delete an article
@required {article_id: str # The unique identifier for the article which is given by Intercom.}
@returns(200) {id: str, object: str, deleted: bool} # successful
@errors {401: Unauthorized, 404: Article Not Found}

@endpoint GET /articles/search
@desc Search for articles
@optional {phrase: str # The phrase within your articles to search for., state: str # The state of the Articles returned. One of `published`, `draft` or `all`., help_center_id: int # The ID of the Help Center to search in., highlight: bool # Return a highlighted version of the matching content within your articles. Refer to the response schema for more details.}
@returns(200) {type: str, total_count: int, data: map{articles: [map], highlights: [map]}, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # Search successful
@errors {401: Unauthorized}

@endgroup

@group help_center
@endpoint GET /help_center/collections
@desc List all collections
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # Successful
@errors {401: Unauthorized}

@endpoint POST /help_center/collections
@desc Create a collection
@required {name: str # The name of the collection. For multilingual collections, this will be the name of the default language's content.}
@optional {description: str # The description of the collection. For multilingual collections, this will be the description of the default language's content., translated_content: map{type!: str, ar: map, bg: map, bs: map, ca: map, cs: map, da: map, de: map, el: map, en: map, es: map, et: map, fi: map, fr: map, he: map, hr: map, hu: map, id: map, it: map, ja: map, ko: map, lt: map, lv: map, mn: map, nb: map, nl: map, pl: map, pt: map, ro: map, ru: map, sl: map, sr: map, sv: map, tr: map, vi: map, pt-BR: map, zh-CN: map, zh-TW: map} # The Translated Content of an Group. The keys are the locale codes and the values are the translated content of the Group., parent_id: str # The id of the parent collection. If `null` then it will be created as the first level collection., help_center_id: int # The id of the help center where the collection will be created. If `null` then it will be created in the default help center.}
@returns(200) {id: str, workspace_id: str, name: str, description: str?, created_at: int(date-time), updated_at: int(date-time), url: str?, icon: str?, order: int, default_locale: str, translated_content: map{type: str, ar: map{type: str, name: str, description: str}, bg: map{type: str, name: str, description: str}, bs: map{type: str, name: str, description: str}, ca: map{type: str, name: str, description: str}, cs: map{type: str, name: str, description: str}, da: map{type: str, name: str, description: str}, de: map{type: str, name: str, description: str}, el: map{type: str, name: str, description: str}, en: map{type: str, name: str, description: str}, es: map{type: str, name: str, description: str}, et: map{type: str, name: str, description: str}, fi: map{type: str, name: str, description: str}, fr: map{type: str, name: str, description: str}, he: map{type: str, name: str, description: str}, hr: map{type: str, name: str, description: str}, hu: map{type: str, name: str, description: str}, id: map{type: str, name: str, description: str}, it: map{type: str, name: str, description: str}, ja: map{type: str, name: str, description: str}, ko: map{type: str, name: str, description: str}, lt: map{type: str, name: str, description: str}, lv: map{type: str, name: str, description: str}, mn: map{type: str, name: str, description: str}, nb: map{type: str, name: str, description: str}, nl: map{type: str, name: str, description: str}, pl: map{type: str, name: str, description: str}, pt: map{type: str, name: str, description: str}, ro: map{type: str, name: str, description: str}, ru: map{type: str, name: str, description: str}, sl: map{type: str, name: str, description: str}, sr: map{type: str, name: str, description: str}, sv: map{type: str, name: str, description: str}, tr: map{type: str, name: str, description: str}, vi: map{type: str, name: str, description: str}, pt-BR: map{type: str, name: str, description: str}, zh-CN: map{type: str, name: str, description: str}, zh-TW: map{type: str, name: str, description: str}}, parent_id: str?, help_center_id: int?} # collection created
@errors {400: Bad Request, 401: Unauthorized}
@example_request {"name":"Thanks for everything"}

@endpoint GET /help_center/collections/{collection_id}
@desc Retrieve a collection
@required {collection_id: str # The unique identifier for the collection which is given by Intercom.}
@returns(200) {id: str, workspace_id: str, name: str, description: str?, created_at: int(date-time), updated_at: int(date-time), url: str?, icon: str?, order: int, default_locale: str, translated_content: map{type: str, ar: map{type: str, name: str, description: str}, bg: map{type: str, name: str, description: str}, bs: map{type: str, name: str, description: str}, ca: map{type: str, name: str, description: str}, cs: map{type: str, name: str, description: str}, da: map{type: str, name: str, description: str}, de: map{type: str, name: str, description: str}, el: map{type: str, name: str, description: str}, en: map{type: str, name: str, description: str}, es: map{type: str, name: str, description: str}, et: map{type: str, name: str, description: str}, fi: map{type: str, name: str, description: str}, fr: map{type: str, name: str, description: str}, he: map{type: str, name: str, description: str}, hr: map{type: str, name: str, description: str}, hu: map{type: str, name: str, description: str}, id: map{type: str, name: str, description: str}, it: map{type: str, name: str, description: str}, ja: map{type: str, name: str, description: str}, ko: map{type: str, name: str, description: str}, lt: map{type: str, name: str, description: str}, lv: map{type: str, name: str, description: str}, mn: map{type: str, name: str, description: str}, nb: map{type: str, name: str, description: str}, nl: map{type: str, name: str, description: str}, pl: map{type: str, name: str, description: str}, pt: map{type: str, name: str, description: str}, ro: map{type: str, name: str, description: str}, ru: map{type: str, name: str, description: str}, sl: map{type: str, name: str, description: str}, sr: map{type: str, name: str, description: str}, sv: map{type: str, name: str, description: str}, tr: map{type: str, name: str, description: str}, vi: map{type: str, name: str, description: str}, pt-BR: map{type: str, name: str, description: str}, zh-CN: map{type: str, name: str, description: str}, zh-TW: map{type: str, name: str, description: str}}, parent_id: str?, help_center_id: int?} # Collection found
@errors {401: Unauthorized, 404: Collection not found}

@endpoint PUT /help_center/collections/{collection_id}
@desc Update a collection
@required {collection_id: str # The unique identifier for the collection which is given by Intercom.}
@optional {name: str # The name of the collection. For multilingual collections, this will be the name of the default language's content., description: str # The description of the collection. For multilingual collections, this will be the description of the default language's content., translated_content: map{type!: str, ar: map, bg: map, bs: map, ca: map, cs: map, da: map, de: map, el: map, en: map, es: map, et: map, fi: map, fr: map, he: map, hr: map, hu: map, id: map, it: map, ja: map, ko: map, lt: map, lv: map, mn: map, nb: map, nl: map, pl: map, pt: map, ro: map, ru: map, sl: map, sr: map, sv: map, tr: map, vi: map, pt-BR: map, zh-CN: map, zh-TW: map} # The Translated Content of an Group. The keys are the locale codes and the values are the translated content of the Group., parent_id: str # The id of the parent collection. If `null` then it will be updated as the first level collection.}
@returns(200) {id: str, workspace_id: str, name: str, description: str?, created_at: int(date-time), updated_at: int(date-time), url: str?, icon: str?, order: int, default_locale: str, translated_content: map{type: str, ar: map{type: str, name: str, description: str}, bg: map{type: str, name: str, description: str}, bs: map{type: str, name: str, description: str}, ca: map{type: str, name: str, description: str}, cs: map{type: str, name: str, description: str}, da: map{type: str, name: str, description: str}, de: map{type: str, name: str, description: str}, el: map{type: str, name: str, description: str}, en: map{type: str, name: str, description: str}, es: map{type: str, name: str, description: str}, et: map{type: str, name: str, description: str}, fi: map{type: str, name: str, description: str}, fr: map{type: str, name: str, description: str}, he: map{type: str, name: str, description: str}, hr: map{type: str, name: str, description: str}, hu: map{type: str, name: str, description: str}, id: map{type: str, name: str, description: str}, it: map{type: str, name: str, description: str}, ja: map{type: str, name: str, description: str}, ko: map{type: str, name: str, description: str}, lt: map{type: str, name: str, description: str}, lv: map{type: str, name: str, description: str}, mn: map{type: str, name: str, description: str}, nb: map{type: str, name: str, description: str}, nl: map{type: str, name: str, description: str}, pl: map{type: str, name: str, description: str}, pt: map{type: str, name: str, description: str}, ro: map{type: str, name: str, description: str}, ru: map{type: str, name: str, description: str}, sl: map{type: str, name: str, description: str}, sr: map{type: str, name: str, description: str}, sv: map{type: str, name: str, description: str}, tr: map{type: str, name: str, description: str}, vi: map{type: str, name: str, description: str}, pt-BR: map{type: str, name: str, description: str}, zh-CN: map{type: str, name: str, description: str}, zh-TW: map{type: str, name: str, description: str}}, parent_id: str?, help_center_id: int?} # successful
@errors {401: Unauthorized, 404: Collection Not Found}
@example_request {"name":"Update collection name"}

@endpoint DELETE /help_center/collections/{collection_id}
@desc Delete a collection
@required {collection_id: str # The unique identifier for the collection which is given by Intercom.}
@returns(200) {id: str, object: str, deleted: bool} # successful
@errors {401: Unauthorized, 404: collection Not Found}

@endpoint GET /help_center/help_centers/{help_center_id}
@desc Retrieve a Help Center
@required {help_center_id: str # The unique identifier for the Help Center which is given by Intercom.}
@returns(200) {id: str, workspace_id: str, created_at: int(date-time), updated_at: int(date-time), identifier: str, website_turned_on: bool, display_name: str, url: str, custom_domain: str?} # Collection found
@errors {401: Unauthorized, 404: Collection not found}

@endpoint GET /help_center/help_centers
@desc List all Help Centers
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, data: [map]} # Help Centers found
@errors {401: Unauthorized}

@endgroup

@group companies
@endpoint POST /companies
@desc Create or Update a company
@optional {name: str # The name of the Company, company_id: str # The company id you have defined for the company. Can't be updated, plan: str # The name of the plan you have associated with the company., size: int # The number of employees in this company., website: str # The URL for this company's website. Please note that the value specified here is not validated. Accepts any string., industry: str # The industry that this company operates in., custom_attributes: map # A hash of key/value pairs containing any other data about the company you want Intercom to store., remote_created_at: int # The time the company was created by you., monthly_spend: int # How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2**31-1 or 2147483647..}
@returns(200) {type: str, id: str, name: str, app_id: str, plan: map{type: str, id: str, name: str}, company_id: str, remote_created_at: int, created_at: int, updated_at: int, last_request_at: int, size: int, website: str, industry: str, monthly_spend: int, session_count: int, user_count: int, custom_attributes: map, tags: map{type: str, tags: [map]}, segments: map{type: str, segments: [map]}} # Successful
@errors {400: Bad Request, 401: Unauthorized}
@example_request {"company_id":"company_remote_id","name":"my company","remote_created_at":1374138000}

@endpoint GET /companies
@desc Retrieve companies
@optional {name: str # The `name` of the company to filter by., company_id: str # The `company_id` of the company to filter by., tag_id: str # The `tag_id` of the company to filter by., segment_id: str # The `segment_id` of the company to filter by., page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint GET /companies/{company_id}
@desc Retrieve a company by ID
@required {company_id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {type: str, id: str, name: str, app_id: str, plan: map{type: str, id: str, name: str}, company_id: str, remote_created_at: int, created_at: int, updated_at: int, last_request_at: int, size: int, website: str, industry: str, monthly_spend: int, session_count: int, user_count: int, custom_attributes: map, tags: map{type: str, tags: [map]}, segments: map{type: str, segments: [map]}} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint PUT /companies/{company_id}
@desc Update a company
@required {company_id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {type: str, id: str, name: str, app_id: str, plan: map{type: str, id: str, name: str}, company_id: str, remote_created_at: int, created_at: int, updated_at: int, last_request_at: int, size: int, website: str, industry: str, monthly_spend: int, session_count: int, user_count: int, custom_attributes: map, tags: map{type: str, tags: [map]}, segments: map{type: str, segments: [map]}} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint DELETE /companies/{company_id}
@desc Delete a company
@required {company_id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {id: str, object: str, deleted: bool} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint GET /companies/{company_id}/contacts
@desc List attached contacts
@required {company_id: str # The unique identifier for the company which is given by Intercom}
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to return per page. Defaults to 15}
@returns(200) {type: str, data: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint GET /companies/{company_id}/segments
@desc List attached segments for companies
@required {company_id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {type: str, data: [map]} # Successful
@errors {401: Unauthorized, 404: Company Not Found}

@endpoint POST /companies/list
@desc List all companies
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to return per page. Defaults to 15, order: str # `asc` or `desc`. Return the companies in ascending or descending order. Defaults to desc}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # Successful
@errors {401: Unauthorized}

@endpoint GET /companies/scroll
@desc Scroll over all companies
@optional {scroll_param: str}
@returns(200) {type: str, data: [map], pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int?, scroll_param: str} # Successful
@errors {401: Unauthorized}

@endgroup

@group contacts
@endpoint POST /contacts/{contact_id}/companies
@desc Attach a Contact to a Company
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {type: str, id: str, name: str, app_id: str, plan: map{type: str, id: str, name: str}, company_id: str, remote_created_at: int, created_at: int, updated_at: int, last_request_at: int, size: int, website: str, industry: str, monthly_spend: int, session_count: int, user_count: int, custom_attributes: map, tags: map{type: str, tags: [map]}, segments: map{type: str, segments: [map]}} # Successful
@errors {400: Bad Request, 401: Unauthorized, 404: Company Not Found}
@example_request {"id":"667d608d8a68186f43bafd70"}

@endpoint GET /contacts/{contact_id}/companies
@desc List attached companies for contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom}
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, companies: [map], total_count: int, pages: map{type: str, page: int, next: str(uri)?, per_page: int, total_pages: int}} # successful
@errors {401: Unauthorized, 404: Contact not found}

@endpoint DELETE /contacts/{contact_id}/companies/{company_id}
@desc Detach a contact from a company
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, company_id: str # The unique identifier for the company which is given by Intercom}
@returns(200) {type: str, id: str, name: str, app_id: str, plan: map{type: str, id: str, name: str}, company_id: str, remote_created_at: int, created_at: int, updated_at: int, last_request_at: int, size: int, website: str, industry: str, monthly_spend: int, session_count: int, user_count: int, custom_attributes: map, tags: map{type: str, tags: [map]}, segments: map{type: str, segments: [map]}} # Successful
@errors {401: Unauthorized, 404: Contact Not Found}

@endpoint GET /contacts/{contact_id}/notes
@desc List all notes
@required {contact_id: str # The unique identifier of a contact.}
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, data: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # Successful response
@errors {404: Contact not found}

@endpoint POST /contacts/{contact_id}/notes
@desc Create a note
@required {contact_id: str # The unique identifier of a given contact., body: str # The text of the note.}
@optional {admin_id: str # The unique identifier of a given admin.}
@returns(200) {type: str, id: str, created_at: int(timestamp), contact: map?{type: str, id: str}, author: map{type: str, id: str, name: str, email: str, job_title: str, away_mode_enabled: bool, away_mode_reassign: bool, has_inbox_seat: bool, team_ids: [int], avatar: map?{image_url: str(uri)}, team_priority_level: map{primary_team_ids: [int]?, secondary_team_ids: [int]?}}, body: str} # Successful response
@errors {404: Contact not found}
@example_request {"contact_id":"667d60978a68186f43bafd9e","admin_id":991267493,"body":"Hello"}

@endpoint GET /contacts/{contact_id}/segments
@desc List attached segments for contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom}
@returns(200) {type: str, data: [map]} # successful
@errors {401: Unauthorized, 404: Contact not found}

@endpoint GET /contacts/{contact_id}/subscriptions
@desc List subscriptions for a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom}
@returns(200) {type: str, data: [map]} # Successful
@errors {401: Unauthorized, 404: Contact not found}

@endpoint POST /contacts/{contact_id}/subscriptions
@desc Add subscription to a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, id: str # The unique identifier for the subscription which is given by Intercom, consent_type: str # The consent_type of a subscription, opt_out or opt_in.}
@returns(200) {type: str, id: str, state: str, default_translation: map{name: str, description: str, locale: str}, translations: [map], consent_type: str, content_types: [str]} # Successful
@errors {401: Unauthorized, 404: Resource not found}
@example_request {"id":108,"consent_type":"opt_in"}

@endpoint DELETE /contacts/{contact_id}/subscriptions/{subscription_id}
@desc Remove subscription from a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, subscription_id: str # The unique identifier for the subscription type which is given by Intercom}
@returns(200) {type: str, id: str, state: str, default_translation: map{name: str, description: str, locale: str}, translations: [map], consent_type: str, content_types: [str]} # Successful
@errors {401: Unauthorized, 404: Resource not found}

@endpoint GET /contacts/{contact_id}/tags
@desc List tags attached to a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom}
@returns(200) {type: str, data: [map]} # successful
@errors {401: Unauthorized, 404: Contact not found}

@endpoint POST /contacts/{contact_id}/tags
@desc Add tag to a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, id: str # The unique identifier for the tag which is given by Intercom}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Tag not found}
@example_request {"id":94}

@endpoint DELETE /contacts/{contact_id}/tags/{tag_id}
@desc Remove tag from a contact
@required {contact_id: str # The unique identifier for the contact which is given by Intercom, tag_id: str # The unique identifier for the tag which is given by Intercom}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Tag not found}

@endpoint PUT /contacts/{contact_id}
@desc Update a contact
@required {contact_id: str # id}
@optional {role: str # The role of the contact., external_id: str # A unique identifier for the contact which is given to Intercom, email: str # The contacts email, phone: str # The contacts phone, name: str # The contacts name, avatar: str # An image URL containing the avatar of a contact, signed_up_at: int(date-time) # The time specified for when a contact signed up, last_seen_at: int(date-time) # The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually), owner_id: int # The id of an admin that has been assigned account ownership of the contact, unsubscribed_from_emails: bool # Whether the contact is unsubscribed from emails, custom_attributes: map # The custom attributes which are set for the contact}
@returns(200) {type: str, id: str, external_id: str?, workspace_id: str, role: str, email: str, email_domain: str, phone: str?, formatted_phone: str?, name: str?, owner_id: int?, has_hard_bounced: bool, marked_email_as_spam: bool, unsubscribed_from_emails: bool, created_at: int(date-time), updated_at: int(date-time), signed_up_at: int(date-time)?, last_seen_at: int(date-time)?, last_replied_at: int(date-time)?, last_contacted_at: int(date-time)?, last_email_opened_at: int(date-time)?, last_email_clicked_at: int(date-time)?, language_override: str?, browser: str?, browser_version: str?, browser_language: str?, os: str?, android_app_name: str?, android_app_version: str?, android_device: str?, android_os_version: str?, android_sdk_version: str?, android_last_seen_at: int(date-time)?, ios_app_name: str?, ios_app_version: str?, ios_device: str?, ios_os_version: str?, ios_sdk_version: str?, ios_last_seen_at: int(date-time)?, custom_attributes: map, avatar: map?{type: str, image_url: str(uri)?}, tags: map{data: [map], url: str(uri), total_count: int, has_more: bool}, notes: map{data: [map], url: str(uri), total_count: int, has_more: bool}, companies: map{type: str, data: [map], url: str(uri), total_count: int, has_more: bool}, location: map{type: str, country: str?, region: str?, city: str?}, social_profiles: map{data: [map]}} # successful
@errors {401: Unauthorized}
@example_request {"email":"joebloggs@intercom.io","name":"joe bloggs"}

@endpoint GET /contacts/{contact_id}
@desc Get a contact
@required {contact_id: str # id}
@returns(200) {type: str, id: str, external_id: str?, workspace_id: str, role: str, email: str, email_domain: str, phone: str?, formatted_phone: str?, name: str?, owner_id: int?, has_hard_bounced: bool, marked_email_as_spam: bool, unsubscribed_from_emails: bool, created_at: int(date-time), updated_at: int(date-time), signed_up_at: int(date-time)?, last_seen_at: int(date-time)?, last_replied_at: int(date-time)?, last_contacted_at: int(date-time)?, last_email_opened_at: int(date-time)?, last_email_clicked_at: int(date-time)?, language_override: str?, browser: str?, browser_version: str?, browser_language: str?, os: str?, android_app_name: str?, android_app_version: str?, android_device: str?, android_os_version: str?, android_sdk_version: str?, android_last_seen_at: int(date-time)?, ios_app_name: str?, ios_app_version: str?, ios_device: str?, ios_os_version: str?, ios_sdk_version: str?, ios_last_seen_at: int(date-time)?, custom_attributes: map, avatar: map?{type: str, image_url: str(uri)?}, tags: map{data: [map], url: str(uri), total_count: int, has_more: bool}, notes: map{data: [map], url: str(uri), total_count: int, has_more: bool}, companies: map{type: str, data: [map], url: str(uri), total_count: int, has_more: bool}, location: map{type: str, country: str?, region: str?, city: str?}, social_profiles: map{data: [map]}} # successful
@errors {401: Unauthorized}

@endpoint DELETE /contacts/{contact_id}
@desc Delete a contact
@required {contact_id: str # id}
@returns(200) {type: str, id: str, external_id: str?, deleted: bool} # successful
@errors {401: Unauthorized}

@endpoint POST /contacts/merge
@desc Merge a lead and a user
@required {from: str # The unique identifier for the contact to merge away from. Must be a lead., into: str # The unique identifier for the contact to merge into. Must be a user.}
@returns(200) {type: str, id: str, external_id: str?, workspace_id: str, role: str, email: str, email_domain: str, phone: str?, formatted_phone: str?, name: str?, owner_id: int?, has_hard_bounced: bool, marked_email_as_spam: bool, unsubscribed_from_emails: bool, created_at: int(date-time), updated_at: int(date-time), signed_up_at: int(date-time)?, last_seen_at: int(date-time)?, last_replied_at: int(date-time)?, last_contacted_at: int(date-time)?, last_email_opened_at: int(date-time)?, last_email_clicked_at: int(date-time)?, language_override: str?, browser: str?, browser_version: str?, browser_language: str?, os: str?, android_app_name: str?, android_app_version: str?, android_device: str?, android_os_version: str?, android_sdk_version: str?, android_last_seen_at: int(date-time)?, ios_app_name: str?, ios_app_version: str?, ios_device: str?, ios_os_version: str?, ios_sdk_version: str?, ios_last_seen_at: int(date-time)?, custom_attributes: map, avatar: map?{type: str, image_url: str(uri)?}, tags: map{data: [map], url: str(uri), total_count: int, has_more: bool}, notes: map{data: [map], url: str(uri), total_count: int, has_more: bool}, companies: map{type: str, data: [map], url: str(uri), total_count: int, has_more: bool}, location: map{type: str, country: str?, region: str?, city: str?}, social_profiles: map{data: [map]}} # successful
@errors {401: Unauthorized}
@example_request {"from":"667d60ac8a68186f43bafdbb","into":"667d60ac8a68186f43bafdbc"}

@endpoint POST /contacts/search
@desc Search contacts
@required {query: any}
@optional {pagination: map{per_page!: int, starting_after: str}}
@returns(200) {type: str, data: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # successful
@errors {401: Unauthorized}
@example_request {"query":{"operator":"AND","value":[{"field":"created_at","operator":">","value":"1306054154"}]},"pagination":{"per_page":5}}

@endpoint GET /contacts
@desc List all contacts
@optional {page: int # The page of results to fetch. Defaults to first page, per_page: int # How many results to display per page. Defaults to 15, starting_after: str # String used to get the next page of conversations.}
@returns(200) {type: str, data: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # successful
@errors {401: Unauthorized}

@endpoint POST /contacts
@desc Create contact
@optional {role: str # The role of the contact., external_id: str # A unique identifier for the contact which is given to Intercom, email: str # The contacts email, phone: str # The contacts phone, name: str # The contacts name, avatar: str # An image URL containing the avatar of a contact, signed_up_at: int(date-time) # The time specified for when a contact signed up, last_seen_at: int(date-time) # The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually), owner_id: int # The id of an admin that has been assigned account ownership of the contact, unsubscribed_from_emails: bool # Whether the contact is unsubscribed from emails, custom_attributes: map # The custom attributes which are set for the contact}
@returns(200) {type: str, id: str, external_id: str?, workspace_id: str, role: str, email: str, email_domain: str, phone: str?, formatted_phone: str?, name: str?, owner_id: int?, has_hard_bounced: bool, marked_email_as_spam: bool, unsubscribed_from_emails: bool, created_at: int(date-time), updated_at: int(date-time), signed_up_at: int(date-time)?, last_seen_at: int(date-time)?, last_replied_at: int(date-time)?, last_contacted_at: int(date-time)?, last_email_opened_at: int(date-time)?, last_email_clicked_at: int(date-time)?, language_override: str?, browser: str?, browser_version: str?, browser_language: str?, os: str?, android_app_name: str?, android_app_version: str?, android_device: str?, android_os_version: str?, android_sdk_version: str?, android_last_seen_at: int(date-time)?, ios_app_name: str?, ios_app_version: str?, ios_device: str?, ios_os_version: str?, ios_sdk_version: str?, ios_last_seen_at: int(date-time)?, custom_attributes: map, avatar: map?{type: str, image_url: str(uri)?}, tags: map{data: [map], url: str(uri), total_count: int, has_more: bool}, notes: map{data: [map], url: str(uri), total_count: int, has_more: bool}, companies: map{type: str, data: [map], url: str(uri), total_count: int, has_more: bool}, location: map{type: str, country: str?, region: str?, city: str?}, social_profiles: map{data: [map]}} # successful
@errors {401: Unauthorized}
@example_request {"email":"joebloggs@intercom.io"}

@endpoint POST /contacts/{contact_id}/archive
@desc Archive contact
@required {contact_id: str # id}
@returns(200) {type: str, id: str, external_id: str?, archived: bool} # successful

@endpoint POST /contacts/{contact_id}/unarchive
@desc Unarchive contact
@required {contact_id: str # id}
@returns(200) {type: str, id: str, external_id: str?, archived: bool} # successful

@endgroup

@group conversations
@endpoint POST /conversations/{conversation_id}/tags
@desc Add tag to a conversation
@required {conversation_id: str # conversation_id, id: str # The unique identifier for the tag which is given by Intercom, admin_id: str # The unique identifier for the admin which is given by Intercom.}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Conversation not found}
@example_request {"id":99,"admin_id":991267526}

@endpoint DELETE /conversations/{conversation_id}/tags/{tag_id}
@desc Remove tag from a conversation
@required {conversation_id: str # conversation_id, tag_id: str # id, admin_id: str # The unique identifier for the admin which is given by Intercom.}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Tag not found}
@example_request {"admin_id":991267530}

@endpoint GET /conversations
@desc List all conversations
@optional {per_page: int=20 # How many results per page, starting_after: str # String used to get the next page of conversations.}
@returns(200) {type: str, conversations: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # successful
@errors {401: Unauthorized, 403: API plan restricted}

@endpoint POST /conversations
@desc Creates a conversation
@required {from: map{type!: str, id!: str(uuid)}, body: str # The content of the message. HTML is not supported.}
@optional {attachment_urls: [str(uri)] # A list of image URLs that will be added as attachments. You can include up to 10 URLs., created_at: int(date-time) # The time the conversation was created as a UTC Unix timestamp. If not provided, the current time will be used. This field is only recommneded for migrating past conversations from another source into Intercom.}
@returns(200) conversation created
@errors {401: Unauthorized, 403: API plan restricted, 404: Contact Not Found}
@example_request {"from":{"type":"user","id":"667d60d18a68186f43bafddd"},"body":"Hello there"}

@endpoint GET /conversations/{conversation_id}
@desc Retrieve a conversation
@required {conversation_id: str # The id of the conversation to target}
@optional {display_as: str # Set to plaintext to retrieve conversation messages in plain text.}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # conversation found
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}

@endpoint PUT /conversations/{conversation_id}
@desc Update a conversation
@required {conversation_id: str # The id of the conversation to target}
@optional {display_as: str # Set to plaintext to retrieve conversation messages in plain text., read: bool # Mark a conversation as read within Intercom., custom_attributes: any}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # conversation found
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}
@example_request {"read":true,"custom_attributes":{"issue_type":"Billing","priority":"High"}}

@endpoint POST /conversations/search
@desc Search conversations
@required {query: any}
@optional {pagination: map{per_page!: int, starting_after: str}}
@returns(200) {type: str, conversations: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # successful
@example_request {"query":{"operator":"AND","value":[{"field":"created_at","operator":">","value":"1306054154"}]},"pagination":{"per_page":5}}

@endpoint POST /conversations/{conversation_id}/reply
@desc Reply to a conversation
@required {conversation_id: str # The Intercom provisioned identifier for the conversation or the string "last" to reply to the last part of the conversation}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # User last conversation reply
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}
@example_request {"message_type":"comment","type":"user","intercom_user_id":"667d60f18a68186f43bafdf4","body":"Thanks again :)"}

@endpoint POST /conversations/{conversation_id}/parts
@desc Manage a conversation
@required {conversation_id: str # The identifier for the conversation as given by Intercom.}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # Assign a conversation
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}
@example_request {"message_type":"close","type":"admin","admin_id":991267608,"body":"Goodbye :)"}

@endpoint POST /conversations/{conversation_id}/run_assignment_rules
@desc Run Assignment Rules on a conversation
@required {conversation_id: str # The identifier for the conversation as given by Intercom.}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # Assign a conversation using assignment rules
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}

@endpoint POST /conversations/{conversation_id}/customers
@desc Attach a contact to a conversation
@required {conversation_id: str # The identifier for the conversation as given by Intercom.}
@optional {admin_id: str # The `id` of the admin who is adding the new participant., customer: map}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # Attach a contact to a conversation
@errors {401: Unauthorized, 403: API plan restricted, 404: Not found}
@example_request {"admin_id":991267631,"customer":{"intercom_user_id":"667d61168a68186f43bafe0d"}}

@endpoint DELETE /conversations/{conversation_id}/customers/{contact_id}
@desc Detach a contact from a group conversation
@required {conversation_id: str # The identifier for the conversation as given by Intercom., contact_id: str # The identifier for the contact as given by Intercom., admin_id: str # The `id` of the admin who is performing the action.}
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # Detach a contact from a group conversation
@errors {401: Unauthorized, 403: API plan restricted, 404: Contact not found, 422: Last customer}
@example_request {"admin_id":991267639,"customer":{"intercom_user_id":"667d611c8a68186f43bafe11"}}

@endpoint POST /conversations/redact
@desc Redact a conversation part
@returns(200) {type: str, id: str, title: str?, created_at: int(date-time), updated_at: int(date-time), waiting_since: int(date-time)?, snoozed_until: int(date-time)?, open: bool, state: str, read: bool, priority: str, admin_assignee_id: int?, team_assignee_id: str?, tags: map{type: str, tags: [map]}, conversation_rating: map{rating: int, remark: str, created_at: int(date-time), contact: map{type: str, id: str, external_id: str?}, teammate: map{type: str, id: str?}}, source: map{type: str, id: str, delivered_as: str, subject: str, body: str, author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], url: str?, redacted: bool}, contacts: map{type: str, contacts: [map]}, teammates: map{type: str, teammates: [map]}, custom_attributes: any, first_contact_reply: map{created_at: int(date-time), type: str, url: str?}, sla_applied: map{type: str, sla_name: str, sla_status: str}, statistics: map{type: str, time_to_assignment: int, time_to_admin_reply: int, time_to_first_close: int, time_to_last_close: int, median_time_to_reply: int, first_contact_reply_at: int(date-time), first_assignment_at: int(date-time), first_admin_reply_at: int(date-time), first_close_at: int(date-time), last_assignment_at: int(date-time), last_assignment_admin_reply_at: int(date-time), last_contact_reply_at: int(date-time), last_admin_reply_at: int(date-time), last_close_at: int(date-time), last_closed_by_id: str, count_reopens: int, count_assignments: int, count_conversation_parts: int}, conversation_parts: map{type: str, conversation_parts: [map], total_count: int}, linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ai_agent_participated: bool, ai_agent: map{source_type: str?, source_title: str?, last_answer_type: str?, resolution_state: str?, rating: int?, rating_remark: str?, content_sources: any}} # Redact a conversation part
@errors {401: Unauthorized, 404: Not found}
@example_request {"type":"conversation_part","conversation_id":471,"conversation_part_id":115}

@endpoint POST /conversations/{conversation_id}/convert
@desc Convert a conversation to a ticket
@required {conversation_id: str # The id of the conversation to target, ticket_type_id: str # The ID of the type of ticket you want to convert the conversation to}
@optional {attributes: map # The attributes set on the ticket. When setting the default title and description attributes, the attribute keys that should be used are `_default_title_` and `_default_description_`. When setting ticket type attributes of the list attribute type, the key should be the attribute name and the value of the attribute should be the list item id, obtainable by [listing the ticket type](ref:get_ticket-types). For example, if the ticket type has an attribute called `priority` of type `list`, the key should be `priority` and the value of the attribute should be the guid of the list item (e.g. `de1825a0-0164-4070-8ca6-13e22462fa7e`).}
@returns(200) {type: str, id: str, ticket_id: str, category: str, ticket_attributes: map, ticket_state: str, ticket_type: map{type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)}, contacts: map{type: str, contacts: [map]}, admin_assignee_id: str, team_assignee_id: str, created_at: int(date-time), updated_at: int(date-time), open: bool, snoozed_until: int(date-time), linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ticket_parts: map{type: str, ticket_parts: [map], total_count: int}, is_shared: bool, ticket_state_internal_label: str, ticket_state_external_label: str} # successful
@errors {400: Bad request}
@example_request {"ticket_type_id":"79"}

@endgroup

@group data_attributes
@endpoint GET /data_attributes
@desc List all data attributes
@optional {model: str(contact/company/conversation) # Specify the data attribute model to return., include_archived: bool # Include archived attributes in the list. By default we return only non archived data attributes.}
@returns(200) {type: str, data: [map]} # Successful response
@errors {401: Unauthorized}

@endpoint POST /data_attributes
@desc Create a data attribute
@required {name: str # The name of the data attribute., model: str(contact/company) # The model that the data attribute belongs to., data_type: str(string/integer/float/boolean/datetime/date) # The type of data stored for this attribute.}
@optional {description: str # The readable description you see in the UI for the attribute., options: [str] # To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`., messenger_writable: bool # Can this attribute be updated by the Messenger}
@returns(200) {type: str, id: int, model: str, name: str, full_name: str, label: str, description: str, data_type: str, options: [str], api_writable: bool, messenger_writable: bool, ui_writable: bool, custom: bool, archived: bool, created_at: int(date-time), updated_at: int(date-time), admin_id: str} # Successful
@errors {400: Too few options for list, 401: Unauthorized}
@example_request {"name":"Mithril Shirt","model":"company","data_type":"string"}

@endpoint PUT /data_attributes/{data_attribute_id}
@desc Update a data attribute
@required {data_attribute_id: str # The data attribute id}
@optional {archived: bool # Whether the attribute is to be archived or not., description: str # The readable description you see in the UI for the attribute., options: [map{value!: str}] # To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`., messenger_writable: bool # Can this attribute be updated by the Messenger}
@returns(200) {type: str, id: int, model: str, name: str, full_name: str, label: str, description: str, data_type: str, options: [str], api_writable: bool, messenger_writable: bool, ui_writable: bool, custom: bool, archived: bool, created_at: int(date-time), updated_at: int(date-time), admin_id: str} # Successful
@errors {400: Too few options in list, 401: Unauthorized, 404: Attribute Not Found, 422: Has Dependant Object}
@example_request {"description":"Just a plain old ring","options":[{"value":"1-10"},{"value":"11-20"}],"archived":false}

@endgroup

@group events
@endpoint POST /events
@desc Submit a data event
@optional {event_name: str # The name of the event that occurred. This is presented to your App's admins when filtering and creating segments - a good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`., created_at: int(date-time) # The time the event occurred as a UTC Unix timestamp, user_id: str # Your identifier for the user., id: str # The unique identifier for the contact (lead or user) which is given by Intercom., email: str # An email address for your user. An email should only be used where your application uses email to uniquely identify users., metadata: map # Optional metadata about the event.}
@returns(202) successful
@errors {401: Unauthorized}

@endpoint GET /events
@desc List all data events
@required {filter: map, type: str # The value must be user}
@optional {summary: bool # summary flag, per_page: int # How many results to display per page. Defaults to 15}
@returns(200) {type: str, email: str, intercom_user_id: str, user_id: str, events: [map]} # Successful response
@errors {401: Unauthorized}

@endpoint POST /events/summaries
@desc Create event summaries
@optional {user_id: str # Your identifier for the user., event_summaries: map{event_name: str, count: int, first: int(date-time), last: int(date-time)} # A list of event summaries for the user. Each event summary should contain the event name, the time the event occurred, and the number of times the event occurred. The event name should be a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`.}
@returns(200) successful
@errors {401: Unauthorized}

@endgroup

@group export
@endpoint POST /export/content/data
@desc Create content data export
@required {created_at_after: int # The start date that you request data for. It must be formatted as a unix timestamp., created_at_before: int # The end date that you request data for. It must be formatted as a unix timestamp.}
@returns(200) {job_identifier: str, status: str, download_expires_at: str, download_url: str} # successful
@example_request {"created_at_after":1719474967,"created_at_before":1719492967}

@endpoint GET /export/content/data/{job_identifier}
@desc Show content data export
@required {job_identifier: str # job_identifier}
@returns(200) {job_identifier: str, status: str, download_expires_at: str, download_url: str} # successful

@endpoint POST /export/cancel/{job_identifier}
@desc Cancel content data export
@required {job_identifier: str # job_identifier}
@returns(200) {job_identifier: str, status: str, download_expires_at: str, download_url: str} # successful

@endgroup

@group download
@endpoint GET /download/content/data/{job_identifier}
@desc Download content data export
@required {job_identifier: str # job_identifier}
@returns(200) successful

@endgroup

@group messages
@endpoint POST /messages
@desc Create a message
@optional {message_type: str(in_app/email) # The kind of message being created. Values: `in_app` or `email`., subject: str # The title of the email., body: str # The content of the message. HTML and plaintext are supported., template: str # The style of the outgoing message. Possible values `plain` or `personal`., from: map{type!: str, id!: int} # The sender of the message. If not provided, the default sender will be used., to: map{type!: str, id!: str} # The recipient of the message. If not provided, the default recipient will be used., created_at: int # The time the message was created. If not provided, the current time will be used., create_conversation_without_contact_reply: bool=false # Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided.}
@returns(200) {type: str, id: str, created_at: int(date-time), subject: str, body: str, message_type: str, conversation_id: str} # admin message created
@errors {400: No body supplied for email message, 401: Unauthorized, 403: API plan restricted, 422: No subject supplied for email message}
@example_request {"from":{"type":"user","id":"667d61698a68186f43bafe50"},"body":"heyy","referer":"https://twitter.com/bob"}

@endgroup

@group news
@endpoint GET /news/news_items
@desc List all news items
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # successful
@errors {401: Unauthorized}

@endpoint POST /news/news_items
@desc Create a news item
@required {title: str # The title of the news item., sender_id: int # The id of the sender of the news item. Must be a teammate on the workspace.}
@optional {body: str # The news item body, which may contain HTML., state: str(draft/live) # News items will not be visible to your users in the assigned newsfeeds until they are set live., deliver_silently: bool # When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge., labels: [str] # Label names displayed to users to categorize the news item., reactions: [str] # Ordered list of emoji reactions to the news item. When empty, reactions are disabled., newsfeed_assignments: [map{newsfeed_id!: int, published_at!: int(timestamp)}] # A list of newsfeed_assignments to assign to the specified newsfeed.}
@returns(200) {type: str, id: str, workspace_id: str, title: str, body: str, sender_id: int, state: str, newsfeed_assignments: [map], labels: [str], cover_image_url: str(uri)?, reactions: [str], deliver_silently: bool, created_at: int(timestamp), updated_at: int(timestamp)} # successful
@errors {401: Unauthorized}
@example_request {"title":"Halloween is here!","body":"<p>New costumes in store for this spooky season</p>","labels":["Product","Update","New"],"sender_id":991267734,"deliver_silently":true,"reactions":["😆","😅"],"state":"live","newsfeed_assignments":[{"newsfeed_id":53,"published_at":1664638214}]}

@endpoint GET /news/news_items/{news_item_id}
@desc Retrieve a news item
@required {news_item_id: str # The unique identifier for the news item which is given by Intercom.}
@returns(200) {type: str, id: str, workspace_id: str, title: str, body: str, sender_id: int, state: str, newsfeed_assignments: [map], labels: [str], cover_image_url: str(uri)?, reactions: [str], deliver_silently: bool, created_at: int(timestamp), updated_at: int(timestamp)} # successful
@errors {401: Unauthorized, 404: News Item Not Found}

@endpoint PUT /news/news_items/{news_item_id}
@desc Update a news item
@required {news_item_id: str # The unique identifier for the news item which is given by Intercom., title: str # The title of the news item., sender_id: int # The id of the sender of the news item. Must be a teammate on the workspace.}
@optional {body: str # The news item body, which may contain HTML., state: str(draft/live) # News items will not be visible to your users in the assigned newsfeeds until they are set live., deliver_silently: bool # When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge., labels: [str] # Label names displayed to users to categorize the news item., reactions: [str] # Ordered list of emoji reactions to the news item. When empty, reactions are disabled., newsfeed_assignments: [map{newsfeed_id!: int, published_at!: int(timestamp)}] # A list of newsfeed_assignments to assign to the specified newsfeed.}
@returns(200) {type: str, id: str, workspace_id: str, title: str, body: str, sender_id: int, state: str, newsfeed_assignments: [map], labels: [str], cover_image_url: str(uri)?, reactions: [str], deliver_silently: bool, created_at: int(timestamp), updated_at: int(timestamp)} # successful
@errors {401: Unauthorized, 404: News Item Not Found}
@example_request {"title":"Christmas is here!","body":"<p>New gifts in store for the jolly season</p>","sender_id":991267745,"reactions":["😝","😂"]}

@endpoint DELETE /news/news_items/{news_item_id}
@desc Delete a news item
@required {news_item_id: str # The unique identifier for the news item which is given by Intercom.}
@returns(200) {id: str, object: str, deleted: bool} # successful
@errors {401: Unauthorized, 404: News Item Not Found}

@endpoint GET /news/newsfeeds/{newsfeed_id}/items
@desc List all live newsfeed items
@required {newsfeed_id: str # The unique identifier for the news feed item which is given by Intercom.}
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # successful
@errors {401: Unauthorized}

@endpoint GET /news/newsfeeds
@desc List all newsfeeds
@returns(200) {type: str, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}, total_count: int, data: [map]} # successful
@errors {401: Unauthorized}

@endpoint GET /news/newsfeeds/{newsfeed_id}
@desc Retrieve a newsfeed
@required {newsfeed_id: str # The unique identifier for the news feed item which is given by Intercom.}
@returns(200) {id: str, type: str, name: str, created_at: int(timestamp), updated_at: int(timestamp)} # successful
@errors {401: Unauthorized}

@endgroup

@group notes
@endpoint GET /notes/{note_id}
@desc Retrieve a note
@required {note_id: str # The unique identifier of a given note}
@returns(200) {type: str, id: str, created_at: int(timestamp), contact: map?{type: str, id: str}, author: map{type: str, id: str, name: str, email: str, job_title: str, away_mode_enabled: bool, away_mode_reassign: bool, has_inbox_seat: bool, team_ids: [int], avatar: map?{image_url: str(uri)}, team_priority_level: map{primary_team_ids: [int]?, secondary_team_ids: [int]?}}, body: str} # Note found
@errors {401: Unauthorized, 404: Note not found}

@endgroup

@group segments
@endpoint GET /segments
@desc List all segments
@optional {include_count: bool # It includes the count of contacts that belong to each segment.}
@returns(200) {type: str, segments: [map], pages: map} # Successful response
@errors {401: Unauthorized}

@endpoint GET /segments/{segment_id}
@desc Retrieve a segment
@required {segment_id: str # The unique identified of a given segment.}
@returns(200) {type: str, id: str, name: str, created_at: int, updated_at: int, person_type: str, count: int?} # Successful response
@errors {401: Unauthorized, 404: Segment not found}

@endgroup

@group subscription_types
@endpoint GET /subscription_types
@desc List subscription types
@returns(200) {type: str, data: [map]} # Successful
@errors {401: Unauthorized}

@endgroup

@group phone_call_redirects
@endpoint POST /phone_call_redirects
@desc Create a phone Switch
@required {phone: str # Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger.}
@optional {custom_attributes: any}
@returns(200) {type: str, phone: str} # successful
@errors {400: bad request - invalid number, 401: Unauthorized, 422: unprocessable entity}
@example_request {"phone":"+353832345678","custom_attributes":{"issue_type":"Billing","priority":"High"}}

@endgroup

@group tags
@endpoint GET /tags
@desc List all tags
@returns(200) {type: str, data: [map]} # successful
@errors {401: Unauthorized}

@endpoint POST /tags
@desc Create or update a tag, Tag or untag companies, Tag contacts
@returns(200) {type: str, id: str, name: str} # Action successful
@errors {400: Invalid parameters, 401: Unauthorized, 404: User  not found}
@example_request {"name":"test"}

@endpoint GET /tags/{tag_id}
@desc Find a specific tag
@required {tag_id: str # The unique identifier of a given tag}
@returns(200) {type: str, id: str, name: str} # Tag found
@errors {401: Unauthorized, 404: Tag not found}

@endpoint DELETE /tags/{tag_id}
@desc Delete tag
@required {tag_id: str # The unique identifier of a given tag}
@returns(200) Successful
@errors {400: Tag has dependent objects, 401: Unauthorized, 404: Resource not found}

@endgroup

@group teams
@endpoint GET /teams
@desc List all teams
@returns(200) {type: str, teams: [map]} # successful
@errors {401: Unauthorized}

@endpoint GET /teams/{team_id}
@desc Retrieve a team
@required {team_id: str # The unique identifier of a given team.}
@returns(200) {type: str, id: str, name: str, admin_ids: [int], admin_priority_level: map{primary_admin_ids: [int]?, secondary_admin_ids: [int]?}} # successful
@errors {401: Unauthorized, 404: Team not found}

@endgroup

@group ticket_types
@endpoint POST /ticket_types/{ticket_type_id}/attributes
@desc Create a new attribute for a ticket type
@required {ticket_type_id: str # The unique identifier for the ticket type which is given by Intercom., name: str # The name of the ticket type attribute, description: str # The description of the attribute presented to the teammate or contact, data_type: str(string/list/integer/decimal/boolean/datetime/files) # The data type of the attribute}
@optional {required_to_create: bool=false # Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox., required_to_create_for_contacts: bool=false # Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger., visible_on_create: bool=true # Whether the attribute is visible to teammates when creating a ticket in Inbox., visible_to_contacts: bool=true # Whether the attribute is visible to contacts when creating a ticket in Messenger., multiline: bool # Whether the attribute allows multiple lines of text (only applicable to string attributes), list_items: str # A comma delimited list of items for the attribute value (only applicable to list attributes), allow_multiple_values: bool # Whether the attribute allows multiple files to be attached to it (only applicable to file attributes)}
@returns(200) {type: str, id: str, workspace_id: str, name: str, description: str, data_type: str, input_options: map, order: int, required_to_create: bool, required_to_create_for_contacts: bool, visible_on_create: bool, visible_to_contacts: bool, default: bool, ticket_type_id: int, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)} # Ticket Type Attribute created
@errors {401: Unauthorized}
@example_request {"name":"Attribute Title","description":"Attribute Description","data_type":"string","required_to_create":false}

@endpoint PUT /ticket_types/{ticket_type_id}/attributes/{attribute_id}
@desc Update an existing attribute for a ticket type
@required {ticket_type_id: str # The unique identifier for the ticket type which is given by Intercom., attribute_id: str # The unique identifier for the ticket type attribute which is given by Intercom.}
@optional {name: str # The name of the ticket type attribute, description: str # The description of the attribute presented to the teammate or contact, required_to_create: bool=false # Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox., required_to_create_for_contacts: bool=false # Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger., visible_on_create: bool=true # Whether the attribute is visible to teammates when creating a ticket in Inbox., visible_to_contacts: bool=true # Whether the attribute is visible to contacts when creating a ticket in Messenger., multiline: bool # Whether the attribute allows multiple lines of text (only applicable to string attributes), list_items: str # A comma delimited list of items for the attribute value (only applicable to list attributes), allow_multiple_values: bool # Whether the attribute allows multiple files to be attached to it (only applicable to file attributes), archived: bool # Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets)}
@returns(200) {type: str, id: str, workspace_id: str, name: str, description: str, data_type: str, input_options: map, order: int, required_to_create: bool, required_to_create_for_contacts: bool, visible_on_create: bool, visible_to_contacts: bool, default: bool, ticket_type_id: int, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)} # Ticket Type Attribute updated
@errors {401: Unauthorized}
@example_request {"description":"New Attribute Description"}

@endpoint GET /ticket_types
@desc List all ticket types
@returns(200) {type: str, ticket_types: [map]} # successful
@errors {401: Unauthorized}

@endpoint POST /ticket_types
@desc Create a ticket type
@required {name: str # The name of the ticket type.}
@optional {description: str # The description of the ticket type., category: str(Customer/Back-office/Tracker) # Category of the Ticket Type., icon: str=🎟️ # The icon of the ticket type., is_internal: bool=false # Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute.}
@returns(200) {type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)} # Ticket type created
@errors {401: Unauthorized}
@example_request {"name":"Customer Issue","description":"Customer Report Template","icon":"🎟️","category":"Customer"}

@endpoint GET /ticket_types/{ticket_type_id}
@desc Retrieve a ticket type
@required {ticket_type_id: str # The unique identifier for the ticket type which is given by Intercom.}
@returns(200) {type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)} # Ticket type found
@errors {401: Unauthorized}

@endpoint PUT /ticket_types/{ticket_type_id}
@desc Update a ticket type
@required {ticket_type_id: str # The unique identifier for the ticket type which is given by Intercom.}
@optional {name: str # The name of the ticket type., description: str # The description of the ticket type., category: str(Customer/Back-office/Tracker) # Category of the Ticket Type., icon: str=🎟️ # The icon of the ticket type., archived: bool # The archived status of the ticket type., is_internal: bool=false # Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute.}
@returns(200) {type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)} # Ticket type updated
@errors {401: Unauthorized}
@example_request {"name":"Bug Report 2"}

@endgroup

@group tickets
@endpoint POST /tickets/{ticket_id}/reply
@desc Reply to a ticket
@required {ticket_id: str}
@returns(200) {type: str, id: str, part_type: str, body: str?, created_at: int(date-time), updated_at: int(date-time), author: map{type: str, id: str, name: str?, email: str(email)}, attachments: [map], redacted: bool} # Admin quick_reply reply
@errors {400: User reply, 401: Unauthorized, 404: Not found}
@example_request {"message_type":"comment","type":"user","intercom_user_id":"667d619d8a68186f43bafe82","body":"Thanks again :)"}

@endpoint POST /tickets/{ticket_id}/tags
@desc Add tag to a ticket
@required {ticket_id: str # ticket_id, id: str # The unique identifier for the tag which is given by Intercom, admin_id: str # The unique identifier for the admin which is given by Intercom.}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Ticket not found}
@example_request {"id":134,"admin_id":991267844}

@endpoint DELETE /tickets/{ticket_id}/tags/{tag_id}
@desc Remove tag from a ticket
@required {ticket_id: str # ticket_id, tag_id: str # The unique identifier for the tag which is given by Intercom, admin_id: str # The unique identifier for the admin which is given by Intercom.}
@returns(200) {type: str, id: str, name: str, applied_at: int(date-time)?, applied_by: map?} # successful
@errors {401: Unauthorized, 404: Tag not found}
@example_request {"admin_id":991267853}

@endpoint POST /tickets
@desc Create a ticket
@required {ticket_type_id: str # The ID of the type of ticket you want to create, contacts: [map] # The list of contacts (users or leads) affected by this ticket. Currently only one is allowed}
@optional {company_id: str # The ID of the company that the ticket is associated with. The ID that you set upon company creation., created_at: int # The time the ticket was created. If not provided, the current time will be used., ticket_attributes: map # The attributes set on the ticket. When setting the default title and description attributes, the attribute keys that should be used are `_default_title_` and `_default_description_`. When setting ticket type attributes of the list attribute type, the key should be the attribute name and the value of the attribute should be the list item id, obtainable by [listing the ticket type](ref:get_ticket-types). For example, if the ticket type has an attribute called `priority` of type `list`, the key should be `priority` and the value of the attribute should be the guid of the list item (e.g. `de1825a0-0164-4070-8ca6-13e22462fa7e`).}
@returns(200) {type: str, id: str, ticket_id: str, category: str, ticket_attributes: map, ticket_state: str, ticket_type: map{type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)}, contacts: map{type: str, contacts: [map]}, admin_assignee_id: str, team_assignee_id: str, created_at: int(date-time), updated_at: int(date-time), open: bool, snoozed_until: int(date-time), linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ticket_parts: map{type: str, ticket_parts: [map], total_count: int}, is_shared: bool, ticket_state_internal_label: str, ticket_state_external_label: str} # Successful response
@errors {401: Unauthorized}
@example_request {"ticket_type_id":106,"contacts":[{"id":"667d61b78a68186f43bafe8d"}],"ticket_attributes":{"_default_title_":"example","_default_description_":"there is a problem"}}

@endpoint PUT /tickets/{ticket_id}
@desc Update a ticket
@required {ticket_id: str # The unique identifier for the ticket which is given by Intercom}
@optional {ticket_attributes: map # The attributes set on the ticket., state: str(in_progress/waiting_on_customer/resolved) # The state of the ticket., open: bool # Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it., is_shared: bool # Specify whether the ticket is visible to users., snoozed_until: int(timestamp) # The time you want the ticket to reopen., assignment: map{admin_id: str, assignee_id: str}}
@returns(200) {type: str, id: str, ticket_id: str, category: str, ticket_attributes: map, ticket_state: str, ticket_type: map{type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)}, contacts: map{type: str, contacts: [map]}, admin_assignee_id: str, team_assignee_id: str, created_at: int(date-time), updated_at: int(date-time), open: bool, snoozed_until: int(date-time), linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ticket_parts: map{type: str, ticket_parts: [map], total_count: int}, is_shared: bool, ticket_state_internal_label: str, ticket_state_external_label: str} # Successful response
@errors {401: Unauthorized, 404: Assignee not found}
@example_request {"ticket_attributes":{"_default_title_":"example","_default_description_":"there is a problem"},"state":"in_progress","assignment":{"admin_id":"991267883","assignee_id":"991267885"},"open":true,"snoozed_until":1673609604}

@endpoint GET /tickets/{ticket_id}
@desc Retrieve a ticket
@required {ticket_id: str # The unique identifier for the ticket which is given by Intercom.}
@returns(200) {type: str, id: str, ticket_id: str, category: str, ticket_attributes: map, ticket_state: str, ticket_type: map{type: str, id: str, category: str, name: str, description: str, icon: str, workspace_id: str, ticket_type_attributes: map{type: str, ticket_type_attributes: [map]}, archived: bool, created_at: int(timestamp), updated_at: int(timestamp)}, contacts: map{type: str, contacts: [map]}, admin_assignee_id: str, team_assignee_id: str, created_at: int(date-time), updated_at: int(date-time), open: bool, snoozed_until: int(date-time), linked_objects: map{type: str, total_count: int, has_more: bool, data: [map]}, ticket_parts: map{type: str, ticket_parts: [map], total_count: int}, is_shared: bool, ticket_state_internal_label: str, ticket_state_external_label: str} # Ticket found
@errors {401: Unauthorized}

@endpoint POST /tickets/search
@desc Search tickets
@required {query: any}
@optional {pagination: map{per_page!: int, starting_after: str}}
@returns(200) {type: str, tickets: [map], total_count: int, pages: map{type: str, page: int, next: map{per_page: int, starting_after: str?}, per_page: int, total_pages: int}} # successful
@example_request {"query":{"operator":"AND","value":[{"field":"created_at","operator":">","value":"1306054154"}]},"pagination":{"per_page":5}}

@endgroup

@group visitors
@endpoint PUT /visitors
@desc Update a visitor
@optional {id: str # A unique identified for the visitor which is given by Intercom., user_id: str # A unique identified for the visitor which is given by you., name: str # The visitor's name., custom_attributes: map # The custom attributes which are set for the visitor.}
@returns(200) {type: str, id: str, user_id: str, anonymous: bool, email: str(email), phone: str?, name: str?, pseudonym: str?, avatar: map{type: str, image_url: str(uri)?}, app_id: str, companies: map{type: str, companies: [map]}, location_data: map{type: str, city_name: str, continent_code: str, country_code: str, country_name: str, postal_code: str, region_name: str, timezone: str}, las_request_at: int, created_at: int, remote_created_at: int, signed_up_at: int, updated_at: int, session_count: int, social_profiles: map{type: str, social_profiles: [str]}, owner_id: str?, unsubscribed_from_emails: bool, marked_email_as_spam: bool, has_hard_bounced: bool, tags: map{type: str, tags: [any]}, segments: map{type: str, segments: [str]}, custom_attributes: map, referrer: str?, utm_campaign: str?, utm_content: str?, utm_medium: str?, utm_source: str?, utm_term: str?, do_not_track: bool?} # successful
@errors {401: Unauthorized, 404: visitor Not Found}
@example_request {"id":"667d61cc8a68186f43bafe95","name":"Gareth Bale"}

@endpoint GET /visitors
@desc Retrieve a visitor with User ID
@required {user_id: str # The user_id of the Visitor you want to retrieve.}
@returns(200) {type: str, id: str, user_id: str, anonymous: bool, email: str(email), phone: str?, name: str?, pseudonym: str?, avatar: map{type: str, image_url: str(uri)?}, app_id: str, companies: map{type: str, companies: [map]}, location_data: map{type: str, city_name: str, continent_code: str, country_code: str, country_name: str, postal_code: str, region_name: str, timezone: str}, las_request_at: int, created_at: int, remote_created_at: int, signed_up_at: int, updated_at: int, session_count: int, social_profiles: map{type: str, social_profiles: [str]}, owner_id: str?, unsubscribed_from_emails: bool, marked_email_as_spam: bool, has_hard_bounced: bool, tags: map{type: str, tags: [any]}, segments: map{type: str, segments: [str]}, custom_attributes: map, referrer: str?, utm_campaign: str?, utm_content: str?, utm_medium: str?, utm_source: str?, utm_term: str?, do_not_track: bool?} # successful
@errors {401: Unauthorized, 404: Visitor not found}

@endpoint POST /visitors/convert
@desc Convert a visitor
@required {type: str # Represents the role of the Contact model. Accepts `lead` or `user`., user: map{id: str, user_id: str, email: str} # The unique identifiers retained after converting or merging., visitor: map{id: str, user_id: str, email: str} # The unique identifiers to convert a single Visitor.}
@returns(200) {type: str, id: str, external_id: str?, workspace_id: str, role: str, email: str, email_domain: str, phone: str?, formatted_phone: str?, name: str?, owner_id: int?, has_hard_bounced: bool, marked_email_as_spam: bool, unsubscribed_from_emails: bool, created_at: int(date-time), updated_at: int(date-time), signed_up_at: int(date-time)?, last_seen_at: int(date-time)?, last_replied_at: int(date-time)?, last_contacted_at: int(date-time)?, last_email_opened_at: int(date-time)?, last_email_clicked_at: int(date-time)?, language_override: str?, browser: str?, browser_version: str?, browser_language: str?, os: str?, android_app_name: str?, android_app_version: str?, android_device: str?, android_os_version: str?, android_sdk_version: str?, android_last_seen_at: int(date-time)?, ios_app_name: str?, ios_app_version: str?, ios_device: str?, ios_os_version: str?, ios_sdk_version: str?, ios_last_seen_at: int(date-time)?, custom_attributes: map, avatar: map?{type: str, image_url: str(uri)?}, tags: map{data: [map], url: str(uri), total_count: int, has_more: bool}, notes: map{data: [map], url: str(uri), total_count: int, has_more: bool}, companies: map{type: str, data: [map], url: str(uri), total_count: int, has_more: bool}, location: map{type: str, country: str?, region: str?, city: str?}, social_profiles: map{data: [map]}} # successful
@errors {401: Unauthorized}
@example_request {"visitor":{"user_id":"3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3"},"user":{"email":"foo@bar.com"},"type":"user"}

@endgroup

@end
