Retrieve one-time password
Retrieves the one-time password for a given base32-encoded secret.
Body parameters
- Name
sharedSecret
- Type
string
- Required
required
- Description
- The base32-encoded shared secret to generate a one-time password for.
POST /api/devices/otp
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"sharedSecret":"ONSWG4TFOQYTEMY="}' \
-u api:YOUR_API_KEY \
https://mailosaur.com/api/devices/otp
{
"code": "123456",
"expires": "2022-01-01T00:00:00Z"
}
List all devices
Returns a list of your virtual security devices.
GET /api/devices
curl \
-u api:YOUR_API_KEY \
https://mailosaur.com/api/devices
[
{
"id": "abcd1234",
"name": "Device name"
}
]
Create a device
Creates a new virtual security device and returns it.
Body parameters
- Name
name
- Type
string
- Required
required
- Description
- A name for the virtual device.
- Name
sharedSecret
- Type
string
- Required
required
- Description
- The base32-encoded shared secret to generate a one-time password for.
POST /api/devices
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"name":"Example","sharedSecret":"ONSWG4TFOQYTEMY="}' \
-u api:YOUR_API_KEY \
https://mailosaur.com/api/devices
{
"id": "abcd1234",
"name": "My device"
}
Retrieve OTP for an existing device
Retrieves the current one-time password for an existing virtual security device. Simply supply the unique identifier for the required device.
Path parameters
- Name
id
- Type
string
- Required
required
- Description
- The identifier of the device to be retrieved.
GET /api/devices/:id/otp
curl \
-u api:YOUR_API_KEY \
https://mailosaur.com/api/devices/DEVICE_ID/otp
{
"code": "123456",
"expires": "2022-01-01T00:00:00Z"
}
Delete a device
Permanently deletes a device. This operation cannot be undone.
Path parameters
- Name
id
- Type
string
- Required
required
- Description
- The identifier of the device to be deleted.
DELETE /api/devices/:id
curl \
-X DELETE \
-u api:YOUR_API_KEY \
https://mailosaur.com/api/devices/DEVICE_ID
Previous
Email and SMS messages API