Return session debug logs in a REST response

concept brazil Updated Sep 10, 2026 1 min read rest-session-debug-header.md
Raw file servicenow.com

You can include session debug logs in a REST response body by passing the X-WantSessionDebugMessages header in the request.

To return session debug messages when session debugging is enabled for the current session, set the header X-WantSessionDebugMessages to true in the REST request.

Note: You must enable session debugging before sending this header.

Request

This example demonstrates a Table API request made using REST API Explorer with Session Debug SQL enabled.

Text
GET api/now/table/incident/9c573169c611228700193229fff72400X-WantSessionDebugMessages:trueContent-Type: application/json;charset=UTF-8Accept: application/json, text/plain,*/*X-UserToken: <user token>

Response body

JSON
{  "result":{    "description":"User can't access email on mail.company.com.",    "number":"INC0000001"  },  "session":{    "debug_logs":[       {         "type":"sql",         "customerUpdate":false,         "line":"17:17:27.777: Time: 0:00:00.000 for: glide_master_db[glide.5] ..... sys_user_session0.`id` = '3BEA7001EB230200C46AC2EEF106FE2A'</span>",         "debugClassSet":""       },      {        "type":"sql",        "customerUpdate":false,        "line":"17:17:27.779: Time: 0:00:00.002 for: glide_master_db[glide.6]  ... `sys_id` = '7fea7001eb230200c46ac2eef106fe2a'</span>",        "debugClassSet":""       }    ]  }}

Parent Topic:REST APIs

Related topics

Debugging sessions

Search documentation
Search document titles and file paths on the brazil branch