{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":472,"path":"api-reference/rest-apis/awa-offer-work-api.md","title":"AWA Offer Work API","bundle":null,"doc_type":null,"release":"australia","body":"\n# AWA Offer Work API\n\nThe AWA Offer Work API provides an endpoint to assign or transfer work items to agents.\n\nThis API is intended for use with Contact Center as a Service \\(CCAAS\\) integrations where the routing and assignment decision takes place in the external CCAAS system. This API allows an [inbox card](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/awa-inbox-layout.md) to be shown to an agent in the ServiceNow Agent Workspace as a notification to accept the work item.\n\nThis API requires the Advanced Work Assignment \\(com.glide.awa\\) plugin. To call this API, you must have either the awa\\_manager or awa\\_integration\\_user role.\n\nFor more information about AWA, see [Advanced Work Assignment](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/awa-overview.md).\n\nUse the [AWA Agent Consult API](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/awa-agent-consult-api.md) to handle agent consult work items.\n\n**Parent Topic:**[REST API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/api-rest.md)\n\n## AWA Offer Work - POST /now/awa/documents/\\{document\\_table\\}/\\{document\\_sys\\_id\\}/offer\n\nAssigns or transfers work items to agents.\n\nA work item is a single piece of work handled by an AWA agent from start to finish. A work item is created based on a document, such as an interaction or task.\n\nAll agents receiving or transferring work items with this API must have the awa\\_agent and awa\\_external\\_user roles.\n\n### URL format\n\nVersioned URL: `/api/now/{api_version}/awa/documents/{document_table}/{document_sys_id}/offer`\n\nDefault URL: `/api/now/awa/documents/{document_table}/{document_sys_id}/offer`\n\n### Supported request parameters\n\n<table class=\"rest_api_path_parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\napi\\_version\n\n</td><td id=\"version-entry-RESTAPI\">\n\nOptional. Version of the endpoint to access. For example, `v1` or `v2`. Only specify this value to use an endpoint version other than the latest. Data type: String\n\n</td></tr><tr><td>\n\ndocument\\_table\n\n</td><td>\n\nName of the table associated with the document, such as the Interaction \\[interaction\\] table or Task \\[task\\] table.Data type: String\n\n</td></tr><tr><td>\n\ndocument\\_sys\\_id\n\n</td><td>\n\nSys\\_id of the document to route to the agent or queue.Data type: String\n\n</td></tr></tbody>\n</table>|Name|Description|\n|----|-----------|\n|None| |\n\n<table class=\"rest_api_request_body\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nassignment\n\n</td><td>\n\nRequired for new assignments. Object containing information about the assignment.Data type: Object\n\n```\n{ \n   \"after_timeout_presence\": \"String\",\n   \"agent_sys_id\": \"String\", \n   \"allowed_to_decline\": Boolean,\n   \"display_option\": \"String\", \n   \"enable_auto_assign\": Boolean, \n   \"offered_on\": \"String\",\n   \"timeout\": Number \n} \n```\n\n</td></tr><tr><td>\n\nassignment.after\\_timeout\\_presence\n\n</td><td>\n\nSys\\_id of the presence state that the agent switches to if the **timeout** parameter expires.If the **timeout** parameter isn't passed, this parameter is ignored.\n\nFor additional information on presence states, see [Configure agent presence states](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/awa-configure-agent-presence.md).\n\nData type: String\n\nDefault: Empty string \\(Agent presence state doesn't change\\).\n\nTable: AWA Presence State \\[awa\\_presence\\_state\\]\n\n</td></tr><tr><td>\n\nassignment.agent\\_sys\\_id\n\n</td><td>\n\nRequired for new assignments. Sys\\_id of the available agent to receive the work item. The agent must have the awa\\_agent and awa\\_external\\_user roles.For information on how to determine if an agent is available, refer to [Agent Inbox controls](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/agent-experience.md).\n\nData type: String\n\nTable: User \\[sys\\_user\\]\n\n</td></tr><tr><td>\n\nassignment.allowed\\_to\\_decline\n\n</td><td>\n\nFlag that indicates whether agents are allowed to reject work items. If this parameter is `true`, the inbox card displays both the **Accept** and **Reject** buttons on the inbox card.Valid values:\n\n-   true/yes/1: Agent can reject work items.\n-   false/no/0: Agent can't reject work items.\n\nData type: Boolean\n\nDefault: true\n\n</td></tr><tr><td>\n\nassignment.display\\_option\n\n</td><td>\n\nDisplay option for the card and tab when a work item is automatically assigned. This parameter is only valid if **enable\\_auto\\_assign** is `true`.\n\nValid values:\n\n-   card\\_and\\_tab: Display both the card and tab.\n-   card\\_only: Display only the card.\n\nData type: String\n\nDefault: card\\_only\n\n</td></tr><tr><td>\n\nassignment.enable\\_auto\\_assign\n\n</td><td>\n\nFlag that indicates whether the work item should be automatically accepted or should allow the agent to manually accept or reject the work item.Valid values:\n\n-   true/yes/1: Automatically accept.\n-   false/no/0: Allow agent to manually accept or reject.\n\nData type: Boolean\n\nDefault: false\n\n</td></tr><tr><td>\n\nassignment.offered\\_on\n\n</td><td>\n\nWork item offer time. The offer time is used to calculate the remaining time the agent has left to accept the work item in the inbox. It helps account for the discrepancy between the time when the API request gets processed, and when the third-party routing system invokes the API request. This parameter allows external systems calling this endpoint to configure the offer time of the work item so that it stays in synchronization with the external system’s internal tracking of the work item.For example, if the work item was offered on 11:30:30, the timeout is 30 seconds, and the current time is 11:30:45, the countdown timer displays 00:15 \\(as in 15 seconds remaining\\).\n\nThis value is stored in the offered\\_on field on the work item.\n\nThis parameter is ignored if the **timeout** parameter isn't passed.\n\nData type: String\n\nFormat: UTC timestamp \\(yyyy-MM-dd'T'HH:mm:ss.SSS\\)\n\n</td></tr><tr><td>\n\nassignment.timeout\n\n</td><td>\n\nAmount of time that the work item stays in the agent’s inbox waiting for the agent to accept the work assignment.Data type: Number\n\nUnit: Seconds\n\nDefault: Empty string \\(No time limit\\).\n\n</td></tr><tr><td>\n\nexternal\\_segment\\_id\n\n</td><td>\n\nExternal identifier from the CCAAS system of the call segment offered to the agent.Data type: String\n\n</td></tr><tr><td>\n\nqueue\\_id\n\n</td><td>\n\nRequired for new assignments. Sys\\_id of the queue record or the queue identifier in an external system.If using a queue\\_id from an external system, it must be mapped to the Provider queue ID \\(external\\_id\\) field on the awa\\_queue record.\n\nData type: String\n\nTable: Queue \\[awa\\_queue\\]\n\n</td></tr><tr><td>\n\ntransfer\n\n</td><td>\n\nRequired for transfer assignments. Object containing information about the transfer.If a value is provided for this parameter, the assignment is considered a transfer assignment.\n\nData type: Object\n\n```\n{\n   \"source_queue_id\": \"String\",\n   \"target_id\": \"String\",\n   \"target_type\": \"String\",\n   \"transfer_type\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\ntransfer.source\\_queue\\_id\n\n</td><td>\n\nRequired for transfer assignments.Source queue from where the transfer is initiated. Sys\\_id of the queue record or the queue identifier in an external system.\n\nIf using a queue\\_id from an external system, it must be mapped to the Provider queue ID \\(external\\_id\\) field on the awa\\_queue record.\n\nThis parameter is used to create a work item before initiating the transfer if an active work item is not found. It enables transfers to be performed if the original interaction was created without any routing, such as for outbound calls.\n\nData type: String\n\nTable: Queue \\[awa\\_queue\\]\n\n</td></tr><tr><td>\n\ntransfer.target\\_id\n\n</td><td>\n\nRequired for transfer assignments. Sys\\_id of the agent or queue record to transfer the assignment to.-   If **target\\_type** is `agent`, **target\\_id** is the sys\\_id of the agent user record in the User \\[sys\\_user\\] table.\n-   If **target\\_type** is `queue`, **target\\_id** is the sys\\_id of the queue record in the Queue \\[awa\\_queue\\] table or the queue identifier in an external system.\n\nData type: String\n\n</td></tr><tr><td>\n\ntransfer.target\\_type\n\n</td><td>\n\nRequired for transfer assignments. Type of record to transfer the assignment to.Valid values:\n\n-   agent\n-   queue\n\nData type: String\n\n</td></tr><tr><td>\n\ntransfer.transfer\\_type\n\n</td><td>\n\nRequired for transfer assignments. Type of transfer.Valid values:\n\n-   blind\n-   consult\n\nData type: String\n\n</td></tr></tbody>\n</table>### Headers\n\nThe following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see [Supported REST API headers](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n<table class=\"rest_api_request_headers\"><thead><tr><th>\n\nHeader\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nAccept\n\n</td><td id=\"accept-entry-RESTAPI\">\n\nData format of the response body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr><tr><td>\n\nContent-Type\n\n</td><td id=\"content_type-entry-RESTAPI\">\n\nData format of the request body. Supported types: **application/json** or **application/xml**. Default: **application/json**\n\n</td></tr></tbody>\n</table>|Header|Description|\n|------|-----------|\n|None| |\n\n### Status codes\n\nThe following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see [REST API HTTP response codes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_RESTAPI.md).\n\n|Status code|Description|\n|-----------|-----------|\n|200|Successful. The request was successfully processed.|\n|401|Unauthorized. The user credentials are incorrect or have not been passed.|\n|404|Not found. The requested item wasn't found.|\n|409|Conflict. The request couldn't be processed due to an error with the provided document’s work item or agent sys\\_id.|\n|500|Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.|\n\n### Response body parameters \\(JSON or XML\\)\n\n<table><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nmessage\n\n</td><td>\n\nResponse message with information about the assignment success or failure.Possible values:\n\n-   `Manual assignment successfully requested` - Success.\n-   `Caller <API_caller_sys_id> does not have the awa_manager or awa_integration_user role` – The authenticated user making the API request must have either the awa\\_manager or awa\\_integration\\_user role.\n-   `Work Item accepted can not be assigned` – Work item can't be assigned because it is already accepted by an agent. For more information, see [Check work items and AWA events](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/awa-work-items-all.md).\n-   `<agent_sys_id> is not a valid agent` – Agent doesn't have the awa\\_agent role.\n-   `Transfer failed - couldn't blind transfer to agent` - Assignment wasn't transferred because the agent isn't in the Available state in AWA.\n-   `Work Item is already assigned to <agent_sys_id>` – Provided work item is assigned to another agent.\n-   `Agent is not available` – Agent isn't in the Available state in AWA. For more information, see [Agent Inbox controls](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/conversational-interfaces/agent-experience.md).\n-   `Timeout value cannot be negative` – Provided timeout value can't be negative.\n-   `<presence_state_sys_id> is not a valid presence state` – Provided presence state sys\\_id doesn't exist in the AWA Presence State \\[awa\\_presence\\_state\\] table.\n-   `Offered time (<offered_on_timestamp>) must be in the following format: yyyy-MM-dd'T'HH:mm:ss.SSS` – Provided offered\\_on timestamp must use the specified format.\n-   `Offered time (<offered_on_timestamp>) must be before the current time, otherwise agent will have more time to accept the work item` – Provided offered\\_on timestamp can't be before the time the request is made.\n-   `Timestamp after timeout (<offered_on_timestamp >) must be after the current time, otherwise agent has no time to accept the work item` – The timestamp after adding the timeout value to the provided offered\\_on timestamp must be after the time the request was made.\n-   `<display_option> is not a valid display option` – Provided display\\_option must be one of the following values: `card_only` or `card_and_tab`.\n-   `%s is not a valid boolean value` – Provided Boolean value must use one of the following formats: `yes/no`, `true/false`, `1/0`.\n-   `The user does not have the 'awa_external_user' role` - Agent receiving the assignment must have the awa\\_external\\_user role.\n-   `Document is not active` - Provided document must be active and not in a closed state.\n\n</td></tr><tr><td>\n\nsuccess\n\n</td><td>\n\nFlag that indicates whether the assignment is successful.Possible values:\n\n-   true: Assignment successful.\n-   false: Assignment unsuccessful.\n\nData type: Boolean\n\n</td></tr><tr><td>\n\nwork\\_item\n\n</td><td>\n\nDetails about the created or updated work item.Data type: Object\n\n```\n{ \n   \"display_name\": \"String\",\n   \"document_id\": \"String\", \n   \"document_table\": \"String\", \n   \"queue\": \"String\", \n   \"sys_id\": \"String\" \n}\n```\n\n</td></tr><tr><td>\n\nwork\\_item.display\\_name\n\n</td><td>\n\nDisplay name of the document record.Data type: String\n\n</td></tr><tr><td>\n\nwork\\_item.document\\_id\n\n</td><td>\n\nSys\\_id of the document record.Data type: String\n\n</td></tr><tr><td>\n\nwork\\_item.document\\_table\n\n</td><td>\n\nName of the table associated with the document.Data type: String\n\n</td></tr><tr><td>\n\nwork\\_item.queue\n\n</td><td>\n\nSys\\_id of the queue record or the queue identifier in an external system.Data type: String\n\nTable: Queue \\[awa\\_queue\\]\n\n</td></tr><tr><td>\n\nwork\\_item.sys\\_id\n\n</td><td>\n\nSys\\_id of the work item.Data type: String\n\nTable: Work Item \\[awa\\_work\\_item\\]\n\n</td></tr></tbody>\n</table>### cURL request\n\nThis example shows how to assign a work item to an agent.\n\n```\ncurl \"https://instance.servicenow.com/api/now/awa/documents/interaction/59616aba87bd5210be070d48dabb35e6/offer\" \\ \n--request POST \\ \n--header \"Accept:application/json\" \\ \n--header \"Content-Type:application/json\" \\ \n--data '{ \n    \"external_segment_id\": \"segment_59616aba87bd5210be070d48dabb35e6\", \n    \"queue_id\": \"92f8942787851210be070d48dabb35fb\", \n    \"assignment\": { \n        \"agent_sys_id\": \"0d584509c323120095ccd02422d3ae5b\", \n        \"allowed_to_decline\": \"true\", \n        \"enable_auto_assign\": \"false\", \n        \"timeout\": 30, \n        \"offered_on\":\"2024-04-03T23:09:31.000\" \n    } \n}' \n--user 'username':'password'\n```\n\nThe response shows that the work item is successfully assigned to the agent. You can verify the result in the Assigned to field of the Work Item \\[awa\\_work\\_item\\] record.\n\n```\n{ \n   \"result\": { \n      \"work_item\": { \n         \"display_name\": \"Interaction: IMS0000221\", \n         \"sys_id\": \"bfa3a27e87bd5210be070d48dabb3588\", \n         \"document_id\": \"59616aba87bd5210be070d48dabb35e6\", \n         \"document_table\": \"interaction\", \n         \"queue\": \"92f8942787851210be070d48dabb35fb\" \n      }, \n      \"success\": true, \n      \"message\": \"Manual assignment successfully requested.\" \n   } \n}\n```\n\n"}}