> 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 Premium

PUT https://testgatewayapi.insurapps.net/api/offline/jobs/{jobId}/premiums/reject
Content-Type: application/json

# Prim Teklifi Reddetme API Dokümantasyonu

Bu dokümantasyon, offline iş akışı kapsamında prim teklifi reddetme endpoint'inin teknik kullanım kılavuzudur. Endpoint aracılığıyla sigorta şirketi API kullanıcıları; acentelerden gelen teklif taleplerini red nedeni ve açıklama mesajı ile reddedebilir, gerektiğinde destekleyici PDF dokümanlar ekleyebilir.

***

## Endpoint Bilgisi

| Özellik           | Değer                                       |
| ----------------- | ------------------------------------------- |
| **HTTP Metodu**   | `PUT`                                       |
| **URL**           | `/api/offline/jobs/{jobId}/premiums/reject` |
| **Content-Type**  | `application/json`                          |
| **Yetkilendirme** | `Authorization: Bearer {token}`             |

### Yetkilendirme Rolleri

Çağıranın aşağıdaki rollerden birine sahip olması gerekir:

| Rol                        | Erişim Kapsamı                   |
| -------------------------- | -------------------------------- |
| `InsuranceCompanyAPIUser`  | Sadece kendi işlerine erişebilir |
| `InsuranceCompanyAPIAdmin` | Şirketin tüm işlerine erişebilir |
| `Supervizor`               | Şirketin tüm işlerine erişebilir |

### Beklenen Yanıtlar

| Senaryo                           | HTTP Durumu                 | Body                               |
| --------------------------------- | --------------------------- | ---------------------------------- |
| Başarılı red                      | `204 No Content`            | *(boş)*                            |
| Eksik zorunlu alanlar             | `400 Bad Request`           | Doğrulama hata detayları           |
| Geçersiz red nedeni               | `400 Bad Request`           | `JobRejectReason` alan hatası      |
| Geçersiz veya süresi dolmuş token | `401 Unauthorized`          | —                                  |
| Farklı kullanıcının job'ı         | `403 Forbidden`             | `OfflineJobs.JobOwnershipDenied`   |
| Var olmayan job ID                | `404 Not Found`             | `OfflineJobs.JobNotFound`          |
| Platform senkronizasyon hatası    | `500 Internal Server Error` | `JobState.ActionNotSentToPlatform` |

### Route Parametreleri

| Parametre | Tip       | Zorunlu | Açıklama                                  |
| --------- | --------- | ------- | ----------------------------------------- |
| `jobId`   | `integer` | Evet    | Reddedilecek işin benzersiz tanımlayıcısı |

***

## İstek Modeli

### Ana İstek — `RejectPremiumRequest`

| Alan              | Tip                    | Zorunlu | Açıklama                                                                                                                                     | Doğrulama Kuralları                                                                                                                                                                                                             |
| ----------------- | ---------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `JobRejectReason` | `integer`              | Evet    | Önceden tanımlı listeden red nedeni ID'si. Nedenler sigorta şirketine göre yapılandırılır.                                                   | Zorunlu: `"JobRejectReason is required."`  0'dan büyük olmalı: `"JobRejectReason must be greater than 0."`  Veritabanındaki `JobRejectReason` tablosunda mevcut olmalı  Red nedeninin `ReasonCategory` değeri `Proposal` olmalı |
| `Message`         | `string`               | Evet    | Teklif talebinin neden reddedildiğini açıklayan not. Platform üzerinden acente tarafından görülebilir. Saklamadan önce HTML-encoded yapılır. | Zorunlu: `"Message is required."`  Boş olamaz: `"Message must not be empty."`  Maks. 500 karakter: `"Message must not exceed 500 characters."`                                                                                  |
| `Attachments`     | `PremiumFileRequest[]` | Hayır   | Reddetmeye eklenecek destekleyici PDF dokümanların isteğe bağlı listesi                                                                      | Sağlanırsa her eleman `PremiumFileRequest` doğrulamasından geçer                                                                                                                                                                |

### JobRejectReason Değerleri

Aşağıdaki tablo `JobRejectReason` alanı için kullanılabilecek geçerli red nedeni ID'lerini listeler. `ReasonCategory` değeri `0` olan nedenler `Proposal` kategorisine aittir.

| ID   | Açıklama                                                  | Şirket Kısıtlaması     | ReasonCategory |
| ---- | --------------------------------------------------------- | ---------------------- | -------------- |
| `1`  | Eksik Bilgi/Belge                                         | Tüm şirketler          | `0` (Proposal) |
| `4`  | Risk Kabul Kriterleri                                     | Tüm şirketler          | `0` (Proposal) |
| `9`  | Başka Şirketten Teklif Alınamaz - Risk Kabul Kriterleri   | Sadece şirket ID: `61` | `0` (Proposal) |
| `17` | Başka Şirketten Teklif Alınabilir - Risk Kabul Kriterleri | Sadece şirket ID: `61` | `0` (Proposal) |

> **Not:** Bazı red nedenleri belirli sigorta şirketlerine özeldir. Şirket kısıtlaması olmayan nedenler tüm şirketler tarafından kullanılabilir.

***

### PDF Dosyası — `PremiumFileRequest`

> Aşağıdaki alanlar yalnızca `Attachments` listesi içinde eleman gönderildiğinde zorunludur.

| Alan            | Tip      | Zorunlu | Açıklama                   | Doğrulama Kuralları                                                                                                                                                                                                                      |
| --------------- | -------- | ------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FileName`      | `string` | Evet\*  | Dosya adı                  | Boş olamaz: `"FileName must not be empty."`  `.pdf` uzantısı olmalı (büyük/küçük harf duyarsız): `"Only PDF files are allowed."`                                                                                                         |
| `ContentType`   | `string` | Hayır   | MIME türü                  | —                                                                                                                                                                                                                                        |
| `Base64Content` | `string` | Evet\*  | Base64 kodlu dosya içeriği | Boş olamaz: `"Base64Content must not be empty."`  Geçerli Base64 olmalı: `"Base64Content must be a valid base64 encoded string."`  İçerik geçerli bir PDF olmalı (PDF magic bytes `%PDF` kontrolü): `"File content is not a valid PDF."` |

***

## İstek Örnekleri

### Minimal İstek (ek yok)

```json
{
  "JobRejectReason": 5,
  "Message": "Risk değerlendirmesi underwriting kurallarımızı aşıyor."
}

```

### Ekli İstek (PDF dokümanlarla)

```json
{
  "JobRejectReason": 12,
  "Message": "Talep edilen gayrimenkul tipi mevcut kriterlerimize göre kapsama uygun değil. Lütfen underwriting kriterlerimizi inceleyin.",
  "Attachments": [
    {
      "FileName": "underwriting-guidelines.pdf",
      "ContentType": "application/pdf",
      "Base64Content": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgL1BhZ2VNVQgzIC9QYWdlU2l6ZXMgWyAzIDAgUiBdID4+PlN0cmVhbQpCVAplYm9va2MwCgo..."
    },
    {
      "FileName": "coverage-explanation.pdf",
      "ContentType": "application/pdf",
      "Base64Content": "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMSBSIC9QYWdlTVQgMiAvUGFnZVNpemVzIFsgMiAwIFIgXSA+Pj5TdHJlYW0KQlQKZWJvb2tjMQoK..."
    }
  ]
}

```

### Sınır Testi İsteği (500 karakter mesaj)

```json
{
  "JobRejectReason": 1,
  "Message": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Pelle",
  "Attachments": []
}

```

***

## Yanıt Formatı

### Başarılı Yanıt

**HTTP Durumu:** `204 No Content`\
Yanıt gövdesi boştur.

**Başarılı Red Sonuçları:**

* Job stage'i `PremiumRequestRejected` (2) olarak güncellenir

* Red bilgisi platforma senkronize edilir

* Acente için email notification kuyruğa alınır

* Attachment'lar (varsa) document storage'a kaydedilir

### Hata Yanıtı

```json
{
  "Status": false,
  "Code": "Error.Code",
  "Message": "Error description",
  "Response": null
}

```

Doğrulama hatalarında `Response` alanı detayları içerir:

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "FieldName",
      "Message": "Error message description"
    }
  ]
}

```

***

## HTTP Durum Kodları

| Durum                       | Açıklama                                      |
| --------------------------- | --------------------------------------------- |
| `204 No Content`            | Prim teklifi başarıyla reddedildi             |
| `400 Bad Request`           | Doğrulama hatası veya geçersiz red nedeni     |
| `401 Unauthorized`          | Eksik, geçersiz veya süresi dolmuş token      |
| `403 Forbidden`             | Yetersiz yetki veya iş sahipliği reddedildi   |
| `404 Not Found`             | İş veya platform kullanıcısı bulunamadı       |
| `500 Internal Server Error` | Platform servisi hatası veya beklenmeyen hata |

***

## Hata Kodları Referansı

| Kod                                     | HTTP Durumu | Mesaj                                                     |
| --------------------------------------- | ----------- | --------------------------------------------------------- |
| `Validation.General`                    | 400         | One or more validation errors occurred                    |
| `OfflineUsers.InsuranceCompanyNotFound` | 403         | No valid insurance company assignment found in token.     |
| `OfflineUsers.UserIdentityNotResolved`  | 403         | User identity could not be resolved from token.           |
| `OfflineJobs.JobNotFound`               | 404         | No job found for the requested JobId.                     |
| `OfflineJobs.JobOwnershipDenied`        | 403         | You do not have permission to access this job.            |
| `JobState.PlatformUserNotFound`         | 404         | Platform user not found for job \{jobId}.                 |
| `JobState.SenderUserNotFound`           | 404         | Sender user not found in the system.                      |
| `JobState.ActionNotSentToPlatform`      | 500         | Failed to synchronize rejection action to the platform.   |
| `JobState.UnknownBusinessRule`          | 500         | An unexpected business rule violation occurred.           |
| `JobState.TransitionError`              | 500         | An unexpected error occurred during job state transition. |

***

## Hata Yanıt Örnekleri

### Doğrulama Hatası (birden fazla alan)

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "JobRejectReason",
      "Message": "JobRejectReason must be greater than 0."
    },
    {
      "Field": "Message",
      "Message": "Message must not be empty."
    },
    {
      "Field": "Attachments[0].FileName",
      "Message": "Only PDF files are allowed."
    },
    {
      "Field": "Attachments[0].Base64Content",
      "Message": "Base64Content must be a valid base64 encoded string."
    }
  ]
}

```

### Red Nedeni Bulunamadı

```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."
    }
  ]
}

```

### Red Nedeni Yanlış Kategori

```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 Proposal category."
    }
  ]
}

```

### Sigorta Şirketi İçin Geçersiz Red Nedeni:

```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."
    }
  ]
}

```

### İş Bulunamadı

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

```

### Erişim Reddedildi

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

```

### Platform Kullanıcısı Bulunamadı

```json
{
  "Status": false,
  "Code": "JobState.PlatformUserNotFound",
  "Message": "Platform user not found for job 12345.",
  "Response": null
}

```

### Platform Senkronizasyon Hatası

```json
{
  "Status": false,
  "Code": "JobState.ActionNotSentToPlatform",
  "Message": "Failed to synchronize rejection action to the platform.",
  "Response": null
}

```

***

***

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

## 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) — The unique identifier of the job to reject the premium offer request for.

## Response

### 204

No Content

## Errors

### 400 Bad Request Error

Bad Request

### 500 Internal Server Error

Internal Server Error

## Examples

**Request**

```json
{}
```

**Response**

```json
""
```

**SDK Code**

```python Offline_rejectPremium_example
import requests

url = "https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Offline_rejectPremium_example
const url = 'https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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

```go Offline_rejectPremium_example
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PUT", 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_rejectPremium_example
require 'uri'
require 'net/http'

url = URI("https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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

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

HttpResponse<String> response = Unirest.put("https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Offline_rejectPremium_example
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Offline_rejectPremium_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/offline/jobs/1/premiums/reject")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```