---
title: JWT Based Authentication
slug: api-marketplace/jwt-based-authentication
createdAt: 2026-04-07T12:20:40.438Z
---

## Overview 

This guide explains how to authenticate Signzy API requests using JWT-based access tokens. You will be provided with a **key&#x20;**(**`iss`**) and **secret&#x20;**&#x74;o generate a JWT token. 

Signzy APIs use JWT tokens for authentication. Each client is required to generate a signed JWT token and include it in the **Authorization&#x20;**&#x68;eader of their requests. 

### Prerequisites 

You need the **key&#x20;**(**iss**) and **secret&#x20;**&#x70;rovided by us. 

A library to generate JWT tokens (e.g., **`jsonwebtoken`** for Node.js, **`jwt`** for Python, etc.).

## Token Requirements 

### Payload Fields 

:::Paragraph{indent="1"}
**iss**: Use the provided key as the issuer. 
:::

:::Paragraph{indent="1"}
**exp**: Set an expiration time, in seconds since the Unix epoch. This value must not be greater than a day. 
:::

### Algorithm

:::Paragraph{indent="1"}
Use **HS256&#x20;**&#x66;or signing the JWT. 
:::

## Generating a JWT Token 

Below are examples of how to generate a JWT token in different programming languages:  

:::CodeblockTabs
```nodejs
const jwt = require('jsonwebtoken');
// Replace with your actual key and secret 
const key = 'your-issuer-key';
const secret = 'your-secret-key';
// Generate the token 
const token = jwt.sign(
    {
        iss: key, // Issuer 
        exp: Math.floor(Date.now() / 1000) + 3600 // Expires in 1 hour 
    },
    secret, // Secret key 
    { algorithm: 'HS256' }
);
console.log('Generated JWT Token:', token); 
```

```python
import jwt 
import time 
# Replace with your actual key and secret 
key = 'your-issuer-key' 
secret = 'your-secret-key' 
# Generate the token 
payload = { 
  'iss': key, # Issuer 
  'exp': int(time.time()) + 3600 # Expires in 1 hour 
} 
token = jwt.encode(payload, secret, algorithm='HS256') 
print('Generated JWT Token:', token) 
```

```java
import com.auth0.jwt.JWT; 
import com.auth0.jwt.algorithms.Algorithm; 
import java.util.Date; 
public class JWTGenerator { 
  public static void main(String[] args) { 
    String key = "your-issuer-key"; // Replace with your actual key 
    String secret = "your-secret-key"; // Replace with your actual secret
    Algorithm algorithm = Algorithm.HMAC256(secret); 
    String token = JWT.create() 
                   .withIssuer(key) 
                   .withExpiresAt(new Date(System.currentTimeMillis() + 3600 * 1000)) // Expires in 1 hour 
                   .sign(algorithm); 
     System.out.println("Generated JWT Token: " + token); 
  } 
}
```
:::

:::hint{type="info"}
Note: Users can add custom key in JWT payload to make the token unique.
:::

## Using the JWT Token 

Once you have generated the token, include it in the **Authorization&#x20;**&#x68;eader of your HTTP requests 

### Example 

```curl
curl -X GET "https: /api.signzy.com/your-endpoint" \ 
-H "Authorization: Bearer <your-jwt-token>" \ 
-H "Content-Type: application/json" 
```

**Token Expiration&#xA0;**

The token's **exp&#x20;**&#x66;ield specifies the expiration time. 

Ensure the expiry is less than a day.
