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

# Get Job Action By Stage

GET https://testgatewayapi.insurapps.net/api/offline/jobs/{jobId}/actions/stage/{stageId}

## Get Job Action By Stage

Belirtilen iş üzerinde, verilen `Stage` değerine ait **en son** aksiyonun `RequestDetails` içeriğini döner; yani o adımın hangi alanlarla oluşturulduğunu gösterir.

***

### Uç Nokta (Endpoint)

`GET {{baseUrl}}/api/offline/jobs/{jobId}/actions/stage/{stageId}`

***

### Kullanım

Bir iş adımında (ör. teklif reddi, poliçe talebi) hangi alanların gönderildiğini okumak için kullanılır. `Get Job Action By Id` aksiyonun **üst bilgisini**, bu servis ise aksiyonun **gönderilen alanlarını** döner. Önerilen akış:

1. `Authentication Login` servisinden token alınır.

2. `Get Job Actions` çağrılarak işin aksiyon listesi alınır.

3. İlgilenilen kaydın `ActionType` değeri okunur.

4. Bu değer `stageId` olarak bu servise gönderilir ve `RequestDetails` listesi alınır.

> ⚠️ Aynı stage bir iş üzerinde birden fazla kez oluşabilir (ör. iki kez prim revize talebi). Bu servis her zaman **en yüksek** **`Id`\*\*\*\*'ye sahip**, yani en son aksiyonu döner. Belirli bir aksiyonun detayı gerekiyorsa aksiyon kimliğiyle çalışan bir uç nokta kullanılmalıdır.

> 💡 Dönen `ActionId` değeri, aynı kaydı `Get Job Action By Id` ile sorgulamak için doğrudan kullanılabilir.

***

### 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` biçiminde erişim token'ı. |

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

| Rol                        | Erişim Kapsamı                                         |
| -------------------------- | ------------------------------------------------------ |
| `InsuranceCompanyAPIUser`  | Yalnızca kendisine ait işlerin aksiyonlarına erişir.   |
| `InsuranceCompanyAPIAdmin` | Token'daki sigorta şirketlerine ait tüm işlere erişir. |
| `Supervizor`               | Token'daki sigorta şirketlerine ait tüm işlere erişir. |

> ⚠️ İş, her hâlükârda token'daki sigorta şirketi kapsamıyla sınırlıdır. Kapsam dışındaki bir `jobId` için servis `403` değil **`404 Not Found`** döner.

***

### İstek Parametreleri

**Rota (Route) Parametreleri**

| Parametre | Tür     | Zorunlu | Açıklama                                                                                                                                       |
| --------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `jobId`   | integer | ✅       | İşin kimliği. `0`'dan büyük olmalıdır. Rotada `int` kısıtı vardır; sayısal olmayan bir değer `404` üretir.                                     |
| `stageId` | integer | ✅       | Aranan adımın `Stage` değeri. Tanımlı bir enum değeri olmalıdır. [bknz.](https://docs.insurgateway.com/offline-constants#offline-stage-action) |

Bu uç nokta sorgu (query) parametresi almaz.

> ⚠️ `stageId` rotasında `int` kısıtı **yoktur**. Sayısal olmayan bir değer (`.../stage/abc`) gönderildiğinde yanıt `404` değil, düz metin gövdeli bir `400 Bad Request` olur.

**Örnek İstek:**

```
GET {{baseUrl}}/api/offline/jobs/100931/actions/stage/2
Authorization: Bearer <token>

```

***

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

Yanıt gövdesi bir `RequestDetailResponse` nesnesidir.

> ⚠️ API `Newtonsoft.Json` `DefaultContractResolver` ile serileştirilir; alan adları C# property adlarıyla aynı, yani **PascalCase** döner (`RequestDetails`, `ActionId` …). camelCase bekleyen bir istemci alanları `null` görür.

| Alan             | Tür     | Açıklama                                                                     |
| ---------------- | ------- | ---------------------------------------------------------------------------- |
| `RequestDetails` | array   | null                                                                         |
| `Stage`          | integer | İstekte gönderilen `stageId` değeri.                                         |
| `JobId`          | integer | İşin kimliği.                                                                |
| `ActionId`       | long    | Bulunan aksiyonun kimliği. `Get Job Action By Id` çağrısında kullanılabilir. |

**`RequestDetails`** **nesnesi (****`KeyPO`****):**

| Alan       | Tür     | Açıklama                                                                                      |
| ---------- | ------- | --------------------------------------------------------------------------------------------- |
| `Id`       | integer | Alanın (key) kimliği. `OutSourceProcess Usages` servisindeki `KeyId` ile aynı sözlüğe aittir. |
| `KeyName`  | string  | Alanın görünen adı.                                                                           |
| `KeyValue` | array   | null                                                                                          |

> ⚠️ `KeyValue` bir dizidir, düz `string` değil. Tek değerli alanlarda dahi `["34ABC123"]` biçiminde gelir.

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

```json
{
  "RequestDetails": [
    { "Id": 5, "KeyValue": ["34ABC123"], "KeyName": "Plaka" },
    { "Id": 1, "KeyValue": ["11111111111"], "KeyName": "Sigortalı TC Kimlik No" },
    { "Id": 38, "KeyValue": ["Hususi"], "KeyName": "Araç Kullanım Şekli" }
  ],
  "Stage": 2,
  "JobId": 100931,
  "ActionId": 1234
}

```

***

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

Doğrulama hatalarında gövde standart hata zarfıdır ve `Response` alanı alan bazlı detayları taşır:

```json
{
  "Status": false,
  "Code": "Validation.General",
  "Message": "One or more validation errors occurred",
  "Response": [
    { "Field": "StageId", "Message": "StageId is not a valid Stage value." }
  ]
}

```

| Alan       | Tür     | Açıklama                                                                    |
| ---------- | ------- | --------------------------------------------------------------------------- |
| `Status`   | boolean | Hatalı yanıtlarda daima `false`.                                            |
| `Code`     | string  | Hata kodu (`Validation.General`, `OfflineAction.ActionNotFoundForStage` …). |
| `Message`  | string  | Hatanın açıklaması.                                                         |
| `Response` | array   | null                                                                        |

Olası doğrulama mesajları:

| Alan      | Mesaj                                 |
| --------- | ------------------------------------- |
| `JobId`   | `JobId must be greater than 0.`       |
| `StageId` | `StageId is not a valid Stage value.` |

> ⚠️ `400` yanıtı **üç farklı gövde biçiminde** gelebilir: (1) yukarıdaki JSON zarfı — iş kuralı doğrulaması; (2) düz metin — `stageId` sayısal olmadığında model binding hatası; (3) düz metin (`İşlem sırasında bir hata oluştu! RequestId: …`) — beklenmeyen sunucu hatası `[HandleException]` filtresi tarafından `400`'e çevrildiğinde. İstemcide gövdeyi JSON olarak ayrıştırmadan önce `Content-Type` kontrol edilmelidir.

***

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

Token gönderilmediğinde, geçersiz olduğunda veya süresi dolduğunda `401 Unauthorized` döner. Yanıt gövdesi boştur; bilgi `WWW-Authenticate` başlığındadır.

> 💡 Token'ın süresi dolduğunda yanıta `Token-Expired: true` başlığı eklenir. İstemci bu başlığı görürse `Refresh Token` servisiyle token'ı yenileyip isteği tekrarlamalıdır.

***

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

İki farklı nedenden dolayı oluşur:

**1. Rol yetersizliği** — çağıranın `InsuranceCompanyAPIUser`, `InsuranceCompanyAPIAdmin` veya `Supervizor` rollerinden hiçbiri yoksa. Gövde boştur.

**2. Token/erişim kontrolü** — gövde standart hata zarfıdır:

| Kod                                     | Mesaj                                                   | Ne zaman                                                                                |
| --------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `OfflineUsers.InsuranceCompanyNotFound` | `No valid insurance company assignment found in token.` | Token'da sigorta şirketi bilgisi yok.                                                   |
| `OfflineUsers.UserIdentityNotResolved`  | `User identity could not be resolved from token.`       | Token'dan kullanıcı kimliği çözümlenemedi.                                              |
| `OfflineJobs.JobOwnershipDenied`        | `You do not have permission to access this job.`        | `InsuranceCompanyAPIUser` rolündeki kullanıcı, kendisine ait olmayan bir işi sorguladı. |

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

```

***

### Hatalı Yanıt (404 Not Found)

İki farklı durumda döner:

| Kod                                    | Mesaj                                            | Ne zaman                                                                   |
| -------------------------------------- | ------------------------------------------------ | -------------------------------------------------------------------------- |
| `OfflineJobs.JobNotFound`              | `No job found for the requested JobId: {jobId}.` | İş yok veya token'daki sigorta şirketi kapsamı dışında.                    |
| `OfflineAction.ActionNotFoundForStage` | `No action found for stage id '{stageId}'.`      | İş erişilebilir, ancak bu iş üzerinde o stage'e ait aksiyon hiç oluşmamış. |

```json
{
  "Status": false,
  "Code": "OfflineAction.ActionNotFoundForStage",
  "Message": "No action found for stage id '33'.",
  "Response": null
}

```

Reference: https://docs.insurgateway.com/insurgateway-api/offline/get-job-action-by-stage

## 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` (string, required)
- `stageId` (string, required)

### Headers

- `Authorization` (string, optional)

## Response

### 200

OK

## Errors

### 400 Bad Request Error

Bad Request

### 403 Forbidden Error

Forbidden

### 404 Not Found Error

Not Found

## Examples

**Response**

```json
{
  "RequestDetails": [
    {
      "Id": 5,
      "KeyValue": [
        "34ABC123"
      ],
      "KeyName": "Plaka"
    },
    {
      "Id": 1,
      "KeyValue": [
        "11111111111"
      ],
      "KeyName": "Sigortalı TC Kimlik No"
    },
    {
      "Id": 38,
      "KeyValue": [
        "Hususi"
      ],
      "KeyName": "Araç Kullanım Şekli"
    }
  ],
  "Stage": 2,
  "JobId": 100931,
  "ActionId": 1234
}
```

**SDK Code**

```python Offline_getJobActionByStage_example
import requests

url = "https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId"

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

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

print(response.json())
```

```javascript Offline_getJobActionByStage_example
const url = 'https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId';
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 Offline_getJobActionByStage_example
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId"

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

url = URI("https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId")

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 Offline_getJobActionByStage_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Offline_getJobActionByStage_example
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Offline_getJobActionByStage_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/offline/jobs/jobId/actions/stage/stageId")! 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()
```