---
title: Authorize Client with Batch Decision
description: The POST /governance-engine/batch operation authorizes the client using an individual request. On successful client authorization, the JSON PDP API invokes the Policy Decision Service.
component: pingauthorize
page_id: pingauthorize:pingauthorize:policy-decision/json-pdp/batch-requests/authorize-client-with-batch-decision
canonical_url: https://developer.pingidentity.com/pingauthorize/pingauthorize/policy-decision/json-pdp/batch-requests/authorize-client-with-batch-decision.html
section_ids:
  headers: Headers
  body: Body
  example-request: Example Request
  example-response: Example Response
---

# Authorize Client with Batch Decision

##

```none
POST {{apiPath}}/governance-engine/batch
```

The `POST /governance-engine/batch` operation authorizes the client using an individual request. On successful client authorization, the JSON PDP API invokes the Policy Decision Service.

The `{{apiPath}}` variable in this request represents the client's PingAuthorize host and port. For example, `https://<your-pingauthorize-host>:<your-pingauthorize-port>`.

### Headers

Authorization      Bearer {{accessToken}}

Content-Type      application/json

Accept      application/json

### Body

raw ( application/json )

```json
{
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
}
```

##

### Example Request

* cURL

* C#

* Go

* HTTP

* Java

* jQuery

* NodeJS

* Python

* PHP

* Ruby

* Swift

```shell
curl --location --globoff '{{apiPath}}/governance-engine/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
}'
```

```csharp
var options = new RestClientOptions("{{apiPath}}/governance-engine/batch")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@"  ""requests"": [" + "\n" +
@"    {" + "\n" +
@"      ""domain"": ""Sales.Asia Pacific""," + "\n" +
@"      ""action"": ""Retrieve""," + "\n" +
@"      ""service"": ""Mobile.Landing page""," + "\n" +
@"      ""identityProvider"": ""Social Networks.Spacebook""," + "\n" +
@"      ""attributes"": {" + "\n" +
@"        ""Prospect name"": ""B. Vo""" + "\n" +
@"      }" + "\n" +
@"    }," + "\n" +
@"    {" + "\n" +
@"      ""domain"": ""Sales.EMEA""," + "\n" +
@"      ""action"": ""Search""," + "\n" +
@"      ""service"": ""Mobile.Users search""," + "\n" +
@"      ""identityProvider"": ""Social Networks.Chirper""," + "\n" +
@"      ""attributes"": {" + "\n" +
@"        ""Prospect name"": ""A. Mann""" + "\n" +
@"      }" + "\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}}/governance-engine/batch"
  method := "POST"

  payload := strings.NewReader(`{
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "application/json")
  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 /governance-engine/batch HTTP/1.1
Host: {{apiPath}}
Accept: application/json
Content-Type: application/json
Authorization: Bearer {{accessToken}}

{
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
}
```

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"requests\": [\n    {\n      \"domain\": \"Sales.Asia Pacific\",\n      \"action\": \"Retrieve\",\n      \"service\": \"Mobile.Landing page\",\n      \"identityProvider\": \"Social Networks.Spacebook\",\n      \"attributes\": {\n        \"Prospect name\": \"B. Vo\"\n      }\n    },\n    {\n      \"domain\": \"Sales.EMEA\",\n      \"action\": \"Search\",\n      \"service\": \"Mobile.Users search\",\n      \"identityProvider\": \"Social Networks.Chirper\",\n      \"attributes\": {\n        \"Prospect name\": \"A. Mann\"\n      }\n    }\n  ]\n}");
Request request = new Request.Builder()
  .url("{{apiPath}}/governance-engine/batch")
  .method("POST", body)
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
```

```javascript
var settings = {
  "url": "{{apiPath}}/governance-engine/batch",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": "Bearer {{accessToken}}"
  },
  "data": JSON.stringify({
    "requests": [
      {
        "domain": "Sales.Asia Pacific",
        "action": "Retrieve",
        "service": "Mobile.Landing page",
        "identityProvider": "Social Networks.Spacebook",
        "attributes": {
          "Prospect name": "B. Vo"
        }
      },
      {
        "domain": "Sales.EMEA",
        "action": "Search",
        "service": "Mobile.Users search",
        "identityProvider": "Social Networks.Chirper",
        "attributes": {
          "Prospect name": "A. Mann"
        }
      }
    ]
  }),
};

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

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{apiPath}}/governance-engine/batch',
  'headers': {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{accessToken}}'
  },
  body: JSON.stringify({
    "requests": [
      {
        "domain": "Sales.Asia Pacific",
        "action": "Retrieve",
        "service": "Mobile.Landing page",
        "identityProvider": "Social Networks.Spacebook",
        "attributes": {
          "Prospect name": "B. Vo"
        }
      },
      {
        "domain": "Sales.EMEA",
        "action": "Search",
        "service": "Mobile.Users search",
        "identityProvider": "Social Networks.Chirper",
        "attributes": {
          "Prospect name": "A. Mann"
        }
      }
    ]
  })

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

```python
import requests
import json

url = "{{apiPath}}/governance-engine/batch"

payload = json.dumps({
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
})
headers = {
  'Accept': 'application/json',
  '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}}/governance-engine/batch');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Accept' => 'application/json',
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n  "requests": [\n    {\n      "domain": "Sales.Asia Pacific",\n      "action": "Retrieve",\n      "service": "Mobile.Landing page",\n      "identityProvider": "Social Networks.Spacebook",\n      "attributes": {\n        "Prospect name": "B. Vo"\n      }\n    },\n    {\n      "domain": "Sales.EMEA",\n      "action": "Search",\n      "service": "Mobile.Users search",\n      "identityProvider": "Social Networks.Chirper",\n      "attributes": {\n        "Prospect name": "A. Mann"\n      }\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}}/governance-engine/batch")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
  "requests": [
    {
      "domain": "Sales.Asia Pacific",
      "action": "Retrieve",
      "service": "Mobile.Landing page",
      "identityProvider": "Social Networks.Spacebook",
      "attributes": {
        "Prospect name": "B. Vo"
      }
    },
    {
      "domain": "Sales.EMEA",
      "action": "Search",
      "service": "Mobile.Users search",
      "identityProvider": "Social Networks.Chirper",
      "attributes": {
        "Prospect name": "A. Mann"
      }
    }
  ]
})

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

```swift
let parameters = "{\n  \"requests\": [\n    {\n      \"domain\": \"Sales.Asia Pacific\",\n      \"action\": \"Retrieve\",\n      \"service\": \"Mobile.Landing page\",\n      \"identityProvider\": \"Social Networks.Spacebook\",\n      \"attributes\": {\n        \"Prospect name\": \"B. Vo\"\n      }\n    },\n    {\n      \"domain\": \"Sales.EMEA\",\n      \"action\": \"Search\",\n      \"service\": \"Mobile.Users search\",\n      \"identityProvider\": \"Social Networks.Chirper\",\n      \"attributes\": {\n        \"Prospect name\": \"A. Mann\"\n      }\n    }\n  ]\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{apiPath}}/governance-engine/batch")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Accept")
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

200 OK

```json
{
    "responses": [
        {
            "id": "12345678-90ab-cdef-1234-567890abcdef",
            "deploymentPackageId": "12345678-90ab-cdef-1234-567890abcdef",
            "timestamp": "2021-06-11T04:18:32.820482Z",
            "elapsedTime": 830492,
            "decision": "PERMIT",
            "authorized": true,
            "statements": [
                {
                    "id": "12345678-90ab-cdef-1234-567890abcdef",
                    "name": "Advice Name",
                    "code": "advice-code",
                    "payload": "{\"data\": \"some data\"}",
                    "obligatory": true,
                    "fulfilled": false,
                    "attributes": {}
                }
            ],
            "status": {
                "code": "OKAY",
                "messages": [],
                "errors": []
            }
        },
        {
            "id": "fedcba09-8765-4321-fedcba098765",
            "deploymentPackageId": "fedcba09-8765-4321-fedcba098765",
            "timestamp": "2021-06-11T04:18:33.650974Z",
            "elapsedTime": 492048,
            "decision": "PERMIT",
            "authorized": true,
            "statements": [
                {
                    "id": "fedcba09-8765-4321-fedcba098765",
                    "name": "Different Advice",
                    "code": "advice-code",
                    "payload": "{\"data\": \"other data\"}",
                    "obligatory": false,
                    "fulfilled": false,
                    "attributes": {}
                }
            ],
            "status": {
                "code": "OKAY",
                "messages": [],
                "errors": []
            }
        }
    ]
}
```
