Mailosaur logo
Mailosaur logo

Devices

The Devices API allows you to generate one-time passwords (OTPs) and virtual security devices, for the purpose of testing authentication systems.

POST/api/devices/otp

Retrieves the one-time password for a given base32-encoded secret.

Body parameters

  • Name
    sharedSecret
    Type
    string
    Description

    The base32-encoded shared secret to generate a one-time password for.

Run in PostmanRun in Insomnia
Example request
curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"sharedSecret":"ONSWG4TFOQYTEMY="}' \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/devices/otp
Example response
{
  "code": "123456",
  "expires": "2022-01-01T00:00:00Z"
}
GET/api/devices

Returns a list of your virtual security devices.

Run in PostmanRun in Insomnia
Example request
curl \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/devices
Example response
[
    {
        "id": "abcd1234",
        "name": "Device name"
    }
]
POST/api/devices

Creates a new virtual security device and returns it.

Body parameters

  • Name
    name
    Type
    string
    Description

    A name for the virtual device.

  • Name
    sharedSecret
    Type
    string
    Description

    The base32-encoded shared secret to generate a one-time password for.

Run in PostmanRun in Insomnia
Example request
curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"name":"Example","sharedSecret":"ONSWG4TFOQYTEMY="}' \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/devices
Example response
{
    "id": "abcd1234",
    "name": "My device"
}
GET/api/devices/:id/otp

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
    Description

    The identifier of the device to be retrieved.

Run in PostmanRun in Insomnia
Example request
curl \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/devices/DEVICE_ID/otp
Example response
{
    "code": "123456",
    "expires": "2022-01-01T00:00:00Z"
}
DELETE/api/devices/:id

Permanently deletes a device. This operation cannot be undone.

Path parameters

  • Name
    id
    Type
    string
    Description

    The identifier of the device to be deleted.

Run in PostmanRun in Insomnia
Example request
curl \
  -X DELETE \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/devices/DEVICE_ID
Previous