In Stable 2026.06, a new node – REST API definition – was added for use in decisions in SAS Intelligent Decisioning. A REST API definition node enables a decision to send requests to and receive responses from an external API. Using a REST API definition node, you can integrate external services such as large language models (LLMs), credit bureaus, open banking services, email, and other services directly into your decision logic. Currently, decisions that call a REST API definition node can only be published to the destinations of SAS Microanalytic Service (MAS) or SAS Cloud Analytic Services (CAS).
In this post, I will walk you through an example of using the REST API definition to call an API to perform a currency conversion as part of a decision flow in SAS Intelligent Decisioning.
In this post I am going to use the BanksRates · Free JSON exchange-rate API. This is an example request using cURL to find out the exchange rate and resulting amount for converting 100 US Dollars (USD) to Polish Zloty (PLN) using the rate from the National Bank of Poland (NBP) on April 20, 2026.
curl -s https://api.banks-rates.com/v1/rate?bank=NBP&date=2026-04-20&from=USD&to=PLN&amount=100
This is the response received from that request:
{"direction":"foreign_to_national","requested":{"bank":"NBP","date":"2026-04-20","amount":100,"from":"USD","to":"PLN"},"primary":{"actualDate":"2026-04-20","rate":3.6005,"unit":1,"resultAmount":360.04999999999995,"status":"published"},"previous":{"actualDate":"2025-12-31","rate":3.6016,"unit":1,"resultAmount":360.15999999999997}}
Here is a test using the BanksRates API reference page.
Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.
Note: A response code of 200 is a successful response.
To create a new REST API definition, select to go to the REST API Definitions page in SAS Intelligent Decisioning and select New REST API Definition.
I enter a name for the new REST API definition, select the method type of the API call, and enter its request path.
First, I select the Variables tab. SAS Intelligent Decisioning automatically records the response body and response status codes in variables named responseBody and responseStatusCode. These variables are required and cannot be deleted or renamed. To capture additional output from other HTTP response headers, map the additional HTTP response headers to output variables in the REST API definition. I also add variables that I will then map to the REST API query parameters.
On the Definition tab, I first enter the information for the Request. In the General section for the request, the Method type for my REST API call is GET, but you also have the option to select POST or HEAD. You can select the Format type for your Request body, the options are: JSON, XML or Plain Text. In my case, I won’t be using the Request body section; instead, I will use the Query parameters section to send my request details.
Next, is the Authorization section where you provide the authorization information for the REST API call. In my case the Authorization type is None, but the other options are: SAS OAuth, Bearer, API Key Header, API Key Query. Most REST APIs would need some sort of authorization. For the Bearer, API Key Header, and API Key Query authentication types, consult the documentation for the API that you are accessing for information about generating an authentication key. In SAS Environment Manager, create a credential domain that specifies that authentication key, and specify that domain in the Credential domain name field for the new REST API definition. For more information, see Define the Authentication Domain for External REST API Requests in SAS Intelligent Decisioning: Administrator’s Guide and Define the REST API Request.
Finally, there is the Input section for the request. I have entered the Request path for my REST API call. The URL must start with either http:// or https:// . Include any needed HTTP request headers for your REST API call.
Then, I need to enter the Query parameters for my REST API call. I hardcode the value of FED for the bank from which to get the currency rate. For the other required query parameters of my REST API call, I map them to the variables I created earlier.
Here is all the Request information for my REST API call.
Next, I select the Response section. Here you can enter HTTP response headers. I don’t have any that are needed for my REST API call.
Now that the REST API definition has been defined to test it you need to create a decision to call it. I add a REST API definition node and reference the REST API definition I created called currency_conversion.
I have a small test table that I use to run a test of the decision with my REST API node and confirm that the variables responseBody and responseStatusCode returned by the REST API call are populated.
Now that I have tested the REST API definition, I build out my decision to parse the responseBody. I add a Branch node based on the responseStatusCode returned from the REST API call. In my case 200 is a successful response; anything else is unsuccessful.
On the Yes branch, I add Python code file to parse the JSON of a successful response from my REST API.
This is the Python code I used for the Yes branch:
''' List all output parameters as comma-separated values in the "Output:" docString. Do not specify "None" if there is no output parameter.'''
''' List all Python packages that are not built-in packages in the "DependentPackages:" docString. Separate the package names with commas on a single line. '''
''' DependentPackages: '''
import json
def execute (responseBody):
'Output:direction,primary_rate,primary_amount,primary_date,previous_rate,previous_amount,previous_date,diff'
# Parse JSON response
data = json.loads(responseBody)
print("data parsed to json")
diff = 0
# Access values
direction = data["direction"]
primary_rate = data["primary"]["rate"]
primary_amount = data["primary"]["resultAmount"]
primary_date = data["primary"]["actualDate"]
previous_rate = data["previous"]["rate"]
previous_amount = data["previous"]["resultAmount"]
previous_date = data["previous"]["actualDate"]
# Calculate difference between amounts
diff = primary_amount - previous_amount
return direction,primary_rate,primary_amount,primary_date,previous_rate,previous_amount,previous_date,diff
On the No branch, I add Python code file to parse the JSON for an unsuccessful response from my REST API.
This is the Python code I used for the No branch:
''' List all output parameters as comma-separated values in the "Output:" docString. Do not specify "None" if there is no output parameter.'''
''' List all Python packages that are not built-in packages in the "DependentPackages:" docString. Separate the package names with commas on a single line. '''
''' DependentPackages: '''
import json
def execute (responseBody):
'Output:error_msg'
# Parse JSON response
data = json.loads(responseBody)
print("data parsed to json")
# Access values
error_msg = data["error"]
return error_msg
Now, that I have added the nodes to parse the response from my REST API, I then re-run the test of my decision and have my responseBody parsed into my decision output variables.
The REST API definition node allows you to send requests to and receive responses from an external API directly within your decision flow. For more information, see Working with REST API Definitions in SAS Intelligent Decisioning: User’s Guide.
You can easily create this example REST API definition yourself from this post; however, keep in mind that there is a limit to how many free requests that you can send per hour and per day.
Thanks to Sebine Jacobson for her help in writing this post on the REST API definition node.
Find more articles from SAS Global Enablement and Learning here.
Visit the Tips & Tricks page for setup guidance, demos, and practical examples that show how Copilot supports your workflows.
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.