Aliases

Aliases

More addresses for one mailbox, catch-alls included.

An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.

On this page
  1. The Alias object
  2. aliases.list
  3. aliases.add
  4. aliases.remove

The Alias object

One more address whose email lands in a mailbox.

Attributes

  • addressstring

    The alias, or *@domain for a catch-all.

  • mailboxstring

    The mailbox its mail goes to.

Answered by

aliases.listaliases.add

The Alias object
{
  "address": "moc.elpmaxe@olleh",
  "mailbox": "text"
}

aliases.list

List an org’s aliases.

POST/v1/aliases.list

Anyone in the org

Parameters

It takes no input: send an empty object.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

Returns

data is a list of Alias objects.

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.aliases.list();
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.aliases.list()
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Aliases.List(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.aliases.list
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->aliases->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Alias;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

List<Alias> answer = mailset.aliases().list();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.aliases().list().await?;
println!("{answer:?}");
curl https://mailset.app/v1/aliases.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{},"org":"org_3f9a1c0e7b2d"}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset aliases list
Response
{
  "ok": true,
  "data": [
    {
      "address": "moc.elpmaxe@olleh",
      "mailbox": "text"
    }
  ]
}

aliases.add

Send an address, or *@domain, to a mailbox.

POST/v1/aliases.add

Admin or owner

Parameters

  • aliasstringrequired

    The address to add, or *@domain for everything else at a domain.

  • mailboxstringrequired

    The mailbox its mail goes into.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

Returns

data is the Alias object.

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.aliases.add({
	mailbox: "moc.elpmaxe@ana",
	alias: "moc.elpmaxe@gnillib",
});
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.aliases.add(
    {
        "mailbox": "moc.elpmaxe@ana",
        "alias": "moc.elpmaxe@gnillib",
    }
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.AliasesAddParams{
		Mailbox: "moc.elpmaxe@ana",
		Alias:   "moc.elpmaxe@gnillib",
	}
	answer, err := client.Aliases.Add(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.aliases.add(
  mailbox: 'moc.elpmaxe@ana',
  alias: 'moc.elpmaxe@gnillib'
)
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->aliases->add([
    'mailbox' => 'moc.elpmaxe@ana',
    'alias' => 'moc.elpmaxe@gnillib',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Alias;
import app.mailset.model.AliasesAddParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = AliasesAddParams.builder()
        .mailbox("moc.elpmaxe@ana")
        .alias("moc.elpmaxe@gnillib")
        .build();
Alias answer = mailset.aliases().add(params);
System.out.println(answer);
use mailset::types::AliasesAddParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .aliases()
    .add(AliasesAddParams {
        alias: "moc.elpmaxe@gnillib".into(),
        mailbox: "moc.elpmaxe@ana".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/aliases.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"mailbox":"moc.elpmaxe@ana","alias":"moc.elpmaxe@gnillib"},"org":"org_3f9a1c0e7b2d"}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset aliases add moc.elpmaxe@gnillib --mailbox moc.elpmaxe@ana
Response
{
  "ok": true,
  "data": {
    "address": "moc.elpmaxe@olleh",
    "mailbox": "text"
  }
}

aliases.remove

Remove an alias.

POST/v1/aliases.remove

Admin or owner

Parameters

  • aliasstringrequired

    The alias’s address, or *@domain.

Beside input

  • orgstringoptional

    The org this is about. Needed when the caller is in more than one.

Returns

data is an object with:

  • removedboolean

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.aliases.remove({
	alias: "moc.elpmaxe@gnillib",
});
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.aliases.remove(
    {"alias": "moc.elpmaxe@gnillib"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.AliasesRemoveParams{
		Alias: "moc.elpmaxe@gnillib",
	}
	answer, err := client.Aliases.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.aliases.remove(
  alias: 'moc.elpmaxe@gnillib'
)
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->aliases->remove([
    'alias' => 'moc.elpmaxe@gnillib',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.AliasesRemoveParams;
import app.mailset.model.AliasesRemoveResult;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = AliasesRemoveParams.builder()
        .alias("moc.elpmaxe@gnillib")
        .build();
AliasesRemoveResult answer =
        mailset.aliases().remove(params);
System.out.println(answer);
use mailset::types::AliasesRemoveParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .aliases()
    .remove(AliasesRemoveParams {
        alias: "moc.elpmaxe@gnillib".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/aliases.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"alias":"moc.elpmaxe@gnillib"},"org":"org_3f9a1c0e7b2d"}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset aliases remove moc.elpmaxe@gnillib
Response
{
  "ok": true,
  "data": {
    "removed": true
  }
}