API Documentation

Documentation for API Endpoints

Endpoint:

POST /api/login

Authenticate a user and return a token for further API requests. The token can be used for further authenticated requests.

Request:

POST /api/login

Request Body (JSON):


{
    "username": "admin",
    "password": "Bismillah"
}
            

Example Response:

Successful login response (200 OK):


{
    "message": "Login Berhasil",
    "user": {
        "username": "admin",
        "id": 5,
        "avatar": "https://behrga.hanatekindo.com//storage/avatar-images/NCIdvRa13ohC12hcJ4Yq0V6UPdFfF6OsPT8auEcV.png",
        "nama_lengkap": "HRGA",
        "admin": 1,
        "pengguna": 1,
        "email": "ariyo.handoko@hanatekindo.co.id",
        "enabled": 1,
        "created": "2021-03-20T11:21:23.000000Z",
        "modified": "2025-03-18T07:39:34.000000Z",
        "nip": "202012",
        "hp": "081232313",
        "alamat": "Jakarta"
    },
    "token": "114|BhxvwZnzXKiG7HfZueLhcnQ3PI4zxlgb6BTBNthn81c44bbc"
}
            

Status Code:

200 OK - The login was successful, and a token is returned for further use in authenticated requests.

Error Response:

If the credentials are invalid, the API will return a 401 Unauthorized status code:


{
    "message": "Invalid credentials"
}