# Aliases

More addresses for one mailbox, catch-alls included.

An SDK signs every request with your key: [Authentication](https://mailset.app/docs/authentication.md). To sign one yourself, see [Calling the API without an SDK](https://mailset.app/docs/authentication/http.md).

## The Alias object

One more address whose email lands in a mailbox.

### Attributes

- `address` (string): The alias, or `*@domain` for a catch-all.
- `mailbox` (string): The mailbox its mail goes to.

```json
{
  "address": "hello@example.com",
  "mailbox": "text"
}
```

Answered by [aliases.list](https://mailset.app/docs/api/aliases#aliases.list), [aliases.add](https://mailset.app/docs/api/aliases#aliases.add).

## 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`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is a list of [Alias objects](https://mailset.app/docs/api/aliases#alias).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

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

const answer = await mailset.aliases.list();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.aliases.list()
print(answer)
```

Go:

```go
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)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.aliases.list
p answer
```

PHP:

```php
<?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;
```

Java:

```java
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);
```

Rust:

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

let answer = mailset.aliases().list().await?;
println!("{answer:?}");
```

curl:

```bash
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](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset aliases list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "address": "hello@example.com",
      "mailbox": "text"
    }
  ]
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/aliases#aliases-list)

## aliases.add

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

`POST /v1/aliases.add`

An admin or owner of the org.

### Parameters

- `alias` (string, required): The address to add, or `*@domain` for everything else at a domain.
- `mailbox` (string, required): The mailbox its mail goes into.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is the [Alias object](https://mailset.app/docs/api/aliases#alias).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

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

const answer = await mailset.aliases.add({
	mailbox: "ana@example.com",
	alias: "billing@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.aliases.add(
    {
        "mailbox": "ana@example.com",
        "alias": "billing@example.com",
    }
)
print(answer)
```

Go:

```go
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: "ana@example.com",
		Alias:   "billing@example.com",
	}
	answer, err := client.Aliases.Add(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.aliases.add(
  mailbox: 'ana@example.com',
  alias: 'billing@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->aliases->add([
    'mailbox' => 'ana@example.com',
    'alias' => 'billing@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
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("ana@example.com")
        .alias("billing@example.com")
        .build();
Alias answer = mailset.aliases().add(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::AliasesAddParams;

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

let answer = mailset
    .aliases()
    .add(AliasesAddParams {
        alias: "billing@example.com".into(),
        mailbox: "ana@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
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":"ana@example.com","alias":"billing@example.com"},"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](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset aliases add billing@example.com --mailbox ana@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "address": "hello@example.com",
    "mailbox": "text"
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/aliases#aliases-add)

## aliases.remove

Remove an alias.

`POST /v1/aliases.remove`

An admin or owner of the org.

### Parameters

- `alias` (string, required): The alias’s address, or `*@domain`.

Beside `input`:

- `org` (string, optional): The org this is about. Needed when the caller is in more than one.

### Returns

`data` is an object with:

- `removed` (boolean)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

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

const answer = await mailset.aliases.remove({
	alias: "billing@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.aliases.remove(
    {"alias": "billing@example.com"}
)
print(answer)
```

Go:

```go
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: "billing@example.com",
	}
	answer, err := client.Aliases.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

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

answer = mailset.aliases.remove(
  alias: 'billing@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->aliases->remove([
    'alias' => 'billing@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
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("billing@example.com")
        .build();
AliasesRemoveResult answer =
        mailset.aliases().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::AliasesRemoveParams;

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

let answer = mailset
    .aliases()
    .remove(AliasesRemoveParams {
        alias: "billing@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
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":"billing@example.com"},"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](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset aliases remove billing@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/aliases#aliases-remove)

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content