Appearance
PIN setup and reset
Xash appA PIN is a 5-digit alternative to the password for signing in. The Xash app uses it. A server integration does not need a PIN, but the first endpoint here is also how you get a code to reset a forgotten password.
No token is needed for any of these.
Request a code
POST /api/v1/auth/request-pin-otp
Sends a 5-digit code by SMS to the account's phone.
| Field | Type | Required | Description |
|---|---|---|---|
user_number | string | One of the two | The account's user number. |
phone | string | One of the two | The account's phone number. |
bash
curl -X POST https://app.xash.co.zw/api/v1/auth/request-pin-otp \
-H "Content-Type: application/json" \
-d '{"user_number":"1234567890"}'json
{
"success": true,
"message": "PIN verification code sent.",
"data": {
"expires_in_minutes": 10
}
}A new code replaces any earlier one.
Set a PIN
POST /api/v1/auth/set-pin
| Field | Type | Required | Description |
|---|---|---|---|
user_number | string | One of the two | The account's user number. |
phone | string | One of the two | The account's phone number. |
otp | string | Yes | The 5-digit code from the SMS. |
pin | string | Yes | The new PIN: 5 digits. |
pin_confirmation | string | Yes | The PIN again. |
The response is the same as Sign in, with a session token and the message PIN set successfully.
Forgot PIN
POST /api/v1/auth/forgot-pin
The same request and response as Request a code. The message is PIN reset code sent.
Reset a PIN
POST /api/v1/auth/reset-pin
The same request and response as Set a PIN. The message is PIN reset successfully.
Errors
| Status | When | Body |
|---|---|---|
404 | Requesting a code for an account that does not exist. | {"success": false, "message": "User not found."} |
422 | Setting a PIN with a wrong, expired or used code, or for an unknown account. | {"success": false, "message": "Invalid or expired PIN verification code."} |
422 | A field is missing or invalid. | Validation error |
429 | More than 3 requests in a minute from this IP, or 10 in an hour, for this account. | {"message": "Too Many Attempts."} |
500 | The SMS could not be sent. | {"success": false, "message": "Failed to send PIN verification code."} |
All four endpoints share one rate limit per account. After 5 wrong codes the code is cancelled and a new one must be requested.