API Reference
Authentication
Sign-In with Ethereum and session tokens.
5 endpoints
#Step 1: get a single-use nonce (and a ready-to-sign message)
POST
/v1/auth/nonceSend address, domain and uri to receive the exact EIP-4361 message to pass to the wallet's personal_sign. Or omit them and build the message yourself with the returned nonce and chainId.
Request body
address | string EVM address |
domain | string host of the page asking the user to sign, e.g. app.example.xyz |
uri | string |
Response
noncerequired | string |
chainIdrequired | number |
issuedAtrequired | string |
expiresAtrequired | string |
messagerequired | string ready-to-sign EIP-4361 message when address, domain and uri were supplied |
Errors
400
curl -X POST "https://aethr-api.vercel.app/v1/auth/nonce" \
-H "content-type: application/json" \
-d '{"address":"0x7a3F00000000000000000000000000000000c91E","domain":"string","uri":"string"}'{
"nonce": "string",
"chainId": 0,
"issuedAt": "string",
"expiresAt": "string",
"message": "string"
}#Step 2: exchange the signed message for tokens
POST
/v1/auth/verifyRequest body
messagerequired | string |
signaturerequired | string |
Response
accessTokenrequired | string |
refreshTokenrequired | string |
tokenTyperequired | "Bearer" |
expiresInrequired | number |
addressrequired | string EVM address |
isAdminrequired | boolean |
Errors
400401
curl -X POST "https://aethr-api.vercel.app/v1/auth/verify" \
-H "content-type: application/json" \
-d '{"message":"string","signature":"0x…"}'{
"accessToken": "0x7a3F00000000000000000000000000000000c91E",
"refreshToken": "0x7a3F00000000000000000000000000000000c91E",
"tokenType": "Bearer",
"expiresIn": 0,
"address": "0x7a3F00000000000000000000000000000000c91E",
"isAdmin": true
}#Rotate the refresh token and get a new access token
POST
/v1/auth/refreshRefresh tokens are single use. Store the new one; reusing an old one revokes the whole session.
Request body
refreshTokenrequired | string |
Response
accessTokenrequired | string |
refreshTokenrequired | string |
tokenTyperequired | "Bearer" |
expiresInrequired | number |
addressrequired | string EVM address |
isAdminrequired | boolean |
Errors
401
curl -X POST "https://aethr-api.vercel.app/v1/auth/refresh" \
-H "content-type: application/json" \
-d '{"refreshToken":"0x7a3F00000000000000000000000000000000c91E"}'{
"accessToken": "0x7a3F00000000000000000000000000000000c91E",
"refreshToken": "0x7a3F00000000000000000000000000000000c91E",
"tokenType": "Bearer",
"expiresIn": 0,
"address": "0x7a3F00000000000000000000000000000000c91E",
"isAdmin": true
}#Sign out and revoke the session
POST
/v1/auth/logoutBearer tokenResponse
okrequired | true |
Errors
401
curl -X POST "https://aethr-api.vercel.app/v1/auth/logout" \
-H "Authorization: Bearer $ACCESS_TOKEN"{
"ok": true
}#The signed-in wallet
GET
/v1/auth/meBearer tokenResponse
addressrequired | string EVM address |
isAdminrequired | boolean |
settingsrequired | object |
unreadNotificationsrequired | number |
Errors
401
curl "https://aethr-api.vercel.app/v1/auth/me" \
-H "Authorization: Bearer $ACCESS_TOKEN"{
"address": "0x7a3F00000000000000000000000000000000c91E",
"isAdmin": true,
"settings": {},
"unreadNotifications": 0
}