> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.insurgateway.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.insurgateway.com/_mcp/server.

# Reject Batch Policy

POST https://testgatewayapi.insurapps.net/api/Offline/jobs/{jobId}/Policies/reject-batch
Content-Type: application/json

## Toplu Poliçe İsteğini Reddet

### Endpoint Bilgileri

| Alan              | Değer                                                        |
| ----------------- | ------------------------------------------------------------ |
| **Method**        | `POST`                                                       |
| **URL**           | `{{baseUrl}}/api/Offline/jobs/{jobId}/Policies/reject-batch` |
| **Content-Type**  | `application/json`                                           |
| **Yetkilendirme** | Bearer Token + `Update` politikası                           |

***

Bir işin toplu poliçe talebini, seçilen red sebebi ve açıklama ile reddeder.

Başarılı istekte iş `Toplu Poliçe Reddedildi` (`BatchPolicyRejected`) aşamasına geçer, red aksiyonu oluşturulur, platforma iletilir ve varsa ek dosya kaydedilir.

> İşin aşaması `Toplu Poliçe İsteği` olmalıdır; aksi halde geçiş reddedilir.

***

### Route Parametreleri

| Parametre | Tip       | Zorunlu | Açıklama                                             |
| --------- | --------- | ------- | ---------------------------------------------------- |
| `jobId`   | `integer` | Evet    | Reddedilecek toplu poliçe talebinin ait olduğu iş Id |

***

### Kimlik Doğrulama

Geçerli bir bearer token gerektirir. Token şunları içermelidir:

* Tanınan bir rol (`InsuranceCompanyAPIUser`, `InsuranceCompanyAPIAdmin` veya `Supervizor`)
* İlgili route için `Update` yetkisi
* Geçerli bir sigorta şirketi ataması
* Çözümlenebilir bir kullanıcı kimliği

> `InsuranceCompanyAPIUser` yalnızca kendi sahibi olduğu işleri reddedebilir. `InsuranceCompanyAPIAdmin` ve `Supervizor` şirketin tüm işlerine erişebilir.

***

### İstek Modeli — `RejectBatchPolicyRequest`

| Alan             | Tip                 | Zorunlu | Açıklama                      | Doğrulama                                                                                            |
| ---------------- | ------------------- | ------- | ----------------------------- | ---------------------------------------------------------------------------------------------------- |
| `Message`        | `string`            | Evet    | Red açıklaması                | Boş olamaz: `"Message is required."` Maks. 1000 karakter: `"Message cannot exceed 1000 characters."` |
| `RejectReasonId` | `integer`           | Evet    | Red sebebi Id                 | 0'dan büyük olmalı: `"RejectReasonId must be greater than zero."`                                    |
| `Attachment`     | `PolicyFileRequest` | Hayır   | Redde dayanak oluşturan belge | Gönderilirse `PolicyFileRequest` doğrulamaları uygulanır                                             |

> `JobId` gövdeden alınmaz; route parametresinden set edilir. 0'dan büyük olmalıdır: `"JobId must be greater than zero."`

#### Ek Dosya — `PolicyFileRequest`

| Alan            | Tip      | Zorunlu | Açıklama                   | Doğrulama                                                                                                                      |
| --------------- | -------- | ------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `FileName`      | `string` | Evet\*  | Dosya adı                  | Boş olamaz: `"FileName must not be empty."` `.pdf` ile bitmeli: `"Only PDF files are allowed."`                                |
| `Base64Content` | `string` | Evet\*  | Base64 kodlu dosya içeriği | Boş olamaz: `"Base64Content must not be empty."` Geçerli bir PDF olmalı: `"Base64Content must be a valid base64-encoded PDF."` |
| `ContentType`   | `string` | Hayır   | MIME türü                  | Doğrulanmaz                                                                                                                    |

> \* Bu alanlar yalnızca `Attachment` nesnesi gönderildiğinde doğrulanır. İçerik, base64 çözüldükten sonra PDF imzasıyla (`%PDF`) başlamalıdır.

***

### Red Sebebi Kontrolleri

Gönderilen `RejectReasonId` sırasıyla şu kontrollerden geçer:

1. Sistemde kayıtlı olmalıdır.
2. `Policy` kategorisinde olmalıdır.
3. İşin sigorta şirketi, red sebebinin dahil/hariç listesi tarafından engellenmemiş olmalıdır.

***

### Yanıt

#### `204 No Content` — Başarılı Yanıt

Gövde boştur.

***

### Hata Senaryoları

#### `400 Bad Request` — Doğrulama Hatası

İstek modeli doğrulamadan geçemediğinde döner. Hatalı alanlar `Response` içinde listelenir.

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "Message",
      "Message": "Message is required."
    },
    {
      "Field": "RejectReasonId",
      "Message": "RejectReasonId must be greater than zero."
    }
  ]
}

```

***

#### `400 Bad Request` — Red Sebebi Bulunamadı

Gönderilen `RejectReasonId` sistemde kayıtlı değilse döner.

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "JobRejectReason.RejectReasonNotFound",
      "Message": "The specified reject reason was not found."
    }
  ]
}

```

***

#### `400 Bad Request` — Red Sebebi Kategorisi Geçersiz

Red sebebi `Policy` kategorisinde değilse döner.

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "JobRejectReason.InvalidRejectReasonCategory",
      "Message": "The reject reason must be in the Policy category."
    }
  ]
}

```

***

#### `400 Bad Request` — Red Sebebi Şirket İçin Kullanılamaz

Red sebebi, işin sigorta şirketi için dahil/hariç listesiyle engellenmişse döner.

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "JobRejectReason.RejectReasonNotAllowedForInsuranceCompany",
      "Message": "The specified reject reason is not allowed for your insurance company."
    }
  ]
}

```

***

#### `400 Bad Request` — State Geçişi Başarısız

İş uygun aşamada değilse ya da red aksiyonu platforma iletilemezse döner. `Message` alanı iş kuralı hatasının detayını içerir.

```json
{
  "Status": false,
  "Code": "OfflinePolicies.StateTransitionFailed",
  "Message": "Policy rejection failed: 'Toplu Poliçe Gerçekleşti' aşamasından 'Toplu Poliçe Reddedildi' aşamasına geçiş yapılamaz.",
  "Response": null
}

```

> Aksiyon platforma iletilemediğinde (red sebebi teknik hata kategorisinde değilse) oluşturulan aksiyon silinir ve iş `Toplu Poliçe İsteği` aşamasına geri döndürülür.

***

#### `403 Forbidden` — Geçerli Sigorta Şirketi Ataması Bulunamadı

Token'da geçerli bir sigorta şirketi ataması bulunmadığında döner.

```json
{
  "Status": false,
  "Code": "OfflineUsers.InsuranceCompanyNotFound",
  "Message": "No valid insurance company assignment found in token.",
  "Response": null
}

```

***

#### `403 Forbidden` — Kullanıcı Kimliği Çözümlenemedi

Token'dan kullanıcı kimliği okunamadığında döner.

```json
{
  "Status": false,
  "Code": "OfflineUsers.UserIdentityNotResolved",
  "Message": "User identity could not be resolved from token.",
  "Response": null
}

```

***

#### `403 Forbidden` — İşe Erişim Reddedildi

İş, çağıranın sahipliğinde değilse döner.

```json
{
  "Status": false,
  "Code": "OfflineJobs.JobOwnershipDenied",
  "Message": "You do not have permission to access this job.",
  "Response": null
}

```

***

#### `403 Forbidden` — Rol veya Yetki Yetersiz

Kullanıcı tanınan rollerden birine sahip değilse ya da `Update` yetkisi yoksa döner. **Gövde boştur.**

***

#### `401 Unauthorized` — Token Yok veya Geçersiz

Token gönderilmediğinde, geçersiz olduğunda veya süresi dolduğunda döner. **Gövde boştur.**

***

#### `404 Not Found` — İş Bulunamadı

Belirtilen `jobId` ile bir iş bulunamadığında döner.

```json
{
  "Status": false,
  "Code": "OfflineJobs.JobNotFound",
  "Message": "No job found for the requested JobId: 100931.",
  "Response": null
}

```

***

#### `500 Internal Server Error` — State Geçişinde Beklenmeyen Hata

Geçiş sırasında iş kuralı dışında bir hata oluştuğunda döner.

```json
{
  "Status": false,
  "Code": "JobState.TransitionError",
  "Message": "An unexpected error occurred during job state transition.",
  "Response": null
}

```

Reference: https://docs.insurgateway.com/insurgateway-api/offline/reject-batch-policy

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://testgatewayapi.insurapps.net` (https://testgatewayapi.insurapps.net, default)
- `https://gatewayapi.insurapps.net` (https://gatewayapi.insurapps.net)

## Request

### Path parameters

- `jobId` (integer, required)

## Response

### 204

No Content

## Errors

### 400 Bad Request Error

Bad Request

### 403 Forbidden Error

Forbidden

### 404 Not Found Error

Not Found

### 500 Internal Server Error

Internal Server Error

## Examples

**Request**

```json
{
  "Message": "Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.",
  "RejectReasonId": 12,
  "Attachment": {
    "FileName": "red-gerekce.pdf",
    "ContentType": "application/pdf",
    "Base64Content": "JVBERi0xLjAK"
  }
}
```

**Response**

```json
""
```

**SDK Code**

```python Offline_rejectBatchPolicy_example
import requests

url = "https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch"

payload = {
    "Message": "Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.",
    "RejectReasonId": 12,
    "Attachment": {
        "FileName": "red-gerekce.pdf",
        "ContentType": "application/pdf",
        "Base64Content": "JVBERi0xLjAK"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Offline_rejectBatchPolicy_example
const url = 'https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"Message":"Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.","RejectReasonId":12,"Attachment":{"FileName":"red-gerekce.pdf","ContentType":"application/pdf","Base64Content":"JVBERi0xLjAK"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Offline_rejectBatchPolicy_example
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch"

	payload := strings.NewReader("{\n  \"Message\": \"Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.\",\n  \"RejectReasonId\": 12,\n  \"Attachment\": {\n    \"FileName\": \"red-gerekce.pdf\",\n    \"ContentType\": \"application/pdf\",\n    \"Base64Content\": \"JVBERi0xLjAK\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Offline_rejectBatchPolicy_example
require 'uri'
require 'net/http'

url = URI("https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"Message\": \"Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.\",\n  \"RejectReasonId\": 12,\n  \"Attachment\": {\n    \"FileName\": \"red-gerekce.pdf\",\n    \"ContentType\": \"application/pdf\",\n    \"Base64Content\": \"JVBERi0xLjAK\"\n  }\n}"

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

```java Offline_rejectBatchPolicy_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"Message\": \"Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.\",\n  \"RejectReasonId\": 12,\n  \"Attachment\": {\n    \"FileName\": \"red-gerekce.pdf\",\n    \"ContentType\": \"application/pdf\",\n    \"Base64Content\": \"JVBERi0xLjAK\"\n  }\n}")
  .asString();
```

```php Offline_rejectBatchPolicy_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch', [
  'body' => '{
  "Message": "Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.",
  "RejectReasonId": 12,
  "Attachment": {
    "FileName": "red-gerekce.pdf",
    "ContentType": "application/pdf",
    "Base64Content": "JVBERi0xLjAK"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Offline_rejectBatchPolicy_example
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"Message\": \"Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.\",\n  \"RejectReasonId\": 12,\n  \"Attachment\": {\n    \"FileName\": \"red-gerekce.pdf\",\n    \"ContentType\": \"application/pdf\",\n    \"Base64Content\": \"JVBERi0xLjAK\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Offline_rejectBatchPolicy_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "Message": "Poliçe talebi, risk kabul kriterleri karşılanmadığı için reddedilmiştir.",
  "RejectReasonId": 12,
  "Attachment": [
    "FileName": "red-gerekce.pdf",
    "ContentType": "application/pdf",
    "Base64Content": "JVBERi0xLjAK"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/Offline/jobs/1/Policies/reject-batch")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```