Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Named Query API

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.

User Permissions Needed
To execute a Named Query API: View Setup and Configuration

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 by using the format param_name1=param_value1&param_name2=param_value2. Only these literal types are supported for parameter values in a Named Query API request.

Supported literal types for Named Query API parameter values:

  • 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.

1/services/data/vXX.X/named/query/Get_Account_Details_From_Name?name=Acme

Example Response Body

1{
2    "totalSize": 1,
3    "done": true,
4    "records": [
5        {
6            "attributes": {
7            "type": "Account",
8            "url": "/services/data/v64.0/sobjects/Account/001Ws00003cPDMRIA4"
9            },
10            "Name": "Acme",
11            "Description": "A trendy, fast-casual dining group offering an eclectic mix of globally inspired dishes. Known for its vibrant, urban ambiance and innovative menu, Urban Eats Collective brings city vibes to every meal.",
12            "Phone": "214-555-1010",
13            "Website": "www.urbaneats.com",
14            "NumberOfEmployees": 500,
15            "BillingAddress": {
16                "city": "Dallas",
17                "country": "USA",
18                "geocodeAccuracy": null,
19                "latitude": null,
20                "longitude": null,
21                "postalCode": "75219",
22                "state": "TX",
23                "street": "2401 Victory Avenue"
24            }
25        }
26    ]
27}