Newer Version Available

This content describes an older version of this product. View Latest

Named Query API (Beta)

Use Named Query API (beta) to create custom SOQL queries that you can expose in REST API calls. For more information about Named Query API, see the Agentforce Developer Guide.

Named Query API is a beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Directory. Use of this beta service is at the Customer's sole discretion.

Note

When you create a Named Query API, it’s available as a REST API call. The name of the Named Query API defines the endpoint, while parameters appear as URI query parameters.

Syntax

URI
/services/data/vXX.X/named/query/NQ_API_Name?param_name=param_value
Formats
JSON
HTTP Method
GET
Authentication
Authorization: Bearer token
Parameters
Parameter Description
NQ_API_NAME The name of the Named Query API you want to call.
param_name=param_value

A Named Query API parameter and its value. If the Named Query API has multiple parameters, you must include all of them as URI parameters using the format param_name1=param_value1&param_name2=param_value2

Only the following literal types are supported for parameter values in a Named Query API request.

  • String (example: name=Acme)
  • Date (example: closedate=2025-10-14)
  • Time (example: endtime=17:30:00-07:00)
  • DateTime (example: date=2025-10-14T09:00:00-07:00)
  • Date Formula (Fixed) (example: createddate=TODAY)
  • Date Formula (Variable) (example: createddate=LAST_N_DAYS:10)
  • Integer (example: quantity=36)
  • Decimal (example: amount=10.99)
  • Boolean (doNotCall=false)
  • Multi-Currency (amount=USD20000)

Example

Example Request

This request references the Named Query API GetAccountDetailsFromName. The query parameter name is defined on the Named Query API that generates this sample code.

Example Response Body

OpenAPI Support for Named Query API

  • If you have the REST API OpenAPI Beta enabled in your org, then you can download an OpenAPI document describing the REST API that the Named Query API is exposed on. To learn more, check out the OpenAPI Beta documentation.