Login
POSThttps://api.ymtaz.sa/api/v1/auth/login
Authenticates a user and returns a JWT token for subsequent API requests.
Request Body
emailstringRequiredThe user's email address.
passwordstringRequiredThe user's password.
Response
statusbooleanIndicates if the request was successful.
codenumberHTTP status code.
data.account.tokenstringJWT token for authentication.
curl https://api.ymtaz.sa/api/v1/auth/login \
-H "Content-Type: application/json" \
-X POST \
-d '{
"email": "user@example.com",
"password": "your_password"
}'Response
{
"status": true,
"code": 200,
"message": "Login successful",
"data": {
"account": {
"email": "user@example.com",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}
}
}Try it out
Token Validation
GEThttps://api.ymtaz.sa/api/v1/auth/check
Validates if the provided authentication token is valid and returns the associated account information.
Request Headers
AuthorizationstringRequiredBearer token for authentication (e.g., "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...").
Response
statusbooleanIndicates if the request was successful.
codenumberHTTP status code.
data.accountobjectAccount information if the token is valid.
curl https://api.ymtaz.sa/api/v1/auth/check \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."Response
{
"status": true,
"code": 200,
"message": "Token is valid",
"data": {
"account": {
"id": 123,
"email": "user@example.com",
"account_type": "client"
}
}
}Try it out
Admin Check
GEThttps://api.ymtaz.sa/api/v1/admin/check
Checks if the authenticated user has admin privileges.
Request Headers
AuthorizationstringRequiredBearer token for authentication (e.g., "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...").
Response
statusbooleanIndicates if the request was successful.
codenumberHTTP status code.
data.is_adminbooleanIndicates if the user has admin privileges.
curl https://api.ymtaz.sa/api/v1/admin/check \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."Response
{
"status": true,
"code": 200,
"message": "User is an admin",
"data": {
"is_admin": true
}
}