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

# Refresh Token

POST https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken
Content-Type: application/json

## Token Yenileme (Refresh Token)

Mevcut erişim token'ı süresi dolmadan veya dolduktan sonra, yenileme token'ı kullanarak yeni bir JWT erişim token'ı ve yenileme token'ı almayı sağlar.

### Uç Nokta (Endpoint)

`POST {{baseUrl}}/api/Authentication/RefreshToken`

***

### Kimlik Doğrulama (Authentication)

Bu istek, koleksiyon düzeyinde tanımlanan **Bearer Token** kimlik doğrulamasını devralır. `authToken` ortam değişkeni otomatik olarak kullanılır.

***

### İstek Gövdesi (Request Body)

| Alan           | Tür    | Zorunlu | Açıklama                                                                                                                                          |
| -------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Token`        | string | ✅       | Mevcut JWT erişim token'ı. Ortam değişkeni `{{authToken}}` üzerinden otomatik olarak alınır.                                                      |
| `RefreshToken` | string | ✅       | Daha önce giriş veya token yenileme işleminden elde edilen yenileme token'ı. Ortam değişkeni `{{refreshToken}}` üzerinden otomatik olarak alınır. |

**Örnek İstek Gövdesi:**

```json
{
  "Token": "{{authToken}}",
  "RefreshToken": "{{refreshToken}}"
}

```

***

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

Başarılı bir istekte HTTP `200 OK` durum kodu ile aşağıdaki JSON gövdesi döner:

| Alan           | Tür               | Açıklama                                                                               |
| -------------- | ----------------- | -------------------------------------------------------------------------------------- |
| `Token`        | string            | Yeni oluşturulan JWT erişim token'ı. Sonraki kimlik doğrulamalı isteklerde kullanılır. |
| `RefreshToken` | string            | Yeni oluşturulan yenileme token'ı. Bir sonraki token yenileme işleminde kullanılır.    |
| `Expiration`   | string (ISO 8601) | Yeni erişim token'ının süresinin dolacağı UTC tarih ve saat bilgisi.                   |

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

```json
{
  "Token": "<JWT>",
  "RefreshToken": "<yenileme_tokeni>",
  "Expiration": "2026-03-13T12:13:15Z"
}

```

***

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

Geçersiz veya süresi dolmuş token bilgileri gönderildiğinde HTTP `400 Bad Request` durum kodu döner.

**Örnek Hatalı Yanıt:**

```
 Invalid Refresh Token

```

> ⚠️ Bu hata genellikle süresi dolmuş bir yenileme token'ı, geçersiz bir erişim token'ı veya daha önce kullanılmış bir yenileme token'ı gönderildiğinde oluşur. Bu durumda `Authentication Login` endpoint'i ile yeniden giriş yapmanız gerekmektedir.

***

### Kullanım

1. Öncelikle `Authentication Login` endpoint'i ile giriş yaparak ilk `authToken` ve `refreshToken` değerlerini elde edin.

2. Erişim token'ının süresi dolmadan veya dolduktan sonra bu endpoint'i çağırarak yeni token'lar alın.

3. Dönen değerler otomatik olarak ortam değişkenlerine kaydedildiğinden, sonraki isteklerde ek bir işlem yapmanıza gerek yoktur.

> 🔄 Token yenileme işlemi, kullanıcının tekrar giriş yapmasına gerek kalmadan oturumun devam etmesini sağlar.

Reference: https://docs.insurgateway.com/insurgateway-api/authentication/refresh-token

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

## Response

### 200

OK

## Examples

**Request**

```json
{
  "Token": "{{authToken}}",
  "RefreshToken": "{{refreshToken}}"
}
```

**Response**

```json
{
  "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6InN1a3J1Z3VybmFsIiwianRpIjoiMmNhYWEwOWItNzRhYy00MDFhLThkODItYzhmYTc3YmExMzMxIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6ImRmNTFlMjE3LTNiZDctNDNhZC04YzMwLTdlM2JmZWFiYTE2OSIsIk5lZWRQYXNzd29yZENoYW5nZSI6IkZhbHNlIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvZW1haWxhZGRyZXNzIjoic3VrcnUuZ3VybmFsQGFjZXJwcm8uY29tLnRyIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy9yb2xlIjpbIkdXIFRlYW0iLCJEeW5hbWljVXJ1biJdLCJJbnN1cmFuY2VDb21wYW55SWRzIjoiIiwiZXhwIjoxNzczNDAzOTk1LCJpc3MiOiJHYXRld2F5UHJvQXBpIExpdmUiLCJhdWQiOlsiR2F0ZXdheVByb0FwaSBMaXZlIiwiR2F0ZXdheVByb0FwaSBMaXZlIl19.3uYicNUeP0ds3qXDP74Z3Ftlt_CKfi2tKdRAhY4HBp8",
  "RefreshToken": "mydNx2o/ktK736iE8Mcrpb9RLJ0fokGu",
  "Expiration": "2026-03-13T12:13:15Z"
}
```

**SDK Code**

```python Authentication_refreshToken_example
import requests

url = "https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken"

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

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

print(response.json())
```

```javascript Authentication_refreshToken_example
const url = 'https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"Token":"{{authToken}}","RefreshToken":"{{refreshToken}}"}'
};

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

```go Authentication_refreshToken_example
package main

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

func main() {

	url := "https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken"

	payload := strings.NewReader("{\n  \"Token\": \"{{authToken}}\",\n  \"RefreshToken\": \"{{refreshToken}}\"\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 Authentication_refreshToken_example
require 'uri'
require 'net/http'

url = URI("https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken")

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  \"Token\": \"{{authToken}}\",\n  \"RefreshToken\": \"{{refreshToken}}\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"Token\": \"{{authToken}}\",\n  \"RefreshToken\": \"{{refreshToken}}\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken', [
  'body' => '{
  "Token": "{{authToken}}",
  "RefreshToken": "{{refreshToken}}"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Authentication_refreshToken_example
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"Token\": \"{{authToken}}\",\n  \"RefreshToken\": \"{{refreshToken}}\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Authentication_refreshToken_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "Token": "{{authToken}}",
  "RefreshToken": "{{refreshToken}}"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://testgatewayapi.insurapps.net/api/Authentication/RefreshToken")! 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()
```