/API

Servers (Inboxes) API

The Servers API allows you to list, view, create, and modify the servers (inboxes) that store your email and SMS messages.

List all servers

Returns a list of your virtual SMTP servers. Servers are returned sorted in alphabetical order.

Postman iconInsomnia icon
GET /api/servers
curl \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers
const result = await mailosaur.servers.list();
console.log(result.items[0].name); // "Example"
cy.mailosaurListServers().then(result => {
  cy.log(result.items[0].name); // "Example"
});
result = mailosaur.servers.list()
print result.items[0].name # "Example"
ServerListResult result = mailosaur.servers().list();
var result = mailosaur.Servers.List();
Console.WriteLine(result.Items[0].Name); // "Example"
result = mailosaur.servers.list()
print(result.items[0].name) # "Example"
$result = $mailosaur->servers->all();
print($result->items[0]->name); // "Example"
result := m.Servers.List()
fmt.Println(result.Items[0].Name) // "Example"
[
    {
        "id": "abcd1234",
        "name": "Server name",
        "users": [],
        "messages": 16
    }
]

Create a server

Creates a new virtual SMTP server and returns it.

Body parameters

  • Name
    name
    Type
    string
    Required
    required
    Description
    The name of the server.
Postman iconInsomnia icon
POST /api/servers
curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"name":"Example"}' \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers
await mailosaur.servers.create({
  name: 'Example'
});
cy.mailosaurCreateServer({
  name: 'Example'
});
name = "Example"
options = ServerCreateOptions(name)

mailosaur.servers.create(options)
ServerCreateOptions options = new ServerCreateOptions();
options.withName("Example");

mailosaur.servers().create(options);
mailosaur.Servers.Create(new ServerCreateOptions()
  {
      Name = "Example"
  }
);
options = Mailosaur::Models::ServerCreateOptions.new()
options.name = 'Example'

mailosaur.servers.create(options)
$options = new ServerCreateOptions();
$options->name = 'Example';

$mailosaur->servers->create($options);
m.Servers.Create(&ServerCreateOptions{
  Name: "Example",
})
{
    "id": "abcd1234",
    "name": "Server name",
    "users": [],
    "messages": 0
}

Retrieve a server

Retrieves the detail for a single server. Simply supply the unique identifier for the required server.

Path parameters

  • Name
    id
    Type
    string
    Required
    required
    Description
    The identifier of the server to be retrieved.
Postman iconInsomnia icon
GET /api/servers/:id
curl \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers/SERVER_ID
const server = await mailosaur.servers.get('SERVER_ID');
cy.mailosaurGetServer('SERVER_ID')
  .then(server => {
      cy.log(server.name); // "Example"
  });
server = mailosaur.servers.get("SERVER_ID")
Server server = mailosaur.servers().get("SERVER_ID");
var server = mailosaur.Servers.Get("SERVER_ID");
server = mailosaur.servers.get('SERVER_ID')
$server = $mailosaur->servers->get('SERVER_ID');
server := m.Servers.Get("SERVER_ID")
{
    "id": "abcd1234",
    "name": "Server name",
    "users": [],
    "messages": 0
}

Retrieve server password

Retrieves the password, for use with SMTP and POP3, for a single server. Simply supply the unique identifier for the required server.

Path parameters

  • Name
    id
    Type
    string
    Required
    required
    Description
    The identifier of the server.
Postman iconInsomnia icon
GET /api/servers/:id/password
curl \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers/SERVER_ID/password
const password = await mailosaur.servers.getPassword('SERVER_ID');
cy.mailosaurGetServerPassword('SERVER_ID').then(password => {
  cy.log(password);
});
password = mailosaur.servers.get_password("SERVER_ID")
String password = mailosaur.servers().getPassword("SERVER_ID");
var password = mailosaur.Servers.GetPassword("SERVER_ID");
password = mailosaur.servers.get_password('SERVER_ID')
$password = $mailosaur->servers->getPassword('SERVER_ID');
password, err := m.Servers.GetPassword("SERVER_ID")
{
    "value": "server-password"
}

Update a server

Updates a single server and returns it.

Path parameters

  • Name
    id
    Type
    string
    Required
    required
    Description
    The identifier of the server to be updated.

Body parameters

  • Name
    name
    Type
    string
    Required
    required
    Description
    The name of the server.
Postman iconInsomnia icon
PUT /api/servers/:id
curl \
  -X PUT \
  -H 'Content-Type: application/json' \
  -d '{"name":"Updated server name"}' \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers/SERVER_ID
await mailosaur.servers.update('SERVER_ID', {
  name: 'Updated server name'
});
cy.mailosaurUpdateServer('SERVER_ID', {
  name: 'Updated server name'
});
retrieved_server = mailosaur.servers.get("SERVER_ID")
retrieved_server.name = "Updated server name"

mailosaur.servers.update(retrieved_server.id, retrieved_server)
Server retrievedServer = mailosaur.servers().get("SERVER_ID");
retrievedServer.withName("Updated server name");

mailosaur.servers().update(retrievedServer.id(), retrievedServer);
var retrievedServer = mailosaur.Servers.Get("SERVER_ID");
retrievedServer.Name = "Updated server name";

mailosaur.Servers.Update(retrievedServer.Id, retrievedServer);
retrieved_server = mailosaur.servers.get("SERVER_ID")
retrieved_server.name = "Updated server name"

mailosaur.servers.update(retrieved_server.id, retrieved_server)
$retrievedServer = $mailosaur->servers->get('SERVER_ID');
$retrievedServer->name = 'Updated server name';

$mailosaur->servers->update($retrievedServer->id, $retrievedServer);
retrievedServer, err := m.Servers.Get("SERVER_ID")

if (err != nil) {
  // Handle err
}

retrievedServer.Name = "Updated server name"

m.Servers.Update(retrievedServer.Id, retrievedServer);
{
    "id": "abcd1234",
    "name": "Server name",
    "users": [],
    "messages": 0
}

Delete a server

Permanently deletes a server. This operation cannot be undone. Also deletes all messages and associated attachments within the server.

Path parameters

  • Name
    id
    Type
    string
    Required
    required
    Description
    The identifier of the server to be deleted.
Postman iconInsomnia icon
DELETE /api/servers/:id
curl \
  -X DELETE \
  -u api:YOUR_API_KEY \
  https://mailosaur.com/api/servers/SERVER_ID
await mailosaur.servers.del('SERVER_ID');
cy.mailosaurDeleteServer('SERVER_ID');
mailosaur.servers.delete("SERVER_ID")
mailosaur.servers().delete("SERVER_ID");
mailosaur.Servers.Delete("SERVER_ID");
mailosaur.servers.delete('SERVER_ID')
$mailosaur->servers->delete('SERVER_ID');
m.Servers.Delete("SERVER_ID")