Skip to content

API Auth

Compatibility

  • EE2, EE3, EE4, EE5, EE6, EE7

Installation

The Auth API comes natively with the Webservice module.


Methods

POST /index.php/webservice/auth — Authenticate

Authenticate a user and retrieve a session ID.


Request Parameters

ParameterTypeRequiredDescription
usernamestringRequiredYour username or email address
passwordstringRequiredYour account password
new_sessionbooleanOptionalForce creation of a new session

Headers

HeaderValue
Content-Typeapplication/json

Request Example

php
$client = new \GuzzleHttp\Client();

$request = new \GuzzleHttp\Psr7\Request(
    'POST',
    'https://your-domain.com/index.php/webservice/auth',
    ['Content-Type' => 'application/json'],
    json_encode([
        'data' => [
            'username' => 'my-username',
            'password'  => 'your-password',
        ],
    ])
);

$response = $client->send($request, ['timeout' => 2]);

💡 With new_session: Add 'new_session' => true to the data payload to force a new session.


Response — 200 OK

json
{
    "message": "successfully auth",
    "success": true,
    "data": [
        {
            "member_id": 4,
            "session_id": "054b64e828b876b1192170211314a36f58fffb21"
        }
    ]
}

Response Fields

FieldTypeDescription
successbooleantrue when authentication succeeded
messagestringHuman readable status message
data[].member_idintegerThe authenticated member's ID
data[].session_idstringSession token to use in subsequent requests