Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.foodsave.kz/llms.txt

Use this file to discover all available pages before exploring further.

Authentication API

Base path: /api/v1/auth

Overview

FoodSave uses OTP-based login for end users and short-lived JWT access tokens for authenticated requests.
OTP sends are rate-limited to 3 requests per 5 minutes per phone number.

POST /api/v1/auth/otp/send

Send an OTP code to a phone number.
curl --request POST \
  --url https://api.foodsave.kz/api/v1/auth/otp/send \
  -H 'Content-Type: application/json' \
  -d '{"phone":"+77001234567"}'
{ "message": "OTP sent", "retryAfterSeconds": 300 }
message
string
retryAfterSeconds
number

Errors

CodeMeaningHow to fix
400BAD_REQUESTCheck phone format +7XXXXXXXXXX
429RATE_LIMITWait for retryAfterSeconds

POST /api/v1/auth/otp/verify

Verify the OTP and receive tokens.
curl --request POST \
  --url https://api.foodsave.kz/api/v1/auth/otp/verify \
  -H 'Content-Type: application/json' \
  -d '{"phone":"+77001234567","code":"123456"}'
{
  "accessToken": "eyJhbGciOi...",
  "refreshToken": "def50200...",
  "tokenType": "Bearer",
  "expiresIn": 3600
}
accessToken
string
refreshToken
string
tokenType
string
expiresIn
number

Errors

CodeMeaningHow to fix
400INVALID_CODERequest a new OTP and try again
401EXPIRED_CODESend OTP again

POST /api/v1/auth/token/refresh

Refresh an access token.
curl --request POST \
  --url https://api.foodsave.kz/api/v1/auth/token/refresh \
  -H 'Content-Type: application/json' \
  -d '{"refreshToken":"def50200..."}'
{ "accessToken": "eyJhbGciOi...", "refreshToken": "def50200...", "tokenType": "Bearer", "expiresIn": 3600 }

Errors

CodeMeaningHow to fix
401INVALID_REFRESH_TOKENRe-authenticate via OTP

POST /api/v1/auth/logout

Invalidate a refresh token.
curl --request POST \
  --url https://api.foodsave.kz/api/v1/auth/logout \
  -H 'Content-Type: application/json' \
  -d '{"refreshToken":"def50200..."}'
{}

Errors

CodeMeaningHow to fix
400INVALID_TOKENSupply a valid refresh token