Evaluate an Individual Decision Request
POST {{gatewayInstanceBaseUrl}}/api/authorize
The POST {{gatewayInstanceBaseUrl}}/api/authorize operation executes a decision request against a gateway instance.
Use localhost:<port> for {{gatewayInstanceBaseUrl}} in the request URL. The default port is 8080, but this can be configured when you start a gateway instance. See Starting an Authorize gateway instance in the PingOne admin documentation for more information.
The request body requires the parameters property. The userContext property is required if the authorization policies include built-in PingOne User attributes.
This operation uses the opt-in authentication feature. When authentication is enabled and the correct authentication is not provided, a 401 response is returned.
Prerequisites
-
See Setting up an Authorize gateway and Authentication for Authorize gateway endpoints in the PingOne admin documentation for information on deploying Authorize gateways and defining a shared secret for gateway instances.
Request Model
For property descriptions, refer to Policy decision evaluation request data model.
| Property | Type? | Required? |
|---|---|---|
|
Object |
Required |
|
UUID |
Optional |
|
The Try a Request functionality below is not applicable to this request. |
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{gatewayInstanceBaseUrl}}/api/authorize' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{sharedSecret}}' \
--data '{
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
}'
var options = new RestClientOptions("{{gatewayInstanceBaseUrl}}/api/authorize")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{sharedSecret}}");
var body = @"{" + "\n" +
@" ""parameters"": {" + "\n" +
@" ""Amount"": ""990""" + "\n" +
@" }," + "\n" +
@" ""userContext"": {" + "\n" +
@" ""user"": {" + "\n" +
@" ""id"": ""{{userID}}""" + "\n" +
@" }" + "\n" +
@" }" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{gatewayInstanceBaseUrl}}/api/authorize"
method := "POST"
payload := strings.NewReader(`{
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer {{sharedSecret}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
POST /api/authorize HTTP/1.1
Host: {{gatewayInstanceBaseUrl}}
Content-Type: application/json
Authorization: Bearer {{sharedSecret}}
{
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"parameters\": {\n \"Amount\": \"990\"\n },\n \"userContext\": {\n \"user\": {\n \"id\": \"{{userID}}\"\n }\n }\n}");
Request request = new Request.Builder()
.url("{{gatewayInstanceBaseUrl}}/api/authorize")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer {{sharedSecret}}")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{gatewayInstanceBaseUrl}}/api/authorize",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer {{sharedSecret}}"
},
"data": JSON.stringify({
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'POST',
'url': '{{gatewayInstanceBaseUrl}}/api/authorize',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{sharedSecret}}'
},
body: JSON.stringify({
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "{{gatewayInstanceBaseUrl}}/api/authorize"
payload = json.dumps({
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{sharedSecret}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{gatewayInstanceBaseUrl}}/api/authorize');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/json',
'Authorization' => 'Bearer {{sharedSecret}}'
));
$request->setBody('{\n "parameters": {\n "Amount": "990"\n },\n "userContext": {\n "user": {\n "id": "{{userID}}"\n }\n }\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "json"
require "net/http"
url = URI("{{gatewayInstanceBaseUrl}}/api/authorize")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{sharedSecret}}"
request.body = JSON.dump({
"parameters": {
"Amount": "990"
},
"userContext": {
"user": {
"id": "{{userID}}"
}
}
})
response = http.request(request)
puts response.read_body
let parameters = "{\n \"parameters\": {\n \"Amount\": \"990\"\n },\n \"userContext\": {\n \"user\": {\n \"id\": \"{{userID}}\"\n }\n }\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{gatewayInstanceBaseUrl}}/api/authorize")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{sharedSecret}}", forHTTPHeaderField: "Authorization")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
{
"id": "66de5a81-eb78-4ac6-a9a0-625fc78a4958",
"authorizationVersion": {
"id": "5df19270-71a5-11ef-baa2-b546bc955eb9"
},
"timestamp": "2025-06-19T13:47:57.228347835Z",
"elapsedMicroseconds": 2009,
"decision": "PERMIT",
"authorized": true,
"statements": [],
"status": {
"code": "OKAY",
"messages": [],
"errors": []
}
}