/api/qmail/local/address/from-sn
GETConvert a coin serial number into its QMail email address. Looks up the local contacts directory first and falls back to a synthesized address built from the serial number and denomination.
Description
Useful when the client has a recipient's serial number (e.g. from inbox listings or contact suggestions) and needs to display the canonical email address.
If the SN is in the local contacts directory, the response is populated from the stored contact and from_directory is true. Otherwise the server builds an address from the SN and the supplied (or default) denomination class — these synthesized rows have empty name fields and from_directory: false.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
sn | uint32 | Yes | Coin serial number to look up. |
denomination | int (0–4) | No | Denomination class index used only when the SN is not in contacts. Default 2. |
Response
Found in contacts
{
"command": "address-from-sn",
"success": true,
"serial_number": 8189,
"sn": 8189,
"email": "JANE.SMITH.kilo@8189",
"first_name": "Jane",
"last_name": "Smith",
"description": "co-worker",
"class_name": "kilo",
"class": "kilo",
"denomination": 1,
"from_directory": true
}Synthesized (SN not in contacts)
{
"command": "address-from-sn",
"success": true,
"serial_number": 9999,
"sn": 9999,
"email": "@unknown.unknown.kilo@9999",
"first_name": "",
"last_name": "",
"description": "",
"class_name": "kilo",
"class": "kilo",
"denomination": 2,
"from_directory": false
}Errors
| HTTP | Message |
|---|---|
| 400 | Missing required parameter: sn |
| 400 | Invalid sn (must be a positive integer) |
| 500 | Failed to encode serial number to address |
| 500 | Database error |
Example
curl "http://localhost:8081/api/qmail/local/address/from-sn?sn=8189"Related
- /api/qmail/db/contacts/list — Browse the contacts directory.
- /api/qmail/local/util/base32-encode — Compute the base32 form of a serial number used inside the address.