API ReferenceLogin
API REFERENCE

Login

Exchange your API credentials for a bearer token.

!

Reading this reference. JSON-RPC sends several operations to the same URL, picked by the method field in the body. Each operation is listed as POST /path#operation. The part after # is only a label: send the request to /path itself.

Login

Use your credentials to retrieve a JWT, then send it as the bearer token on all subsequent requests.

POST/loginlogin@loginWithUsernameAndPasswordno auth

Request Body

FieldTypeRequiredDescription
paramsobjectYesParameters for the operation. Send {} if there are none.
usernamestringYesYour API username
passwordstringYesYour API password

Request Body Example

json
{
  "jsonrpc": "2.0",
  "method": "login@loginWithUsernameAndPassword",
  "params": {
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD"
  },
  "id": "1"
}
Error codeMessageCause
400Validation errorsusername or password missing
401Error Logging in / gateway error messageInvalid credentials

Response Fields

FieldTypeDescription
resultobjectOperation result
result.access_tokenstringSend as Authorization: Bearer <access_token>
result.expirynumberToken lifetime setting

Example Response — Logged In

json
{
  "jsonrpc": "2.0",
  "result": {
    "access_token": "eyJhbGciOi...",
    "expiry": 3600
  },
  "id": "1"
}

Example Response — Invalid Credentials

json
{
  "jsonrpc": "2.0",
  "error": {
    "code": 401,
    "message": "Error Logging in"
  },
  "id": "1"
}
© 2026 Afrisend