---
title: Authentication API
slug: v2/authentication-api
description: Learn how Signzy ensures secure user authentication through unique usernames, API keys, and access tokens. Find out how to obtain access tokens and the authentication requirements for making API calls. Discover how to logout and protect your API key and a
createdAt: 2022-09-06T06:53:25.000Z
---

### Authentication is the method which ensures primarily two things:

- The credentials provided by you are authentic to you alone. i.e it is not misused by any one in any other way
- A secure login and logout from the system so that your account information is not compromised in any way

Signzy always ensures user authenticity with the help of a unique username and an API key that is specifically tailored to individual clients. The key also acts like your password to the APIs. You need to have an access token for making any further API calls, which you can receive by logging in manually or through a program using these credentials. This helps users to maintain the authenticity of their credentials and provides hassle-free use without any difficulty.

Signzy APIs adhere to authentication defined by Swagger 2.0 specifications. The Swagger specification defines a set of files required to describe API’s like this (RESTful API’s). As per the guidelines, each call to the APIs should include an 'Authorization' header or 'access\_token' query parameter for authentication.&#x20;

### Logging in

The first step is to login to the API service with the credentials that have been provided to you. This requires a simple HTTP call. The code below mentions data to be input, expected output and meaning of fields.

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://preproduction.signzy.tech/api/v2/patrons/login",
  "name": "Data Exchange",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "Username",
        "type": "string",
        "description": "The username for the user"
      },
      {
        "kind": "required",
        "name": "password",
        "type": "string",
        "children": [],
        "description": "The password for the user"
      },
      {
        "kind": "required",
        "name": "ttl",
        "type": "string",
        "children": [],
        "description": "The validity of the access token"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "nfPVWoQbk7xUYg3sgy8sU",
        "code": " {\n    \"id\": \"...accessToken...\",\n    \"ttl\": ..ttl..,\n    \"created\": \"..created..\",\n    \"userId\": \"..patronId...\"\n  }",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "nfPVWoQbk7xUYg3sgy8sU"
  },
  "examples": {
    "languages": [
      {
        "id": "r1z1dssOr_-bx-CNtZzv0",
        "code": "curl --location --request POST 'https://preproduction.signzy.tech/api/v2/patrons/login' \\\r\n--header 'Content-Type: application/json' \\\r\n--data-raw ' {\r\n    \"username\": \"<username>\",\r\n    \"password\": \"<password>\"\r\n  }'",
        "language": "curl",
        "customLabel": "Preproduction"
      },
      {
        "id": "9b0xn1ZMEio_fftSL-CQ6",
        "code": "curl --location --request POST 'https://signzy.tech/api/v2/patrons/login' \\\r\n--header 'Content-Type: application/json' \\\r\n--data-raw ' {\r\n    \"username\": \"<username>\",\r\n    \"password\": \"<password>\"\r\n  }'",
        "language": "curl",
        "customLabel": "Production"
      }
    ],
    "selectedLanguageId": "9b0xn1ZMEio_fftSL-CQ6"
  },
  "description": "This method allows authentication during login and logout.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "autoGeneratedAnchorSlug": "data-exchange",
  "legacyHash": "Oc7LhsiMmig9JEM_Xte7F"
}
```
:::

***

### Response Parameters

| **Parameter Name** | **Description**                                                                                                                |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| id                 | This is the access token used for accessing Signzy APIs.                                                                       |
| ttl                | This denotes the number of seconds for which the access token is valid. By default the validity of the access token is 1 year. |
| created            | The data and time of the access token creation.                                                                                |
| userId             | This is the unique Id assigned to each account.                                                                                |

Logging in into the API service requires a simple HTTP call. Following section mentions data to be input, expected output and meaning of fields.

### Sending authenticated requests

As discussed in the previous section, users can easily send requests to other endpoints of the API service after receiving the access token from the login API call. This can be done in two ways:

- By passing the access-token in the Authorization header&#x20;
- By creating an access\_token query (GET) parameter.

However, the second method is not commonly used as the query parameters are sometimes saved in the log files, thereby exposing vulnerabilities until the access\_token is deleted from sessions.&#x20;

### Security

An important aspect to remember while using the API key/password is that anybody with your API key/password or an Access Token generated using them can access all the information you have created and also send requests on your behalf. Therefore, it is highly recommended that the API-key/Password is not provided to client side. Instead, we can make use of a reverse proxy to call Signzy APIs.

In case you think an access token is compromised, you should delete it using logout. Let us know if your Signzy Password/API-key is compromised as soon as possible, so that we can disable & create new ones and prevent any misuse of your data.

### Logging out

To logout you simply need to call the logout route with the access token in 'access\_token' query parameter or as 'Authorization' header.

```json
 // To Logout
    For Test Credentials
    // POST :: <https://preproduction.signzy.tech/api/v2/patrons/logout?access_token=...accessToken...>
    For Production Credentials
    // POST :: <https://signzy.tech/api/v2/patrons/logout?access_token=...accessToken...>
 // Response is 204 status code with no content, indicating the Access-token has been deleted.
```



:::hint{type="info"}
### Getting help

Please feel free to contact us if you have any questions, require clarification, or have ideas for how to make the documents or any of our services better.


You can reach out to us at [help@signzy.com](#).
:::

