---
title: Evaluate a Decision Request
description: The POST {{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}} operation executes a decision request against the decision endpoint specified by its ID in the request URL. The request body requires the parameters property. The userContext property is optional.
component: pingone-api
page_id: pingone-api:authorize:authorization-decisions/decision-evaluation/execute-a-decision-request
canonical_url: https://developer.pingidentity.com/pingone-api/authorize/authorization-decisions/decision-evaluation/execute-a-decision-request.html
section_ids:
  prerequisites: Prerequisites
  headers: Headers
  body: Body
  example-request: Example Request
  example-response: Example Response
---

# Evaluate a Decision Request

##

```none
POST {{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}
```

The `POST {{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}` operation executes a decision request against the decision endpoint specified by its ID in the request URL. The request body requires the `parameters` property. The `userContext` property is optional.

For property descriptions, refer to [Policy decision evaluation request data model](../decision-evaluation.html#policy-decision-evaluation-request-data-model).

### Prerequisites

* Refer to [Authorization Decisions](../decision-endpoints.html) for important overview information.

* Create a decision endpoint to get a `decisionEndpointID`. Refer to [Create Decision Endpoint](../decision-endpoints/create-decision-endpoint.html). Run [Read All Decision Endpoints](../decision-endpoints/read-all-decision-endpoints.html) to find an existing endpoint.

* Run an accept agreement request to get an `consentID`. Refer to [Accept Agreement](../../../platform/users/user-agreement-consents/accept-agreement.html). Run [Read All User Agreement Consents](../../../platform/users/user-agreement-consents/read-all-user-agreement-consents.html) to find an existing agreement.

* Create a user to get a `userID`. Refer to [Create User](../../../platform/users/users-1/create-user.html). Run [Read User or Users](../../../platform/users/users-1/read-all-users.html) to find an existing user.

> **Collapse: Request Model**
>
> | Property                     | Type?  | Required? |
> | ---------------------------- | ------ | --------- |
> | `parameters`                 | Object | Required  |
> | `userContext.environment.id` | UUID   | Optional  |
> | `userContext.user.id`        | UUID   | Optional  |

### Headers

Authorization      Bearer {{accessToken}}

Content-Type      application/json

### Body

raw ( application/json )

```json
{
    "parameters": {
        "Policy Request": "payment",
        "Request - Payment.creditorName": "Customer2987",
        "Request - Payment.paymentAmount": "3000",
        "Request - Payment.consentId": "{{consentID}}"
    },
    "userContext": {
        "user": {
            "id": "{{userID}}"
        }
    }
}
```

##

### Example Request

* cURL

* C#

* Go

* HTTP

* Java

* jQuery

* NodeJS

* Python

* PHP

* Ruby

* Swift

```shell
curl --location --globoff '{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
    "parameters": {
        "Policy Request": "payment",
        "Request - Payment.creditorName": "Customer2987",
        "Request - Payment.paymentAmount": "3000",
        "Request - Payment.consentId": "{{consentID}}"
    },
    "userContext": {
        "user": {
            "id": "{{userID}}"
        }
    }
}'
```

```csharp
var options = new RestClientOptions("{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@"    ""parameters"": {" + "\n" +
@"        ""Policy Request"": ""payment""," + "\n" +
@"        ""Request - Payment.creditorName"": ""Customer2987""," + "\n" +
@"        ""Request - Payment.paymentAmount"": ""3000""," + "\n" +
@"        ""Request - Payment.consentId"": ""{{consentID}}""" + "\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);
```

```golang
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}"
  method := "POST"

  payload := strings.NewReader(`{
    "parameters": {
        "Policy Request": "payment",
        "Request - Payment.creditorName": "Customer2987",
        "Request - Payment.paymentAmount": "3000",
        "Request - Payment.consentId": "{{consentID}}"
    },
    "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 {{accessToken}}")

  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))
}
```

```http
POST /v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}} HTTP/1.1
Host: {{apiPath}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}

{
    "parameters": {
        "Policy Request": "payment",
        "Request - Payment.creditorName": "Customer2987",
        "Request - Payment.paymentAmount": "3000",
        "Request - Payment.consentId": "{{consentID}}"
    },
    "userContext": {
        "user": {
            "id": "{{userID}}"
        }
    }
}
```

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"parameters\": {\n        \"Policy Request\": \"payment\",\n        \"Request - Payment.creditorName\": \"Customer2987\",\n        \"Request - Payment.paymentAmount\": \"3000\",\n        \"Request - Payment.consentId\": \"{{consentID}}\"\n    },\n    \"userContext\": {\n        \"user\": {\n            \"id\": \"{{userID}}\"\n        }\n    }\n}");
Request request = new Request.Builder()
  .url("{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
```

```javascript
var settings = {
  "url": "{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{accessToken}}"
  },
  "data": JSON.stringify({
    "parameters": {
      "Policy Request": "payment",
      "Request - Payment.creditorName": "Customer2987",
      "Request - Payment.paymentAmount": "3000",
      "Request - Payment.consentId": "{{consentID}}"
    },
    "userContext": {
      "user": {
        "id": "{{userID}}"
      }
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{accessToken}}'
  },
  body: JSON.stringify({
    "parameters": {
      "Policy Request": "payment",
      "Request - Payment.creditorName": "Customer2987",
      "Request - Payment.paymentAmount": "3000",
      "Request - Payment.consentId": "{{consentID}}"
    },
    "userContext": {
      "user": {
        "id": "{{userID}}"
      }
    }
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

```python
import requests
import json

url = "{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}"

payload = json.dumps({
  "parameters": {
    "Policy Request": "payment",
    "Request - Payment.creditorName": "Customer2987",
    "Request - Payment.paymentAmount": "3000",
    "Request - Payment.consentId": "{{consentID}}"
  },
  "userContext": {
    "user": {
      "id": "{{userID}}"
    }
  }
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{accessToken}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

```php
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n    "parameters": {\n        "Policy Request": "payment",\n        "Request - Payment.creditorName": "Customer2987",\n        "Request - Payment.paymentAmount": "3000",\n        "Request - Payment.consentId": "{{consentID}}"\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();
}
```

```ruby
require "uri"
require "json"
require "net/http"

url = URI("{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
  "parameters": {
    "Policy Request": "payment",
    "Request - Payment.creditorName": "Customer2987",
    "Request - Payment.paymentAmount": "3000",
    "Request - Payment.consentId": "{{consentID}}"
  },
  "userContext": {
    "user": {
      "id": "{{userID}}"
    }
  }
})

response = http.request(request)
puts response.read_body
```

```swift
let parameters = "{\n    \"parameters\": {\n        \"Policy Request\": \"payment\",\n        \"Request - Payment.creditorName\": \"Customer2987\",\n        \"Request - Payment.paymentAmount\": \"3000\",\n        \"Request - Payment.consentId\": \"{{consentID}}\"\n    },\n    \"userContext\": {\n        \"user\": {\n            \"id\": \"{{userID}}\"\n        }\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{apiPath}}/v1/environments/{{envID}}/decisionEndpoints/{{decisionEndpointID}}")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", 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

```json
{
  "correlationId": "07ffb9f8-151e-4509-8205-31c46e2a4784",
  "authorizationVersion": {
    "id": "2027cfbe-4fcc-46f8-9c2f-d1f34983a43f"
  },
  "timestamp": "2021-04-06T10:41:42",
  "elapsedMicroseconds": 12345,
  "status": {
    "code": "TIMEOUT",
    "message": "description of error"
  },
  "decision": "PERMIT",
  "statements": [
    {
      "id": "fd0249a2-efa8-4f2c-b57b-859047392d53",
      "name": "payment",
      "code": "PAYMENT",
      "payload": {
        "creditorName": "Customer2987",
        "paymentAmount": 3000,
        "consentId": "a6e8d467-d512-4315-aba1-ed63059a410b"
      }
    },
    {
      "id": "57f1d526-f16a-4645-9161-412da57d89bf",
      "name": "payment",
      "code": "PAYMENT",
      "payload": {
        "creditorName": "Customer9872",
        "paymentAmount": 1428,
        "consentId": "e9fef464-06fc-4952-9339-e47cd40f4d8a"
      }
    }
  ]
}
```
