/api/qmail/local/address/from-sn

GET

Convert 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

ParamTypeRequiredDescription
snuint32YesCoin serial number to look up.
denominationint (0–4)NoDenomination 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

HTTPMessage
400Missing required parameter: sn
400Invalid sn (must be a positive integer)
500Failed to encode serial number to address
500Database error

Example

curl "http://localhost:8081/api/qmail/local/address/from-sn?sn=8189"

Related