Auth API
A user has to get an authentication token before process any API.
User can generate an authentication token. He can use that token to authenticate all the other apis.
This Authentication token will be valid for 1 hour.
This Authentication token will be valid for 1 hour.
Host
- Test: https://cunipay-sandbox.twpayz.com
- Live: https://cunipay.twpayz.com
How to Generate Authentication token?
Auth token generation request has to be sent to our REST endpoint i.e. /accountServices/AccountService/authToken using POST method.
Sample Request
{
"authentication": {
"customerId":"191712",
"sKey":"908a9c1a9295f5a308de31658fa711c267c21b56c99fcde2bd51b27814c38cb4",
"customerName":"University of Cambridge"
}
}
Sample Response
{
"customerId": "191712",
"status": "success",
"responseCode": "1",
"result": {
"code": "1",
"description": "Token Generate Succesfully"
},
"customerName": "University of Cambridge",
"authToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxOTE3MTIiLCJyb2xlIjoiTWVyY2hhbnQiLCJpc3MiOiJQWiIsImV4cCI6MTc3Mzc2MDg2MSwia2V5IjoiOTdiNWFiOTI1YTI3MjkwODQ0NGQ2NTYwMTQzOWU1N2RlOGQ0ZTY2YWZkYWFlYzk0NzdiMTBkNDA1YTkxMDY5NCJ9.glqCTUH_KgYvNZFrhSF4D0PJzcHO0O3S9tWmOHLVrAo",
"timestamp": "2026-03-17 19:51:01"
}
Request Parameters
This reference lists all the standard flow parameters to be send in request.
| Parameter | Description | Format | Required |
|---|---|---|---|
| customerId | Generated unique customer id on per user sign up. | N50[0-9]{50} | Yes |
| sKey | Generated secret key for per user. | String | Yes |
| customerName | Use customerName for login. | A255 | Yes |
Response Parameters
This reference list lists all the standard flow parameters to be received in response.
| Parameter | Description | Format | Required |
|---|---|---|---|
| customerName | Generated unique customerName on per user sign up. | N50
[0-9]{50} |
Yes |
| status | Response status (SUCCESS/FAILED). | A [A-Z] |
Yes |
| responseCode | Response code | [a-zA-Z0-9] | Yes |
| result.code | Status code indicating the result of the request (e.g., "1" for success) | String (numeric) | Yes |
| result.description | Message describing the result of the API request | String | Yes |
| username | Name of the user or entity associated with the API request | String | Yes |
| authToken | Authentication token (JWT) used to authorize API requests | String (JWT Token) | Yes |
| timestamp | Date and time when the response was generated | String (YYYY-MM-DD HH:mm:ss) | Yes |
| Response Code | Message |
|---|---|
| SUCCESS | Successful Login |
| FAILED | Fail to login |
| NOT_AVAILABLE | This User is not registered |
| INVALID TOKEN | Invalid Token access |
| All fields are mandatory | Each and every field is mandatory |