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

# Authentication Login

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

## Kimlik Doğrulama - Giriş

Kullanıcıyı doğrular ve bir JWT erişim token'ı, yenileme token'ı (refresh token) ve token'ın son kullanma tarihini döndürür.

### Uç Nokta (Endpoint)

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

***

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

| Alan        | Tür    | Zorunlu | Açıklama                                                                 |
| ----------- | ------ | ------- | ------------------------------------------------------------------------ |
| `UserName`  | string | ✅       | Hesaba ait kullanıcı adı.                                                |
| `Password`  | string | ✅       | Hesaba ait şifre.                                                        |
| `WebApiKey` | string | ✅       | Uygulama için Web API anahtarı. Varsayılan erişim için `"-"` kullanılır. |

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

```json
{
  "UserName": "<UserName>",
  "Password": "<Password>",
  "WebApiKey": "-"
}

```

***

### 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            | Sonraki kimlik doğrulamalı isteklerde kullanılacak JWT erişim token'ı.                         |
| `RefreshToken` | string            | Mevcut erişim token'ı süresi dolduğunda yeni bir token almak için kullanılan yenileme token'ı. |
| `Expiration`   | string (ISO 8601) | 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:01:11Z"
}

```

***

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

Giriş bilgileri yanlış olduğunda (kullanıcı adı veya şifre hatalı) HTTP `400 Bad Request` durum kodu ile aşağıdaki metin döner:

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

```
Giriş bilgileri hatalı. Lütfen tekrar deneyin.

```

> ⚠️ Bu hata genellikle yanlış kullanıcı adı, hatalı şifre veya geçersiz API anahtarı gönderildiğinde oluşur.

***

### Kullanım

Başarılı bir giriş işleminden sonra, dönen `Token` değerini `Expiration` zamanına kadar istek atabilirsiniz.

Reference: https://docs.insurgateway.com/insurgateway-api/authentication/login

## Servers

- `https://testgatewayapi.insurapps.net` (https://testgatewayapi.insurapps.net, default)
- `https://gatewayapi.insurapps.net` (https://gatewayapi.insurapps.net)

## Response

### 200

OK

## Examples

**Request**

```json
{
  "UserName": "{{vault:myUserName}}",
  "Password": "{{vault:myPassword}}",
  "WebApiKey": "-"
}
```

**Response**

```json
{
  "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzdWtydWd1cm5hbCIsImp0aSI6IjBlYmMwYTNiLWZlNmYtNGViNy1hMTdiLTk3MDdiNWVhNWRjZCIsInVuaXF1ZV9uYW1lIjoiZGY1MWUyMTctM2JkNy00M2FkLThjMzAtN2UzYmZlYWJhMTY5IiwiTmVlZFBhc3N3b3JkQ2hhbmdlIjoiRmFsc2UiLCJlbWFpbCI6InN1a3J1Lmd1cm5hbEBhY2VycHJvLmNvbS50ciIsInJvbGVzIjpbIkdXIFRlYW0iLCJEeW5hbWljVXJ1biJdLCJJbnN1cmFuY2VDb21wYW55SWRzIjoiIiwiZXhwIjoxNzczNDAzODY1LCJpc3MiOiJHYXRld2F5UHJvQXBpIExpdmUiLCJhdWQiOiJHYXRld2F5UHJvQXBpIExpdmUifQ.ptutS7BcXXTHSMev5iInDfYSqauBBzxNBl9qZJYmHSo",
  "RefreshToken": "MBPmdJZeLf/PPAkR3OMAcl9kc+qmVCJP",
  "Expiration": "2026-03-13T12:11:05Z"
}
```

**SDK Code**

```python Authentication_login_example
import requests

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

payload = {
    "UserName": "{{vault:myUserName}}",
    "Password": "{{vault:myPassword}}",
    "WebApiKey": "-"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Authentication_login_example
const url = 'https://testgatewayapi.insurapps.net/api/Authentication/login';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"UserName":"{{vault:myUserName}}","Password":"{{vault:myPassword}}","WebApiKey":"-"}'
};

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

```go Authentication_login_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"UserName\": \"{{vault:myUserName}}\",\n  \"Password\": \"{{vault:myPassword}}\",\n  \"WebApiKey\": \"-\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

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

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"UserName\": \"{{vault:myUserName}}\",\n  \"Password\": \"{{vault:myPassword}}\",\n  \"WebApiKey\": \"-\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://testgatewayapi.insurapps.net/api/Authentication/login")
  .header("Content-Type", "application/json")
  .body("{\n  \"UserName\": \"{{vault:myUserName}}\",\n  \"Password\": \"{{vault:myPassword}}\",\n  \"WebApiKey\": \"-\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://testgatewayapi.insurapps.net/api/Authentication/login', [
  'body' => '{
  "UserName": "{{vault:myUserName}}",
  "Password": "{{vault:myPassword}}",
  "WebApiKey": "-"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Authentication_login_example
using RestSharp;

var client = new RestClient("https://testgatewayapi.insurapps.net/api/Authentication/login");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"UserName\": \"{{vault:myUserName}}\",\n  \"Password\": \"{{vault:myPassword}}\",\n  \"WebApiKey\": \"-\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Authentication_login_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "UserName": "{{vault:myUserName}}",
  "Password": "{{vault:myPassword}}",
  "WebApiKey": "-"
] as [String : Any]

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

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