Documentation
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/nonce

Send 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

addressstring

EVM address

domainstring

host of the page asking the user to sign, e.g. app.example.xyz

uristring

Response

noncerequiredstring
chainIdrequirednumber
issuedAtrequiredstring
expiresAtrequiredstring
messagerequiredstring

ready-to-sign EIP-4361 message when address, domain and uri were supplied

Errors

400
Request
curl -X POST "https://aethr-api.vercel.app/v1/auth/nonce" \
  -H "content-type: application/json" \
  -d '{"address":"0x7a3F00000000000000000000000000000000c91E","domain":"string","uri":"string"}'
Response · 200
{
  "nonce": "string",
  "chainId": 0,
  "issuedAt": "string",
  "expiresAt": "string",
  "message": "string"
}

#Step 2: exchange the signed message for tokens

POST/v1/auth/verify

Request body

messagerequiredstring
signaturerequiredstring

Response

accessTokenrequiredstring
refreshTokenrequiredstring
tokenTyperequired"Bearer"
expiresInrequirednumber
addressrequiredstring

EVM address

isAdminrequiredboolean

Errors

400401
Request
curl -X POST "https://aethr-api.vercel.app/v1/auth/verify" \
  -H "content-type: application/json" \
  -d '{"message":"string","signature":"0x…"}'
Response · 200
{
  "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/refresh

Refresh tokens are single use. Store the new one; reusing an old one revokes the whole session.

Request body

refreshTokenrequiredstring

Response

accessTokenrequiredstring
refreshTokenrequiredstring
tokenTyperequired"Bearer"
expiresInrequirednumber
addressrequiredstring

EVM address

isAdminrequiredboolean

Errors

401
Request
curl -X POST "https://aethr-api.vercel.app/v1/auth/refresh" \
  -H "content-type: application/json" \
  -d '{"refreshToken":"0x7a3F00000000000000000000000000000000c91E"}'
Response · 200
{
  "accessToken": "0x7a3F00000000000000000000000000000000c91E",
  "refreshToken": "0x7a3F00000000000000000000000000000000c91E",
  "tokenType": "Bearer",
  "expiresIn": 0,
  "address": "0x7a3F00000000000000000000000000000000c91E",
  "isAdmin": true
}

#Sign out and revoke the session

POST/v1/auth/logoutBearer token

Response

okrequiredtrue

Errors

401
Request
curl -X POST "https://aethr-api.vercel.app/v1/auth/logout" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
Response · 200
{
  "ok": true
}

#The signed-in wallet

GET/v1/auth/meBearer token

Response

addressrequiredstring

EVM address

isAdminrequiredboolean
settingsrequiredobject
unreadNotificationsrequirednumber

Errors

401
Request
curl "https://aethr-api.vercel.app/v1/auth/me" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
Response · 200
{
  "address": "0x7a3F00000000000000000000000000000000c91E",
  "isAdmin": true,
  "settings": {},
  "unreadNotifications": 0
}