> 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 Availabilities By Agent

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

## Service Availabilities By Agent

Bir acentenin kullanabileceği servis operasyonlarını güncel statüleriyle sayfalı döndürür. Kataloğun tamamı değil, yalnızca acentenin ürün yetkisine giren kayıtlar döner.

### Uç Nokta (Endpoint)

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

***

### Kullanım

Bu servis, bir acentenin çalışabildiği servislerin durumunu izlemek 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. `Subscribed` alanı `true` olan kayıtlar, acentenin statü değişikliği bildirimi aldığı kayıtlardır.

Kapsam acentenin ürün yetkisinden çözülür:

| Kayıt türü                                 | Dönme koşulu                                                                                      |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| Ürünlü kayıt (`ProductId` dolu)            | Acente tam olarak o ürüne yetkiliyse döner.                                                       |
| Ürün bağımsız kayıt (`ProductId` = `null`) | Acentenin o şirkette, kaydın `ExcludedProductIds` listesine girmeyen en az bir ürünü varsa döner. |

Kayıtlar şirket adı → servis adı → operasyon adı → ürün adı sırasına göre sıralanır; sıralama sayfalar arasında tutarlıdır.

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

> ⚠️ Token'ında acente taşıyan entegrasyon kullanıcıları yalnızca kendi acentelerini sorgulayabilir; başka bir acente için istek `403` ile `ServiceAvailability.AgentNotPermitted` döner.

***

### 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 | Servis durumları 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?page=1&pageSize=2
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          | Acentenin bu kaydın statü değişikliği bildirimlerine abone olup olmadığı.                                                        |

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

```json
{
  "TotalCount": 325,
  "Page": 1,
  "Size": 2,
  "TotalPage": 163,
  "HasNextPage": true,
  "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
    },
    {
      "InsuranceCompanyId": 12,
      "ProductId": null,
      "ServiceOperationId": 305,
      "OutsourceProcessId": null,
      "InsuranceCompanyName": "Örnek Sigorta",
      "ProductName": "Tüm Ürünler",
      "ServiceName": "PolicyService",
      "ServiceOperationName": "PolicyDetail",
      "OutsourceProcessName": null,
      "ExcludedProductIds": [
        44
      ],
      "Status": "AutoDisabled",
      "StatusReason": "Son 30 dakikada başarılı işlem üretilmedi.",
      "StatusChangedAt": "2026-08-10T10:05:00+03:00",
      "LastSuccessDate": "2026-08-10T09:12:44.13+03:00",
      "Subscribed": false
    }
  ]
}
```

***

### 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/service-availabilities-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) — Servis durumları 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

**Response**

```json
{
  "TotalCount": 325,
  "Page": 1,
  "Size": 2,
  "TotalPage": 163,
  "HasNextPage": true,
  "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
    },
    {
      "InsuranceCompanyId": 12,
      "ProductId": null,
      "ServiceOperationId": 305,
      "OutsourceProcessId": null,
      "InsuranceCompanyName": "Örnek Sigorta",
      "ProductName": "Tüm Ürünler",
      "ServiceName": "PolicyService",
      "ServiceOperationName": "PolicyDetail",
      "OutsourceProcessName": null,
      "ExcludedProductIds": [
        44
      ],
      "Status": "AutoDisabled",
      "StatusReason": "Son 30 dakikada başarılı işlem üretilmedi.",
      "StatusChangedAt": "2026-08-10T10:05:00+03:00",
      "LastSuccessDate": "2026-08-10T09:12:44.13+03:00",
      "Subscribed": false
    }
  ]
}
```

**SDK Code**

```python Service Availability_serviceAvailabilitiesByAgent_example
import requests

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

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

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

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

print(response.json())
```

```javascript Service Availability_serviceAvailabilitiesByAgent_example
const url = 'https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1?page=1&pageSize=2';
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 Service Availability_serviceAvailabilitiesByAgent_example
package main

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

func main() {

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

	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 Service Availability_serviceAvailabilitiesByAgent_example
require 'uri'
require 'net/http'

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

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 Service Availability_serviceAvailabilitiesByAgent_example
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?page=1&pageSize=2")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Service Availability_serviceAvailabilitiesByAgent_example
using RestSharp;

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

```swift Service Availability_serviceAvailabilitiesByAgent_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/ServiceAvailabilities/agents/1?page=1&pageSize=2")! 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()
```