---
title: Authentication API
slug: api-marketplace/authentication-api
description: Learn how to implement secure user authentication methods in your applications with the Authentication API. This document covers the V2 Gateway, request body parameters, headers, and code samples for multiple programming languages. Discover details about 
createdAt: 2023-05-24T08:52:24.000Z
---


Authentication is essential to verify the identity of users and ensure secure access to systems, protecting against unauthorized entry and potential data breaches. The Authentication API supports multiple authentication schemes, including basic-auth and access token. This enables developers to implement robust and reliable user authentication methods in their applications or systems. Whether it's traditional username/password authentication (basic-auth) or token-based authentication (access-token), the API offers flexibility to suit various security requirements, enhancing the overall security and trustworthiness of the system.

***

### V2 Gateway

**Endpoint:**

:::CodeblockTabs
Production Environment

```none
POST https://signzy.tech/api/v2/patrons/login
```
:::

:::CodeblockTabs
UAT/Testing Environment

```none
POST https://preproduction.signzy.tech/api/v2/patrons/login

```
:::

***

**Request body parameters:**

| Parameters | Data Type | Description                                 | Required |
| ---------- | --------- | ------------------------------------------- | -------- |
| username   | String    | The username for authentication.            | Yes      |
| password   | String    | The password or API key for authentication. | Yes      |

```json
{
    "username": "...username...",
    "password": "...password..."
}
```

**Request headers:**

| Name         | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |

**Code samples:**

:::CodeblockTabs
```curl
curl --location 'https://preproduction.signzy.tech/api/v2/patrons/login' \
--header 'Content-Type: application/json' \
--data '{
    "username": "test",
    "password": "XXXXXXXXX"
}'
```

```nodejs
const axios = require('axios');
let data = JSON.stringify({
  "username": "test",
  "password": "XXXXXXXXX"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://preproduction.signzy.tech/api/v2/patrons/login',
  headers: { 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

```python
import http.client
import json

conn = http.client.HTTPSConnection("preproduction.signzy.tech")
payload = json.dumps({
  "username": "test",
  "password": "XXXXXXXXX"
})
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/api/v2/patrons/login", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```

```go
package main

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

func main() {

  url := "https://preproduction.signzy.tech/api/v2/patrons/login"
  method := "POST"

  payload := strings.NewReader(`{
    "username": "test",
    "password": "XXXXXXXXX"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```
:::

***

**Response body parameters:**

| Parameter | Description                                                                                                          | Accepted Values   |
| --------- | -------------------------------------------------------------------------------------------------------------------- | ----------------- |
| id        | Unique ID for the login session. You need to use this as the **access token** in your **following requests**.        | String            |
| ttl       | Number of **seconds** for which the access token is valid. The **default** validity of this token is for **1 year**. | Integer           |
| created   | Timestamp of session creation.                                                                                       | String (ISO 8601) |
| userId    | ID of the logged-in user. You need to use it as the **patron-id** in following requests.                             | String            |

```json
{
    "id": "...access_token...",
    "ttl": 31556926,
    "created": "2023-05-19T07:26:18.960Z",
    "userId": "abcd"
}
```

***

<font color="#eb144c">***Note\:*** You can reach out to the Signzy support team(</font><font color="#eb144c">help\@signzy.com</font><font color="#eb144c">)</font><font color="#eb144c"> if you don't have a **username** or **password** already assigned to you.</font>

### V3 Gateway

<font color="#eb144c">***Note\:*** You can reach out to the Signzy support team(help\@signzy.com) to get an **access token** created for you. </font>You would be able to call the Signzy APIs directly via this access token.

***

**Contact Us for Any Assistance**

If you have any questions or need assistance, please reach out to our customer support team. You can contact us via email at <font color="#2166ae">**help\@signzy.com**</font>. We strive to provide prompt and reliable assistance, ensuring your queries are addressed effectively.

We value your feedback and are committed to making your experience smooth and enjoyable. Our team is dedicated to assisting you with any needs you may have. Thank you for choosing our services. We look forward to helping you!


