dambel

دمبل

shevron
ورود | ثبت نام

API Docs / auth / login



POST /api/v1/auth/login

Authenticates a user and returns an API token for subsequent requests.


Request Body Parameters

NameTypeRequiredDescriptionExample
emailstringYesUser email address"user@example.com"
passwordstringYesUser password"password123"
expirationintNoToken expiration in seconds (optional; if omitted, token never expires)3600
token_namestringNoOptional name for the token (defaults to user agent if not provided)"MyAppToken"

Request Example

{
  "email": "user@example.com",
  "password": "password123",
  "expiration": 3600,
  "token_name": "MyAppToken"
}

Response

201 Created

Returns the API token.

Example

{
  "token": "<the API token will be set here>"
}

Error Responses

StatusDescriptionExample/Reference
403Invalid credentials{ "error": "Invalid credentials" }
422Validation errorValidation error
429Too many requestsRate-limit error

How to use API token?

After logging in and receiving the token, save it on the client side (e.g., in a cookie or local storage). For every subsequent API call, pass the token as a Bearer token in the headers:

Authorization: Bearer {token}
footer wave
logo

دمبل، دنیای هوشمند ورزش و تغذیه

LinkedinInstagramXYoutube