Skip to content

REST API Authentication

Base URL: https://api.iotbackend.cloud

POST /v1/auth/login

Create a new personal access token and return it in the response.

Request body

json
{
  "email": "[email protected]",
  "password": "secret",
  "token_name": "Postman"
}

Response

json
{
  "token_type": "Bearer",
  "token": "2|example-token-value",
  "user": {
    "id": 1,
    "name": "UserName",
    "email": "[email protected]",
    "role": "user"
  }
}

Notes

  • The client must store the returned token.
  • Use the full token exactly as returned, including the prefix before |.
  • The created token is also visible in the dashboard API token settings page until it is revoked or deleted.

GET /v1/auth/me

Return the current authenticated user for the supplied bearer token.

Headers

http
Authorization: Bearer <your-token>
Accept: application/json

Response

json
{
  "data": {
    "id": 1,
    "name": "User Name",
    "email": "[email protected]",
    "role": "user",
    "email_verified_at": "2026-04-10T12:00:00+00:00",
    "last_login_at": "2026-04-13T08:30:00+00:00"
  }
}

POST /v1/auth/logout

Delete only the current bearer token.

Headers

http
Authorization: Bearer <your-token>
Accept: application/json

Response

json
{
  "message": "Logged out."
}

Notes

  • This endpoint deletes only the token used in the request.
  • Other tokens for the same user remain active.