<h2>getKeys</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2026" /><meta name="DC.rights.owner" content="(C) Copyright 2026" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="reference" /><meta name="DC.title" content="getKeys" /><meta name="abstract" content="Query the targeted table by example values and return a comma delimited sys_id list." /><meta name="description" content="Query the targeted table by example values and return a comma delimited sys_id list." /><meta name="DC.subject" content="web service API, Data Retrieval API, getKeys" /><meta name="keywords" content="web service API, Data Retrieval API, getKeys" /><meta name="DC.relation" scheme="URI" content="../../../integrate/web-services-apis/reference/r_DataRetrievalAPI.html" /><meta name="DC.relation" scheme="URI" content="../../../build/applications/concept/api-implementation-reference.html" /><meta name="DC.relation" scheme="URI" content="../../../build/applications/concept/api-implementation.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/web-services/reference/r_AvailableWebServices.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/web-services/concept/inbound-web-services.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/inbound-soap/concept/c_SOAPWebService.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/inbound-soap/concept/c_DirectWebServices.html" /><meta name="DC.relation" scheme="URI" content="../../../integrate/web-services-apis/reference/r_DirectWebServiceAPIFunctions.html" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2024-08-01" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="r_GetKeys" /><link rel="stylesheet" type="text/css" href="../../../CSS/commonltr.css" /><title>getKeys</title></head><body id="r_GetKeys"> <div class="breadcrumb"><a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/build/applications/concept/api-implementation-reference.html" title="Get started using ServiceNow APIs with guides, resources, and reference documentation.">API implementation and reference</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/build/applications/concept/api-implementation.html" title="You can use JavaScript APIs to extend application server and client functionality. Use web services to connect ServiceNow applications to other software applications.">API implementation</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/web-services/reference/r_AvailableWebServices.html" title="HTTP-based web services allow diverse applications to talk to each other. ServiceNow supports both inbound (provider) and outbound (consumer) web services.">Web services</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/web-services/concept/inbound-web-services.html" title="You can use any of several web services to integrate with ServiceNow applications, including REST, SOAP, JSONv2, and RSS.">Inbound web services</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/inbound-soap/concept/c_SOAPWebService.html" title="Simple Object Access Protocol (SOAP) is an XML-based protocol for accessing web services over HTTP.">SOAP web service</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/inbound-soap/concept/c_DirectWebServices.html" title="A direct web service is available for any table in the system if the correct access control list is configured.">Direct web services</a> > <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/web-services-apis/reference/r_DirectWebServiceAPIFunctions.html" title="The standard SOAP API is a set of small, globally defined functions that can be performed on a targeted resource.">SOAP direct web service API functions</a> > </div> <h1 class="title topictitle1" id="ariaid-title1">getKeys</h1> <div class="body refbody"><p class="shortdesc">Query the targeted table by example values and return a comma delimited <code class="ph codeph">sys_id</code> list.</p> <div class="section"><h2 class="title sectiontitle">Input fields</h2> <p class="p">Any field value in the targeted table.</p> </div> <div class="section"><h2 class="title sectiontitle">Output fields</h2> <p class="p">A SOAP response element <span class="keyword parmname">sys_id</span> that contains a comma delimited list of <a class="xref" href="https://www.servicenow.com/docs/access?context=c_UniqueRecordIdentifier&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Unique record identifier (sys_id)</a> values.</p> </div> <div class="section"><h2 class="title sectiontitle">Sample SOAP messages</h2> </div> <div class="example"> <p class="p">Sample SOAP request</p> <div class="p"><pre class="pre codeblock"><code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident"> <soapenv:Header/> <soapenv:Body> <inc:getKeys> <category>hardware</category> </inc:getKeys> </soapenv:Body> </soapenv:Envelope></code></pre></div> </div> <div class="example"> <p class="p">Sample SOAP response</p> <div class="p"><pre class="pre codeblock"><code><soapenv:Envelope xmlns:inc="http://www.service-now.com/incident" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <getKeysResponse> <sys_id>46e18c0fa9fe19810066a0083f76bd56,46e57642a9fe1981000b96a5dca501ff,46f1784ba9fe19810018aa27fbb23482</sys_id> <count>7</count> </getKeysResponse> </soapenv:Body> </soapenv:Envelope></code></pre></div> </div> <div class="section"><h2 class="title sectiontitle">Language-specific sample messages</h2> <p class="p">For language-specific <span class="keyword apiname">getKeys</span> samples, refer to the following topics:</p> <p class="p"><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/examples/concept/c_PerlWebServicesClientExamples.html" title="Examples demonstrating an integration with a Perl web services client.">Perl SOAP::Lite</a></p> <p class="p"><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/examples/concept/c_JAAWbSrvcsClntExUpdt.html" title="An example of an Axis Client program that calls the getKeys function to query all incidents where the category is Hardware.">Java Apache Axis2</a></p> <p class="p"><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/examples/concept/c_PythonWebServicesClientExamples.html#c_PythonWebServicesClientExamples__getKeys">Python</a></p> </div> </div> <div class="related-links"> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/integrate/web-services-apis/reference/r_DataRetrievalAPI.html" title="Data Retrieval API method summaries and descriptions.">Data Retrieval API</a></div> </div> </div></body></html></div>