{"info":{"_postman_id":"caf4c483-c1ac-4f40-8a71-21d65c560d9e","name":"BPCC Task Routing API","description":"<html><head></head><body><p>The Bright Pattern Contact Center (BPCC) Task Routing API v1 is a RESTful API that enables external systems (such as CRMs) to create, route, modify, cancel, and query tasks in BPCC.</p>\n<h2 id=\"features\">Features</h2>\n<p>The Task Routing API v1 supports the following:</p>\n<ul>\n<li><p><strong>Queue Task:</strong> Create and queue a new task, associating it with a case and a contact.</p>\n</li>\n<li><p><strong>Cancel Task:</strong> Remove a specific task from the queue and set its disposition.</p>\n</li>\n<li><p><strong>Cancel Service Tasks:</strong> Cancel all queued tasks associated with a particular service.</p>\n</li>\n<li><p><strong>Update Task:</strong> Modify attributes of a queued task, such as its service or priority.</p>\n</li>\n<li><p><strong>Query Task:</strong> Retrieve the status and queue information for a specific task.</p>\n</li>\n<li><p><strong>Support for external identifiers:</strong> Entities can be referenced using either internal (automatically generated by BPCC) or external (user provided) identifiers.</p>\n</li>\n</ul>\n<h2 id=\"entities\">Entities</h2>\n<p>This API interacts with the following core objects within Bright Pattern Contact Center:</p>\n<ul>\n<li><p><strong>Task:</strong> A discrete unit of work representing a specific action or activity to be completed by an agent. Tasks are always associated with a case and contact. When a task is queued, it may be associated with an external identifier. Existing tasks may be canceled, updated, and queried by their internal or external identifiers.</p>\n</li>\n<li><p><strong>Case:</strong> A <a href=\"https://help.brightpattern.com/Agent-guide/Work/CasesEmail/CasesEmailandThreads#Cases_and_Email\">grouping of communications and information</a> related to a specific customer request. Cases are always associated with a contact. When a case is created via API, it may be linked with an external identifier. When a task is queued, an existing case may be associated with the task using the case's external identifier.</p>\n</li>\n<li><p><strong>Contact:</strong> A <a href=\"https://help.brightpattern.com/Agent-guide/Work/Contacts/Overview\">customer or individual</a> involved in interactions. When a contact is created via API, it may be linked with an external identifier. When a task is queued, a contact can be associated with the task using the contact's external identifier.</p>\n</li>\n</ul>\n<h2 id=\"endpoint-prefix\">Endpoint Prefix</h2>\n<p>The Task Routing API v1 endpoint prefix is as follows:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>https://&lt;tenant_url&gt;/taskroutingapi/v1/\n\n</code></pre><h1 id=\"audience\">Audience</h1>\n<p>This documentation is intended for IT personnel and developers responsible for integrating external systems with Bright Pattern Contact Center. Readers should have some familiarity of REST APIs, JSON data structures, and contact center concepts like services, queues, and dispositions. Experience with scripting or programming is recommended for implementing integrations using this API.</p>\n<h1 id=\"usage\">Usage</h1>\n<p>This documentation includes examples for each API method. These examples can serve as a starting point for developing your integrations. You can load these API descriptions into the <a href=\"https://www.getpostman.com/\">Postman API Development Environment</a> to interact with the API using your own access tokens.</p>\n<p>Task Routing requests and responses may carry a JSON-encoded body of type <code>application/json</code>. Successful response bodies differ by method. Failed responses return the following:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-JSON\">{\n\"errorCode\": [integer number],\n\"errorMessage\": \"[string with error description]\"\n}\n\n</code></pre>\n<h2 id=\"authorization\">Authorization</h2>\n<p>Users must be granted the <strong>Use Task Routing API</strong> privilege in order to use the following API methods. Administrators can grant this privilege in the Contact Center under <a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/UsersandTeams/Privileges#Service_and_Campaign_Administration\"><b>Roles</b> &gt; <b>Service and Campaign Administration</b></a></p>\n<p>For more information, refer to the Administration Configuration Guide.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Audience","slug":"audience"},{"content":"Usage","slug":"usage"}],"owner":"31590362","collectionId":"caf4c483-c1ac-4f40-8a71-21d65c560d9e","publishedId":"2sA3XTfLhk","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2024-06-19T22:51:32.000Z"},"item":[{"name":"Authentication","item":[{"name":"Get access token","id":"c3d65020-eece-42ed-88f7-0b7e73244468","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"client_id","value":"String (Username)","type":"text","description":"<p><a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/Users#Username\">Username</a> of a BPCC user with the <a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/UsersandTeams/Privileges\">User Privilege</a> <em>Use Task Routing API</em> enabled.</p>\n"},{"key":"client_secret","value":"String (API Token)","type":"text","description":"<p>The <a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/UsersandTeams/Users#API_secret\">API secret key</a> generated for the user specified by <strong>client_id</strong> </p>\n"},{"key":"scope","value":"String (URL)","type":"text","description":"<p>Your tenant URL, e.g., <em>example.brightpattern.com</em></p>\n"},{"key":"grant_type","value":"String (\"client_credentials\")","type":"text","description":"<p>Grant type. Must be set to <em>client_credentials</em>.</p>\n"}]},"url":"https://<tenant-url>/configapi/v2/oauth/token","description":"<p>Returns the access token that must be used to authenticate each subsequent request made via this API.</p>\n","urlObject":{"protocol":"https","path":["configapi","v2","oauth","token"],"host":["<tenant-url>"],"query":[],"variable":[]}},"response":[{"id":"6081d254-3354-40be-9ce9-43a3e12230c6","name":"Get Access Tokan","originalRequest":{"method":"POST","header":[],"body":{"mode":"urlencoded","urlencoded":[{"key":"client_id","value":"bot","type":"text"},{"key":"client_secret","value":"5O3yBrH5j1GqLVG0qDS7M1kKXhprngJNWV10eh8g0fu7yc9SVyWtquJ4SNQffu3G","type":"text"},{"key":"scope","value":"example.tenant.com","type":"text"},{"key":"grant_type","value":"client_credentials","type":"text"}]},"url":"https://<tenant-url>/configapi/v2/oauth/token"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx/1.21.0"},{"key":"Date","value":"Fri, 15 Dec 2023 16:47:24 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"147"},{"key":"Connection","value":"keep-alive"}],"cookie":[],"responseTime":null,"body":"{\n    \"access_token\": \"6538A1974B81A0391A1C410AF9ACCEA5E6FE7EAF52FE7B90D2A9CB67D0254841\",\n    \"token_type\": \"Bearer\",\n    \"expires_in\": \"3600\",\n    \"scope\": \"example.tenant.com\"\n}"}],"_postman_id":"c3d65020-eece-42ed-88f7-0b7e73244468"}],"id":"006d6101-7e31-4510-8cfa-43c0ab1e0b2e","description":"<p>The <a href=\"https://tools.ietf.org/html/rfc6749#section-4.4\">OAuth 2.0 Client Credentials Grant</a> is used to authenticate clients of this API. The authenticated user is checked for having appropriate privileges to perform the requested operation. The complete list of privileges can be found <a href=\"https://help.brightpattern.com/5.3:Contact-center-administrator-guide/Privileges\">here</a>. Privileges are assigned to users via one or more <a href=\"https://help.brightpattern.com/5.3:Contact-center-administrator-guide/Roles\">Roles</a>.</p>\n<p>To obtain an access token:</p>\n<ol>\n<li><p>Login to your BPCC admin portal.</p>\n</li>\n<li><p>Navigate to <a href=\"https://help.brightpattern.com/5.3:Contact-center-administrator-guide/Users\">Users</a> page.</p>\n</li>\n<li><p>Select or create a user with the privilege <em>Use Taskrouting API</em>.</p>\n</li>\n<li><p>Click the Generate button to generate an <a href=\"https://help.brightpattern.com/5.3:Contact-center-administrator-guide/UsersandTeams/Users#API_secret\">API secret key</a>. Copy the generated key and note the username.</p>\n</li>\n<li><p>Use the <em>Get Access Token</em> method to obtain an access token. Set the <em>client_id</em> to the above username and <em>client_secret</em> to the generated API secrect key.</p>\n</li>\n<li><p>Use the value of <em>access_token</em> returned in the response to set the <em>Authorization: Bearer [access token]</em> header of each subsequent request made via the BPCC Task Routing API.</p>\n</li>\n</ol>\n","_postman_id":"006d6101-7e31-4510-8cfa-43c0ab1e0b2e"},{"name":"Task Routing","item":[{"name":"Queue Task","id":"b6986eed-444a-41cc-88a3-7013bc0e152a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"extTaskId\": \"task_id_12345_external_crm\",\n    \"extCaseId\": \"case_id_67890_external_crm\",\n    \"extContactId\": \"contact_id_6789_external_crm\",\n    \"serviceName\": \"Task Service\",\n    \"screenpop\": \"SHOW_OBJECT:192837465:task\",\n    \"screenpopData\": [\n    {\n        \"type\": \"web\",\n        \"url\": \"https://www.brightpattern.com\",\n        \"label\": \"The Title\",\n        \"webScreenpopShowInTab\": true\n    },\n    {\n        \"type\": \"web\",\n        \"url\": \"https://www.someotherurl.com\",\n        \"label\": \"A different title that doesn't matter, since it's not opened in a tab\",\n        \"webScreenpopShowInTab\": false\n    },\n    {\n        \"type\": \"dynamicscrm\",\n        \"url\": \"SHOW_OBJECT:5551212:task\",\n        \"screenpopShowUponAnswer\": true\n    }],\n    \"webScreenpopShowInTab\": true,\n    \"screenpopShowUponAnswer\": false,\n    \"priority\": 2,\n    \"taskLaunchPointId\": \"952e8dc2e0469c349cb9c02c9b31f9150b7afd7a\",\n    \"order\": \"fifo\",\n    \"contactInfo\":\n    {\n        \"firstName\": \"John\",\n        \"lastName\": \"Doe\",\n        \"title\": \"Senior Manager\",\n        \"position\": \"Head of Engineering\",\n        \"summary\": \"Experienced leader in software development.\",\n        \"segment\": \"High Value Customer\",\n        \"dob\": \"1980-05-10T00:00:00.000Z\",\n        \"emails\": [\n        {\n            \"type\": \"PRIMARY\",\n            \"address\": \"john.doe@example.com\"\n        },\n        {\n            \"type\": \"BUSINESS\",\n            \"address\": \"john.doe.business@example.com\"\n        }],\n        \"addresses\": [\n        {\n            \"type\": \"PRIMARY\",\n            \"postcode\": \"90210\",\n            \"state\": \"CA\",\n            \"city\": \"Beverly Hills\",\n            \"addressLine1\": \"123 Main Street\",\n            \"addressLine2\": \"Suite 456\",\n            \"country\": \"USA\"\n        }],\n        \"custom_signup_source\": \"Website\"\n    },\n    \"caseInfo\":\n    {\n        \"category\": \"Technical Support\",\n        \"priority\": 1,\n        \"custom_related_knowledge_base_article\": \"KB-12345\"\n    },\n    \"taskInfo\":\n    {\n        \"subject\": \"Follow up on customer issue\",\n        \"custom_task_notes\": \"Offer a reduced subscription price if customer is not satisfied by the resolution.\"\n    }\n}"},"url":"https://<tenant-url>/taskroutingapi/v1/task/","description":"<p>Queue a task and associate it with a case and contact.</p>\n<p>Optionally, you may provide external IDs to associate with the task, case, or contact to prevent duplicates. When external IDs are provided:</p>\n<ol>\n<li><p>BPCC checks for existing records linked with the provided External IDs for the task, case, or contact.</p>\n</li>\n<li><p><strong>If a match is found</strong> for an External ID, the corresponding existing record in BPCC is used.</p>\n</li>\n<li><p><strong>If no match is found</strong> for an External ID, a new record (task, case, or contact) is created in BPCC and associated with that External ID.</p>\n</li>\n<li><p>Finally, the task (whether found or newly created) is linked to the case and contact entities (whether found or newly created) and queued in the indicated service.</p>\n</li>\n</ol>\n<h3 id=\"request-body\">Request Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>extTaskId</td>\n<td>Unique identifier from an external system such as a CRM or database.  <br />- If an existing task in BPCC is already linked with <strong>extTaskId</strong>, any data in <strong>taskInfo</strong>, <strong>caseInfo</strong> and <strong>contactInfo</strong> are ignored, and the linked task is queued.  <br />- If a task linked with <strong>extTaskId</strong> does not exist in BPCC, a new task will be created with data from <strong>taskInfo</strong> and linked with the provided <strong>extTaskId</strong>.  <br />- If no <strong>extTaskId</strong> is provided, a new task will be created and queued with data from <strong>taskInfo</strong>.  <br />Optional.</td>\n</tr>\n<tr>\n<td>extCaseId</td>\n<td>Unique identifier from an external system such as a CRM or database.  <br />- If an existing case in BPCC is linked with <strong>extCaseId</strong>, the case is associated with the queued task and any data in <strong>caseInfo</strong> and <strong>contactInfo</strong> are ignored.  <br />- If a case linked to <strong>extCaseId</strong> does not exist, a new case is created with data from <strong>taskInfo</strong>, linked to <strong>extCaseId</strong>, and associated with the queued task.  <br />- If no <strong>extCaseId</strong> is provided, a new case is created with data from <strong>taskInfo</strong> and associated with the queued task.  <br />Optional.</td>\n</tr>\n<tr>\n<td>extContactId</td>\n<td>Unique identifier from an external system such as a CRM or database.  <br />- If an existing BPCC contact is linked with <strong>extContactId</strong>, the contact is associated with the queued task's case, and <strong>contactInfo</strong> is ignored.  <br />- If a contact linked with <strong>extContactId</strong> does not exist, a BPCC contact is created with data from <strong>contactInfo</strong>, linked with <strong>extContactId</strong>, and associated with the queued task's case,.  <br />- If no <strong>extContactId</strong> is provided, a contact is created with data from <strong>contactInfo</strong> and associated with the queued task's case.  <br />Optional.</td>\n</tr>\n<tr>\n<td>serviceName</td>\n<td>Name of the <a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/ServicesandCampaigns/ServicesandCampaignsOverview\">Service</a> where the task will be queued. Overrides the service specified by the scenario entry indicated by <code>taskLaunchPointId</code>.  <br />- Optional if <code>taskLaunchPointId</code> is provided.  <br />- Required if <code>taskLaunchPointId</code> is omitted</td>\n</tr>\n<tr>\n<td>screenpop</td>\n<td>The <a href=\"https://help.brightpattern.com/Microsoft-dynamics-365-integration-guide/Configuration/ScreenpopforPreviewCampaigns#2a._Configure_the_Screenpop_URL\">CRM screen pop URL</a> or regular web URL screen pop to associated with the task. Example formats: <code>SHOW_OBJECT:5551212:task</code> or <code>https://brightpattern.com</code>  <br />CRM screen pops can only be displayed to agents using the BPCC widget in a CRM. To configure multiple screen pops, use the <strong>screenpopData</strong> property.  <br />Optional.</td>\n</tr>\n<tr>\n<td>screenpopData</td>\n<td>Array of <strong>screenpopData</strong> objects.  <br />- Multiple web URL screen pops can be displayed if the agent is using the Agent Desktop.  <br />- A CRM screen pop will only be displayed to an agent using the Agent Desktop widget embedded in the corresponding CRM application.  <br />- Only a single CRM screen pop can be displayed to an agent. If multiple CRM screen pops of a single type appear in the array, the last one will be used.  <br />Available properties are described below.  <br />Optional</td>\n</tr>\n<tr>\n<td>webScreenpopShowInTab</td>\n<td>Boolean specifying if a web URL screenpop should be opened in a new browser tab. Default is <code>false</code>.  <br />- When <code>true</code> the <strong>screenpop</strong> is opened in a new tab.  <br />- When <code>false</code> the <strong>screenpop</strong> is opened in the Agent Desktop.  <br />- Must be <code>true</code> in order to display a web URL screenpop to an agent using the BPCC widget in a CRM. If <code>false</code>, the screenpop can not be displayed  <br />- Ignored if <strong>screenpop</strong> is a CRM screenpop URL.  <br />Optional.</td>\n</tr>\n<tr>\n<td>screenpopShowUponAnswer</td>\n<td>Boolean specifying if web screenpop should be opened when the agent accepts the task. Default value is <code>false</code>  <br />- When <code>true</code>, the screenpop will be displayed after the user answers (accepts) the task.  <br />- When <code>false</code>, the screenpop will display immediately as the task is assigned to an agent.  <br />The value of <strong>screenpopShowUponAnswer</strong> sets the flag <strong>popUponAnswer</strong> to the <a href=\"https://help.brightpattern.com/AgentDesktop-client-side-javascript-api-specification/onWebScreenPopCustom\">Agent Desktop Client-Side JavaScript callback onWebScreenPopCustom</a>.  <br />Optional.</td>\n</tr>\n<tr>\n<td>priority</td>\n<td>Task priority expressed as a number between <code>0.01</code> and <code>100</code>, inclusive. A higher value will cause a task to move through the queue faster than tasks with a lower value, following the logic of <a href=\"https://help.brightpattern.com/Scenario-builder-reference-guide/ScenarioBlocks/SetPriority#Priority_Values\">Priority Value in the Set Priority scenario block</a>.  <br />If provided, overrides the priority defined by the <em>Scenario Entry</em> indicated by <code>taskLaunchPointId</code>.  <br />If both <code>priority</code> and <code>taskLaunchPointId</code> are omitted, default value is <code>1</code>  <br />Optional.</td>\n</tr>\n<tr>\n<td>order</td>\n<td>Queue order of the task. Default is <code>fifo</code>.  <br />- <code>fifo</code> indicates 'First in, first out', meaning that the task will be assigned to an agent before any subsequently-queued tasks are assigned.  <br />- <code>lifo</code> indicates 'Last in, first out', meaning that the task will be assigned to an agent only after all previously-queued tasks are assigned. The <strong>priority</strong> value will be ignored for tasks with <code>lifo</code> ordering.  <br />Optional.</td>\n</tr>\n<tr>\n<td>contactInfo</td>\n<td>Used to create a contact. Required if <strong>extContactId</strong> is not provided or if no internal contact is associated with the provided <strong>extContactId</strong>. Available properties are listed below.  <br />Optional.</td>\n</tr>\n<tr>\n<td>caseInfo</td>\n<td>Used to create a case. Required if <strong>extCaseId</strong> is not provided or if no internal case is linked with <strong>extCaseId</strong>. Available properties are listed below.  <br />Optional.</td>\n</tr>\n<tr>\n<td>taskInfo</td>\n<td>Used to create a task. Required if <strong>extTaskId</strong> is not provided, or if no task is linked with <strong>extTaskId</strong>. Available properties are listed below.  <br />Optional.</td>\n</tr>\n<tr>\n<td>taskLaunchPointId</td>\n<td>Indicate the <strong>Unique Identifier</strong> of the <a href=\"https://help.brightpattern.com/Contact-center-administrator-guide/ScenarioEntries/Tasks\">Task Scenario Entry</a> that should be used when queuing the task.  <br />Task <em>Scenario Entries</em> provide a default <em>Service</em> with which to associate the task, and may define a default <em>Priority</em>.  <br />- The default <em>Service</em> defined by the <em>Scenario Entry</em> can be overridden by indicating a different <em>Service</em> with the <strong>serviceName</strong> property.  <br />- The default <em>Priority</em> defined by the <em>Scenario Entry</em> can be overridden with the <code>priority</code> property.  <br />Optional</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"contactinfo-properties\"><code>contactInfo</code> Properties:</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>firstName</td>\n<td>Contact's first name.  <br />Required.</td>\n</tr>\n<tr>\n<td>lastName</td>\n<td>Contact's last name.  <br />Optional.</td>\n</tr>\n<tr>\n<td>title</td>\n<td>Contact's title.  <br />Optional.</td>\n</tr>\n<tr>\n<td>position</td>\n<td>Contact's position.  <br />Optional.</td>\n</tr>\n<tr>\n<td>summary</td>\n<td>Summary of the contact.  <br />Optional.</td>\n</tr>\n<tr>\n<td>segment</td>\n<td>Customer segment.  <br />Optional.</td>\n</tr>\n<tr>\n<td>dob</td>\n<td>Customer's date of birth in the <code>YYYY-MM-DDTHH:mm:ss.sssZ</code> format.  <br />Optional.</td>\n</tr>\n<tr>\n<td>emails</td>\n<td>An array of email addresses associated with the contact. Available Properties for each array element are listed below.  <br />Optional.</td>\n</tr>\n<tr>\n<td>addresses</td>\n<td>An array of postal addresses associated with the contact. Available Properties for each array element are listed below.  <br />Optional.</td>\n</tr>\n<tr>\n<td>custom_</td>\n<td>Other custom fields.  <br />Optional.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"contactinfoemails-array-element-properties\"><code>contactInfo.emails</code> Array Element Properties:</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>Email type (PRIMARY, BUSINESS, PRIVATE).  <br />Required.</td>\n</tr>\n<tr>\n<td>address</td>\n<td>Email address.  <br />Required.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"contactinfoaddresses-array-element-properties\"><code>contactInfo.addresses</code> Array Element Properties:</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>Address type (PRIMARY, BILLING, SHIPPING, OTHER).  <br />Required.</td>\n</tr>\n<tr>\n<td>postcode</td>\n<td>Postal code.  <br />Optional.</td>\n</tr>\n<tr>\n<td>state</td>\n<td>State.  <br />Optional.</td>\n</tr>\n<tr>\n<td>city</td>\n<td>City.  <br />Optional.</td>\n</tr>\n<tr>\n<td>addressLine1</td>\n<td>Address line 1.  <br />Optional.</td>\n</tr>\n<tr>\n<td>addressLine2</td>\n<td>Address line 2.  <br />Optional.</td>\n</tr>\n<tr>\n<td>country</td>\n<td>Country.  <br />Optional.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"screenpopdata-array-element-properties\"><code>screenpopData</code> Array Element Properties:</h3>\n<p>Use the <code>screenpopData</code> array to define multiple screen pops that will be displayed conditionally based on the agent's client application (Full Agent Desktop or integrated CRM Widget):</p>\n<h6 id=\"full-agent-desktop\">Full Agent Desktop</h6>\n<ul>\n<li><p>If the agent accepts the task in the full Agent Desktop application, only screen pops with <code>type: \"web\"</code> will be displayed. Multiple <code>web</code> screen pops can be shown simultaneously (e.g., in separate tabs or embedded frames, depending on the <code>webScreenpopShowInTab</code> setting).</p>\n</li>\n<li><p>You can include multiple objects with type <code>web</code>. All defined <code>web</code> screen pops will be attempted. However, the last values for <code>webScreenpopShowInTab</code> and <code>screenpopShowUponAnswer</code> encountered in the array elements are applied to <em>all</em> screen pops.</p>\n</li>\n</ul>\n<h6 id=\"integrated-crm-widget\">Integrated CRM Widget</h6>\n<ul>\n<li><p>If the agent accepts the task within a specific CRM widget (e.g., Dynamics, Salesforce, ServiceNow, or Zendesk), the system looks for a screen pop object in the array with a <code>type</code> matching that CRM (e.g., <code>type: \"dynamicscrm\"</code>). If found, only that specific CRM screen pop is displayed within the widget interface. Any <code>web</code> type screen pops in the array are ignored.</p>\n</li>\n<li><p>If a matching CRM <code>type</code> is <em>not</em> found in the array, the system then looks for a <code>web</code> type screen pop. If a <code>web</code> screen pop exists, it will be displayed <em>only</em> if its <code>webScreenpopShowInTab</code> setting is <code>true</code> (either explicitly set in the object or inherited from the request's top level). If <code>webScreenpopShowInTab</code> is <code>false</code>, the web screen pop cannot be displayed in the widget.</p>\n</li>\n<li><p>If both the full Agent Desktop and a CRM widget are open, and the <code>screenpopData</code> contains both a matching CRM type and a <code>web</code> type, only the CRM screen pop will be shown when the task is accepted in the widget.</p>\n</li>\n<li><p>You can include multiple objects corresponding to different CRMs (e.g., one for <code>dynamicscrm</code>, one for <code>salesforce</code>). However, if you include multiple objects with the <em>same</em> CRM type (e.g., two objects with <code>type: \"dynamicscrm\"</code>), only the <em>last</em> object of that specific CRM type in the array will be used.</p>\n</li>\n</ul>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>Specifies the type of screen pop. Valid values are:  <br />- <code>web</code>  <br />- <code>dynamicscrm</code>  <br />- <code>servicenow</code>  <br />- <code>zendesk</code>  <br />- <code>salesforce</code>  <br />Determines which agent interface (full Agent Desktop or specific CRM widget) can display this screen pop.</td>\n</tr>\n<tr>\n<td>url</td>\n<td>The web URL (e.g., <code>https://brightpattern.com</code>) or preview-encoded CRM URL (e.g., <code>SHOW_OBJECT:5551212:task</code>) to be displayed.</td>\n</tr>\n<tr>\n<td>label</td>\n<td>Defines the browser tab title when <strong>type</strong> is <code>web</code> and the screen pop is configured to open in a new tab (<strong>webScreenpopShowInTab</strong> is <code>true</code>). Ignored in all other cases.  <br />Optional.</td>\n</tr>\n<tr>\n<td>webScreenpopShowInTab</td>\n<td>Boolean. For <code>web</code> type screenpops only. If present, overrides the top-level <strong>webScreenpopShowInTab</strong> setting for this specific screen pop. Determines if the web screen pop opens in a new browser tab (<code>true</code>) or within the Agent Desktop (<code>false</code>). Ignored for CRM type screen pops.  <br />Optional.</td>\n</tr>\n<tr>\n<td>screenpopShowUponAnswer</td>\n<td>Boolean. If present, overrides the top-level <strong>screenpopShowUponAnswer</strong> setting for this specific screen pop. Determines if the screen pop displays immediately upon task assignment (<code>false</code>) or only after the agent accepts the task (<code>true</code>).  <br />Optional.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"caseinfo-properties\"><code>caseInfo</code> Properties:</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>category</td>\n<td>Case category name. Must match an existing case category.  <br />Required</td>\n</tr>\n<tr>\n<td>custom_*</td>\n<td>Other custom fields.  <br />Optional.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"taskinfo-properties\"><code>taskInfo</code> Properties:</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>subject</td>\n<td>Task subject.  <br />Required.</td>\n</tr>\n<tr>\n<td>custom_*</td>\n<td>Other custom fields.  <br />Optional</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"response-properties\">Response Properties</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>taskId</td>\n<td>Internal ID of the queued internal task.</td>\n</tr>\n<tr>\n<td>caseId</td>\n<td>Internal ID of the case linked with the queued task.</td>\n</tr>\n<tr>\n<td>contactId</td>\n<td>Internal ID of the contact associated with the case linked to the queued task.</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"protocol":"https","path":["taskroutingapi","v1","task",""],"host":["<tenant-url>"],"query":[],"variable":[]}},"response":[{"id":"1bf1af9c-e0b4-4758-8912-b42c8a55f249","name":"Queue Task","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"Bearer E9C97B84D0F72C08A1B31916A1646B91618F63F146CC3694CD2523B63F732363","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"extTaskId\": \"task_id_12345_external_crm\",\n  \"extCaseId\": \"f0g9h8i7-j6k5-l4m3-n2o1-p0q9r8s7t6u5\",\n  \"extContactId\": \"contact_id_6789_external_crm\",\n  \"serviceName\": \"Task Service\",\n  \"screenpop\": \"SHOW_OBJECT:192837465:task\",\n  \"webScreenpopShowInTab\": true,\n  \"screenpopShowUponAnswer\": false,\n  \"priority\": 2,\n  \"taskLaunchPointId\": \"952e8dc2e0469c349cb9c02c9b31f9150b7afd7a\",\n  \"order\": \"fifo\",\n  \"contactInfo\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Doe\",\n    \"title\": \"Senior Manager\",\n    \"position\": \"Head of Engineering\",\n    \"summary\": \"Experienced leader in software development.\",\n    \"segment\": \"High Value Customer\",\n    \"dob\": \"1980-05-10T00:00:00.000Z\",\n    \"emails\": [\n      {\n        \"type\": \"PRIMARY\",\n        \"address\": \"john.doe@example.com\"\n      },\n      {\n        \"type\": \"BUSINESS\",\n        \"address\": \"john.doe.business@example.com\"\n      }\n    ],\n    \"addresses\": [\n      {\n        \"type\": \"PRIMARY\",\n        \"postcode\": \"90210\",\n        \"state\": \"CA\",\n        \"city\": \"Beverly Hills\",\n        \"addressLine1\": \"123 Main Street\",\n        \"addressLine2\": \"Suite 456\",\n        \"country\": \"USA\"\n      }\n    ],\n    \"custom_field_1\": \"Value 1\",\n    \"custom_field_2\": \"Value 2\"\n  },\n  \"caseInfo\": {\n    \"category\": \"Technical Support\",\n    \"custom_case_description\": \"Issue with product X\"\n  },\n  \"taskInfo\": {\n    \"subject\": \"Follow up on customer issue\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"https://<tenant-url>/taskroutingapi/v1/task"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"taskId\": \"66bb3a68bf36507742b4c612\",\n    \"caseId\": \"66bb3a68bf36507742b4c611\",\n    \"contactId\": \"66bb3a68bf36507742b4c610\"\n}"}],"_postman_id":"b6986eed-444a-41cc-88a3-7013bc0e152a"},{"name":"Cancel Task","id":"3ea6cb52-3959-418b-8a44-8c05875accbc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"note\":\"Cancelled per user request\",\n    \"dispositionName\":\"Abandoned\"\n}"},"url":"https://<tenant-url>/taskroutingapi/v1/task/:taskid/?external=Boolean","description":"<p>Removes the queued task specified by the <strong>taskId</strong> path variable from the queue and sets its disposition to <strong>dispositionName</strong>. Canceling a task is possible only while the task is still in the service queue or an agent's personal queue.</p>\n<p>Use the <strong>external</strong> query parameter to specify whether <strong>taskId</strong> is an internal or external identifier.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>note</td>\n<td>An optional note to be added to the task as it is canceled, providing context for the action.</td>\n</tr>\n<tr>\n<td>dispositionName</td>\n<td>The name of the disposition to be applied to the canceled task, indicating the outcome or reason for closure. Default is <code>Abandoned</code></td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"response-body-parameters\">Response Body Parameters</h3>\n<p>None</p>\n","urlObject":{"protocol":"https","path":["taskroutingapi","v1","task",":taskid",""],"host":["<tenant-url>"],"query":[{"description":{"content":"<p>Indicates whether the <strong>taskId</strong> specified in the path is an external task ID (from a CRM or other external system) or an internal task ID generated by Bright Pattern Contact Center.</p>\n","type":"text/plain"},"key":"external","value":"Boolean"}],"variable":[{"description":{"content":"<p>Identifies the task to be canceled, using either its internal or external ID as specified by the <strong>external</strong> query parameter. </p>\n","type":"text/plain"},"type":"any","value":"String (task ID)","key":"taskid"}]}},"response":[{"id":"7c39f98d-6eb2-4040-86d2-a86cb497e80a","name":"Cancel Task","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"Bearer E9C97B84D0F72C08A1B31916A1646B91618F63F146CC3694CD2523B63F732363","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"note\":\"Cancelled per user request\",\n    \"dispositionName\":\"Abandoned\"\n}"},"url":{"raw":"https://<tenant-url>/taskroutingapi/v1/task/:taskid/?external=false","protocol":"https","host":["<tenant-url>"],"path":["taskroutingapi","v1","task",":taskid",""],"query":[{"key":"external","value":"false"}],"variable":[{"key":"taskid","value":"{{task_id}}"}]}},"status":"No Content","code":204,"_postman_previewlanguage":"plain","header":[{"key":"Server","value":"nginx/1.25.4"},{"key":"Date","value":"Fri, 22 Mar 2024 16:11:06 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"GET, POST, DELETE, PUT"},{"key":"Access-Control-Allow-Headers","value":"Content-Type"}],"cookie":[],"responseTime":null,"body":""}],"_postman_id":"3ea6cb52-3959-418b-8a44-8c05875accbc"},{"name":"Cancel Service Tasks","id":"b8e3851e-1308-4160-be2e-954ad32a39fd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"note\":\"This service is no longer being offered.\",\n    \"serviceName\":\"Example Service\",\n    \"dispositionName\":\"Abandoned\"\n}"},"url":"https://<tenant-url>/taskroutingapi/v1/service","description":"<p>Cancel all currently queued tasks associated with the service specified by <strong>serviceName</strong>. The disposition designated by <strong>dispositionName</strong> and the note specified by <strong>note</strong> is applied to each canceled task.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>serviceName</td>\n<td>The name of the service for which all associated queued tasks should be canceled.</td>\n</tr>\n<tr>\n<td>note</td>\n<td>An optional note to be added to each task as it is canceled.</td>\n</tr>\n<tr>\n<td>dispositionName</td>\n<td>The name of the disposition to apply to each canceled tasks.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"response-body\">Response Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>count</td>\n<td>The count of tasks canceled by the operation.</td>\n</tr>\n<tr>\n<td>taskIds</td>\n<td>Array of objects indicating the <code>extTaskId</code> and <code>taskId</code> of each canceled task.</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"protocol":"https","path":["taskroutingapi","v1","service"],"host":["<tenant-url>"],"query":[],"variable":[]}},"response":[{"id":"4c95d975-8ee6-4c90-bb46-31dfdcf7d958","name":"Cancel Service Tasks","originalRequest":{"method":"DELETE","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"Bearer E9C97B84D0F72C08A1B31916A1646B91618F63F146CC3694CD2523B63F732363","type":"text"}],"body":{"mode":"raw","raw":"{\n\"note\":\"Example service will no longer be provided.\",\n\"serviceName\":\"Example service\",\n\"dispositionName\":\"Abandoned\"\n}\n","options":{"raw":{"language":"json"}}},"url":"https://<tenant-url>/taskroutingapi/v1/service"},"status":"No Content","code":204,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx/1.25.4"},{"key":"Date","value":"Fri, 22 Mar 2024 16:11:38 GMT"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"GET, POST, DELETE, PUT"},{"key":"Access-Control-Allow-Headers","value":"Content-Type"},{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"count\": 2,\n    \"taskIds\": [\n        {\n            \"extTaskId\": \"12345\",\n            \"taskId\": \"5432321\"\n        },\n        {\n            \"extTaskId\": \"12346\",\n            \"taskId\": \"5432322\"\n        }\n    ]\n}"}],"_postman_id":"b8e3851e-1308-4160-be2e-954ad32a39fd"},{"name":"Update Task","id":"7f15fda6-a623-4c8c-8fa5-584a4ac7854e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"PATCH","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"priority\": 100,\n\t\"serviceName\": \"New service\"\n}\n"},"url":"https://<tenant-url>/taskroutingapi/v1/task/:taskid?external=Boolean","description":"<p>Modify the priority or associated service of the queued task specified by the <strong>taskID</strong> path variable.</p>\n<p>Use the <strong>external</strong> query parameter to specify whether <strong>taskId</strong> is an internal or external identifier.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>serviceName</td>\n<td>The name of the service to which the task should be moved. If different from the current service, the task will be re-queued to the new service.</td>\n</tr>\n<tr>\n<td>priority</td>\n<td>The new priority for the task. This only applies to tasks being routed using the <code>lifo</code> order.</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"body-parameters\">Body Parameters</h3>\n<p>None</p>\n","urlObject":{"protocol":"https","path":["taskroutingapi","v1","task",":taskid"],"host":["<tenant-url>"],"query":[{"description":{"content":"<p>Indicates whether the <strong>taskId</strong> specified in the path is an external task ID (from a CRM or other external system) or an internal task ID generated by Bright Pattern Contact Center.</p>\n","type":"text/plain"},"key":"external","value":"Boolean"}],"variable":[{"description":{"content":"<p>Identifies the task to be canceled, using either its internal or external ID as specified by the <strong>external</strong> query parameter. </p>\n","type":"text/plain"},"type":"any","value":"String (task ID)","key":"taskid"}]}},"response":[{"id":"721f1aa2-2a73-4644-a5c9-ec5cecadf4f7","name":"Update Task","originalRequest":{"method":"PATCH","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"Bearer E9C97B84D0F72C08A1B31916A1646B91618F63F146CC3694CD2523B63F732363","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"priority\": 100,\n\t\"serviceName\": \"TaskService\"\n}\n"},"url":{"raw":"https://<tenant-url>/taskroutingapi/v1/task/:taskid?external=false","protocol":"https","host":["<tenant-url>"],"path":["taskroutingapi","v1","task",":taskid"],"query":[{"key":"external","value":"false"}],"variable":[{"key":"taskid","value":"{{taskId}}"}]}},"status":"OK","code":200,"_postman_previewlanguage":"plain","header":[{"key":"Server","value":"nginx/1.21.0"},{"key":"Date","value":"Mon, 11 Dec 2023 19:28:49 GMT"},{"key":"Transfer-Encoding","value":"chunked"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"GET, POST, DELETE, PUT"},{"key":"Access-Control-Allow-Headers","value":"Content-Type"}],"cookie":[],"responseTime":null,"body":null}],"_postman_id":"7f15fda6-a623-4c8c-8fa5-584a4ac7854e"},{"name":"Query Task","id":"a026f73c-2e6b-4cc5-9f78-9c56ccd45d12","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":""}]},"isInherited":false},"method":"GET","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"url":"https://<tenant-url>/taskroutingapi/v1/task/:taskid/?external=Boolean","description":"<p>Retrieves information about the task specified by the <strong>taskId</strong> path variable.</p>\n<p>Use the <strong>external</strong> query parameter to specify whether <strong>taskId</strong> is an internal or external identifier.</p>\n<h3 id=\"request-body\">Request Body</h3>\n<p>None</p>\n<h3 id=\"response-body\">Response Body</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>taskStatus</td>\n<td>Task's current status (CREATED, QUEUED, DEFERRED, COMPLETED).</td>\n</tr>\n<tr>\n<td>serviceName</td>\n<td>Name of the service with which the task is associated.</td>\n</tr>\n<tr>\n<td>priority</td>\n<td>Task queue priority.</td>\n</tr>\n<tr>\n<td>order</td>\n<td>Task queue order (FIFO/LIFO).</td>\n</tr>\n<tr>\n<td>dispositionName</td>\n<td>Disposition name for completed tasks. Empty if task is still queued.</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"protocol":"https","path":["taskroutingapi","v1","task",":taskid",""],"host":["<tenant-url>"],"query":[{"description":{"content":"<p>Indicates whether the <strong>taskId</strong> specified in the path is an external task ID (from a CRM or other external system) or an internal task ID generated by Bright Pattern Contact Center.</p>\n","type":"text/plain"},"key":"external","value":"Boolean"}],"variable":[{"description":{"content":"<p>Identifies the task to be canceled, using either its internal or external ID as specified by the <strong>external</strong> query parameter. </p>\n","type":"text/plain"},"type":"any","value":"String (task ID)","key":"taskid"}]}},"response":[{"id":"87e6aa0e-9603-4444-90cd-863a9e85de4d","name":"Query Task","originalRequest":{"method":"GET","header":[{"key":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"Bearer E9C97B84D0F72C08A1B31916A1646B91618F63F146CC3694CD2523B63F732363","type":"text"}],"url":{"raw":"https://<tenant-url>/taskroutingapi/v1/task/:taskid/?external=false","protocol":"https","host":["<tenant-url>"],"path":["taskroutingapi","v1","task",":taskid",""],"query":[{"key":"external","value":"false"}],"variable":[{"key":"taskid","value":"65736beabae70b588348f2b5","description":"CRM task ID. Treated as internal by default."}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx/1.21.0"},{"key":"Date","value":"Mon, 11 Dec 2023 14:38:39 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"79"},{"key":"Connection","value":"keep-alive"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Access-Control-Allow-Methods","value":"GET, POST, DELETE, PUT"},{"key":"Access-Control-Allow-Headers","value":"Content-Type"}],"cookie":[],"responseTime":null,"body":"{\n\t\"taskStatus\": \"DEFERRED\",\n    \"priority\": 5,\n\t\"serviceName\": \"New Task Processing Service\",\n\t\"order\": \"fifo\",\n\t\"dispositionName\":\"Abandoned\"\n}\n"}],"_postman_id":"a026f73c-2e6b-4cc5-9f78-9c56ccd45d12"}],"id":"4e984958-ecb4-4184-b997-953bbcfb8962","description":"<p>The following methods allow tasks within Bright Pattern Contact Center to be queued, canceled, updated, and queried.</p>\n","_postman_id":"4e984958-ecb4-4184-b997-953bbcfb8962"},{"name":"Error Codes","item":[],"id":"a6067369-43ce-4243-ad0e-1fc9f833b102","description":"<p>The Task Routing API can potentially return any of the following error codes.</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Code</strong></th>\n<th><strong>Text</strong></th>\n<th><strong>HTTP response</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>0</td>\n<td>Success</td>\n<td>200 OK</td>\n<td></td>\n</tr>\n<tr>\n<td>1</td>\n<td>Authentication failed</td>\n<td>401 Unauthorized</td>\n<td>Authorization header is missing or the provided access token does not exist.</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Access token expired</td>\n<td>401 Unauthorized</td>\n<td>Access token is valid (exists) but it has expired. The client should request a new access token.</td>\n</tr>\n<tr>\n<td>3</td>\n<td>Privilege not granted</td>\n<td>403 Forbidden</td>\n<td>Access token is valid but the user the token granted to does not have required <em>Use Task Routing API</em> privilege.</td>\n</tr>\n<tr>\n<td>4</td>\n<td>Missing parameter(s) [param_name]</td>\n<td>400 Bad Request</td>\n<td>A required parameter is missing. A list of missing parameter names is included in the text.</td>\n</tr>\n<tr>\n<td>5</td>\n<td>Task is or already was in the queue</td>\n<td>400 Bad Request</td>\n<td>Duplicate task - the task with the same id was queued in the past.</td>\n</tr>\n<tr>\n<td>6</td>\n<td>Service not found or invalid</td>\n<td>400 Bad Request</td>\n<td>Specified service does not exist or is not of \"Task\" type.</td>\n</tr>\n<tr>\n<td>7</td>\n<td>Disposition not found</td>\n<td>400 Bad Request</td>\n<td>Specified disposition does not exist.</td>\n</tr>\n<tr>\n<td>8</td>\n<td>Task not found</td>\n<td>404 Not Found</td>\n<td>Specified task not found or not queued.</td>\n</tr>\n<tr>\n<td>9</td>\n<td>Task not in queue</td>\n<td>400 Bad Request</td>\n<td>Specified task exists but not in the queue (already routed or canceled).</td>\n</tr>\n<tr>\n<td>10</td>\n<td>Task already routed to an agent</td>\n<td>400 Bad Request</td>\n<td>Task was queued but has already been routed; unable to cancel routing.</td>\n</tr>\n<tr>\n<td>11</td>\n<td>No servers available</td>\n<td>502 bad gateway</td>\n<td>No active servers found to handle the request (either all activity servers are down or all CRM servers are down or invalid response from CRM server).</td>\n</tr>\n<tr>\n<td>12</td>\n<td>API limit exceeded</td>\n<td>429 Too Many Requests</td>\n<td>API limit exceeded.</td>\n</tr>\n<tr>\n<td>13</td>\n<td>Internal server error</td>\n<td>500 Internal server error</td>\n<td>Database exception.</td>\n</tr>\n<tr>\n<td>14</td>\n<td>Feature not enabled</td>\n<td>403 Forbidden</td>\n<td>The feature is not enabled for the tenant.</td>\n</tr>\n</tbody>\n</table>\n</div>","_postman_id":"a6067369-43ce-4243-ad0e-1fc9f833b102"}],"event":[{"listen":"prerequest","script":{"id":"7af1b467-d52c-450c-93ec-95d7384fe200","type":"text/javascript","exec":["const echoPostRequest = {","  url: \"https://\" + pm.environment.get(\"tenant_url\") + \"/configapi/v2/oauth/token\",","  method: 'POST',","  header: {","    'Accept': '*/*',","    'Content-Type': 'application/x-www-form-urlencoded',","  },","  body: {","    mode: 'urlencoded',","    urlencoded : [","      { key: 'client_id', value: pm.environment.get(\"client_id\")},","      { key: 'client_secret', value: pm.environment.get(\"client_secret\")},","      { key: 'scope', value: pm.environment.get(\"scope\")},","      { key: 'grant_type', value: \"client_credentials\"},","    ]","  }","};","","var getToken = true;","","if (!pm.environment.get('accessTokenExpiry') || ","    !pm.environment.get('currentAccessToken')) {","    console.log('Token or expiry date are missing')","} else if (pm.environment.get('accessTokenExpiry') <= (new Date()).getTime()) {","    console.log('Token is expired')","} else {","    getToken = false;","    console.log('Token and expiry date are all good');","}","","if (getToken === true) {","    pm.sendRequest(echoPostRequest, function (err, res) {","    console.log(err ? err : res.json());","        if (err === null) {","            console.log('Saving the token and expiry date')","            var responseJson = res.json();","            pm.environment.set('currentAccessToken', responseJson.access_token)","    ","            var expiryDate = new Date();","            //console.log(\"expiry date: \",expiryDate)","            //console.log(\"expiry seconds: \", responseJson['expires_in'])","            expiryDate.setSeconds(expiryDate.getSeconds() + Number(responseJson['expires_in']));","            //console.log(\"new expiry date: \", expiryDate)","            pm.environment.set('accessTokenExpiry', expiryDate.getTime());","","        }","    });","}"]}},{"listen":"test","script":{"id":"519e558a-fe67-4aeb-9ffb-c7be21c2efbc","type":"text/javascript","exec":[""]}}],"variable":[{"key":"tenant_url","value":"boromir.bugfocus.com"},{"key":"client_id","value":"User01","type":"string"},{"key":"clientSecret","value":"huuw8tbDgk9tX0r6C4rZfpa6kzCHP4oOZmtP7E3DG5d8yaaGC75Ux0Lb7dkngpAg","type":"string"},{"key":"scope","value":"","type":"string"},{"key":"currentAccessToken","value":"","type":"string"},{"key":"accessTokenExpiry","value":"","type":"string"},{"key":"client_credentials","value":"client_credentials"}]}