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

# Service Availability Subscriptions By Agent

GET https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/{agentId}/subscriptions

## Service Availability Subscriptions By Agent

Acentenin statü değişikliği bildirimlerine abone olduğu servis durumu kayıtlarını sayfalı döndürür. `Service Availabilities By Agent` listesinin `Subscribed` = `true` olan alt kümesidir.

### Uç Nokta (Endpoint)

`GET {{baseUrl}}/api/ServiceAvailabilities/agents/:agentId/subscriptions`

***

### Kullanım

Bu servis, bir acentenin hangi servis operasyonları için `ServiceStatusChange` bildirimi alacağını görmek için kullanılır. Önerilen akış:

1. `Authentication Login` servisinden token alınır.
2. Bu servis ilgili `agentId` ile çağrılır ve `page` değeri `HasNextPage` `false` olana kadar artırılır.
3. Dönen kayıtlar, bildirim beklenen servis operasyonları olarak kendi tarafınızda işaretlenir.

Abonelik servis operasyonu bazındadır: acente bir operasyona abone olduğunda, yetkili olduğu her şirket ve üründeki o operasyonun kaydı bu listede yer alır. Acenteye yeni bir ürün tanımlandığında abonelik değişmeden o ürünün kayıtları da listeye girer. Outsource operasyonlarında abonelik süreç bazındadır; her süreç ayrı bir abonelik kaydıdır.

Kapsam, sıralama, sayfalama ve yetki kuralları `Service Availabilities By Agent` servisiyle aynıdır.

> 💡 Hiç aboneliği olmayan acentede `Items` boş, `TotalCount` sıfır döner; bu bir hata değildir.

> ⚠️ Abonelik tanımları şu an InsurGateway tarafından yapılır; bu servis yalnızca okuma sağlar.

***

### Kimlik Doğrulama

Bu uç nokta geçerli bir JWT erişim token'ı gerektirir. Token, `Authentication Login` servisinden alınır ve `Authorization` başlığında gönderilir.

| Başlık          | Tür    | Zorunlu | Açıklama                                   |
| --------------- | ------ | ------- | ------------------------------------------ |
| `Authorization` | string | ✅       | `Bearer <token>` biçiminde erişim token'ı. |

Token'ın `Read` yetkisini taşıması gerekir.

***

### İstek Parametreleri (Path Variables)

| Parametre  | Tür             | Zorunlu | Min | Max        | Açıklama                                |
| ---------- | --------------- | ------- | --- | ---------- | --------------------------------------- |
| `:agentId` | integer (int32) | ✅       | 1   | 2147483647 | Abonelikleri istenen acentenin kimliği. |

***

### İstek Parametreleri (Query Parameters)

| Parametre  | Tür             | Zorunlu | Min | Max        | Açıklama                                                                                    |
| ---------- | --------------- | ------- | --- | ---------- | ------------------------------------------------------------------------------------------- |
| `page`     | integer (int32) | —       | 1   | 2147483647 | 1 tabanlı sayfa numarası. Varsayılan `1`.                                                   |
| `pageSize` | integer (int32) | —       | 1   | 200        | Sayfa başına kayıt sayısı. Varsayılan ve üst sınır `200`; aralık dışı değerler `400` döner. |

**Örnek İstek:**

```
GET {{baseUrl}}/api/ServiceAvailabilities/agents/1/subscriptions
Authorization: Bearer <token>
```

***

### Başarılı Yanıt (200 OK)

| Alan              | Tür     | Açıklama                            |
| ----------------- | ------- | ----------------------------------- |
| `TotalCount`      | integer | Toplam kayıt sayısı (tüm sayfalar). |
| `Page`            | integer | Dönen sayfa numarası (1 tabanlı).   |
| `Size`            | integer | Uygulanan sayfa boyutu.             |
| `TotalPage`       | integer | Toplam sayfa sayısı.                |
| `HasNextPage`     | boolean | Sonraki sayfanın olup olmadığı.     |
| `HasPreviousPage` | boolean | Önceki sayfanın olup olmadığı.      |
| `Items`           | array   | İstenen sayfanın kayıtları.         |

**`Items` nesnesi:**

| Alan                   | Tür              | Açıklama                                                                                                                         |
| ---------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `InsuranceCompanyId`   | integer          | Kaydın sigorta şirketi kimliği.                                                                                                  |
| `ProductId`            | integer \| null  | Kaydın ürün kimliği. Ürün bağımsız operasyonlarda `null`.                                                                        |
| `ServiceOperationId`   | integer          | Kaydın servis operasyonu kimliği.                                                                                                |
| `OutsourceProcessId`   | integer \| null  | Kaydın outsource süreci kimliği. Outsource olmayan operasyonlarda `null`; aynı operasyon farklı süreçler için ayrı kayıt üretir. |
| `InsuranceCompanyName` | string           | Sigorta şirketi adı.                                                                                                             |
| `ProductName`          | string           | Ürün adı. Ürün bağımsız operasyonlarda `Tüm Ürünler`.                                                                            |
| `ServiceName`          | string           | Operasyonun ait olduğu servis adı.                                                                                               |
| `ServiceOperationName` | string           | Servis operasyonu adı.                                                                                                           |
| `OutsourceProcessName` | string \| null   | Outsource süreci adı. Outsource olmayan operasyonlarda `null`.                                                                   |
| `ExcludedProductIds`   | array            | Ürün bağımsız operasyonun kapsamı dışında bırakılan ürün kimlikleri. Ürünlü kayıtlarda boş dizi.                                 |
| `Status`               | string           | Güncel statü: `Active`, `AutoDisabled`, `ManualDisabled` ya da `Unknown`.                                                        |
| `StatusReason`         | string \| null   | Son statü değişikliğinin gerekçesi. Hiç değişiklik olmadıysa `null`.                                                             |
| `StatusChangedAt`      | datetime \| null | Son statü değişikliğinin zamanı. Hiç değişiklik olmadıysa `null`.                                                                |
| `LastSuccessDate`      | datetime \| null | Gözlemlenen son başarılı işlemin zamanı. Henüz gözlem yoksa `null`.                                                              |
| `Subscribed`           | boolean          | Bu serviste her zaman `true`.                                                                                                    |

**Örnek Başarılı Yanıt:**

```json
{
  "TotalCount": 17,
  "Page": 1,
  "Size": 200,
  "TotalPage": 1,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "Items": [
    {
      "InsuranceCompanyId": 12,
      "ProductId": 27,
      "ServiceOperationId": 118,
      "OutsourceProcessId": null,
      "InsuranceCompanyName": "Örnek Sigorta",
      "ProductName": "Kasko",
      "ServiceName": "ProposalService",
      "ServiceOperationName": "Teklif",
      "OutsourceProcessName": null,
      "ExcludedProductIds": [],
      "Status": "Active",
      "StatusReason": null,
      "StatusChangedAt": null,
      "LastSuccessDate": "2026-08-10T09:31:07.44+03:00",
      "Subscribed": true
    }
  ]
}
```

***

### Hatalı Yanıt (400 Bad Request)

Hatalar `ApiResponse` zarfıyla döner:

| Alan       | Tür           | Açıklama                                                                    |
| ---------- | ------------- | --------------------------------------------------------------------------- |
| `Status`   | boolean       | Hatalarda her zaman `false`.                                                |
| `Code`     | string        | Hata kodu. Sayfalama doğrulamalarında `Validation.General`.                 |
| `Message`  | string        | Hata açıklaması.                                                            |
| `Response` | array \| null | Doğrulama hatalarında `{ Field, Message }` listesi; diğer hatalarda `null`. |

**Sayfalama doğrulama hatası** — `page` `1`'den küçük ya da `pageSize` `1–200` aralığı dışında olduğunda:

| Field      | Message                                    |
| ---------- | ------------------------------------------ |
| `Page`     | `Page must be greater than or equal to 1.` |
| `PageSize` | `PageSize must be between 1 and 200.`      |

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    {
      "Field": "PageSize",
      "Message": "PageSize must be between 1 and 200."
    }
  ]
}
```

**Geçersiz acente kimliği** — `agentId` sıfır ya da negatif gönderildiğinde:

```json
{
  "Status": false,
  "Code": "ServiceAvailability.InvalidAgentId",
  "Message": "Invalid agentId. AgentId must be greater than zero.",
  "Response": null
}
```

***

### Hatalı Yanıt (401 Unauthorized)

Token gönderilmediğinde, geçersiz olduğunda veya süresi dolduğunda HTTP `401 Unauthorized` döner. Yanıt gövdesi boştur.

> 💡 Token'ın süresi dolduysa yanıtta `Token-Expired: true` başlığı bulunur. Bu durumda `POST /api/authentication/refreshtoken` ile yeni token alınmalıdır.

***

### Hatalı Yanıt (403 Forbidden)

Acente kapsamlı bir kullanıcı (token'ında acente taşıyan entegrasyon kullanıcısı), token'ında yer almayan bir acenteyi sorguladığında döner.

```json
{
  "Status": false,
  "Code": "ServiceAvailability.AgentNotPermitted",
  "Message": "The authenticated user is not authorized for agent 999999.",
  "Response": null
}
```

Reference: https://docs.insurgateway.com/insurgateway-api/service-availability/subscriptions-by-agent

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

- `agentId` (integer, required) — Abonelikleri istenen acentenin kimliği.

### Query parameters

- `page` (integer, optional) — 1 tabanlı sayfa numarası.
- `pageSize` (integer, optional) — Sayfa başına kayıt sayısı.

### Headers

- `Authorization` (string, optional)

## Response

### 200

OK

## Errors

### 400 Bad Request Error

Bad Request

### 403 Forbidden Error

Forbidden

## Examples

### 200 - Aboneliği olan acente

**Response**

```json
{
  "TotalCount": 0,
  "Page": 1,
  "Size": 200,
  "TotalPage": 0,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "Items": []
}
```

**SDK Code**

```python 200 - Aboneliği olan acente
import requests

url = "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions"

querystring = {"page":"1","pageSize":"200"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript 200 - Aboneliği olan acente
const url = 'https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 - Aboneliği olan acente
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 200 - Aboneliği olan acente
require 'uri'
require 'net/http'

url = URI("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 200 - Aboneliği olan acente
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 - Aboneliği olan acente
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 - Aboneliği olan acente
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 - Aboneliği olan acente
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

### 200 - Aboneliği olmayan acente (boş liste)

**Response**

```json
{
  "TotalCount": 0,
  "Page": 1,
  "Size": 200,
  "TotalPage": 0,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "Items": []
}
```

**SDK Code**

```python 200 - Aboneliği olmayan acente (boş liste)
import requests

url = "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions"

querystring = {"page":"1","pageSize":"200"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript 200 - Aboneliği olmayan acente (boş liste)
const url = 'https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 - Aboneliği olmayan acente (boş liste)
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 200 - Aboneliği olmayan acente (boş liste)
require 'uri'
require 'net/http'

url = URI("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 200 - Aboneliği olmayan acente (boş liste)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 - Aboneliği olmayan acente (boş liste)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 - Aboneliği olmayan acente (boş liste)
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 - Aboneliği olmayan acente (boş liste)
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1/subscriptions?page=1&pageSize=200")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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