Tab rules

Tab rules

Always file a sender or a domain in one inbox tab.

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

On this page
  1. tabrules.list
  2. tabrules.add
  3. tabrules.remove

tabrules.list

List the senders and domains you always file in a tab.

POST/v1/tabrules.list

API token

Parameters

It takes no input: send an empty object.

Returns

data is a list of objects, each with:

  • matchstring
  • kindenum

    One ofsenderdomain

  • tabenum

    One ofprimaryupdatesnewsletterspromotions

In the CLIErrors

import { Mailset } from 'mailset';

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

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

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

answer = mailset.tabrules.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.Tabrules.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.tabrules.list
p answer
<?php

require 'vendor/autoload.php';

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

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

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

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

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

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 tabrules list
Response
{
  "ok": true,
  "data": [
    {
      "match": "text",
      "kind": "sender",
      "tab": "primary"
    }
  ]
}

tabrules.add

Always file a sender or domain in a tab.

POST/v1/tabrules.add

API token

Parameters

  • matchstringrequired

    A sender’s address, or a domain.

    At most 254 characters.

  • tabenumrequired

    The tab their mail goes to.

    One ofprimaryupdatesnewsletterspromotions

Returns

data is an object with:

  • matchstring
  • kindenum

    One ofsenderdomain

  • tabenum

    One ofprimaryupdatesnewsletterspromotions

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.tabrules.add({
	tab: "updates",
	match: "stripe.com",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.tabrules.add(
    {"tab": "updates", "match": "stripe.com"}
)
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.TabrulesAddParams{
		Tab:   mailset.InboxTabNameUpdates,
		Match: "stripe.com",
	}
	answer, err := client.Tabrules.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.tabrules.add(
  tab: 'updates',
  match: 'stripe.com'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->tabrules->add([
    'tab' => 'updates',
    'match' => 'stripe.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.InboxTabName;
import app.mailset.model.TabRule;
import app.mailset.model.TabrulesAddParams;

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

var params = TabrulesAddParams.builder()
        .tab(InboxTabName.UPDATES)
        .match("stripe.com")
        .build();
TabRule answer = mailset.tabrules().add(params);
System.out.println(answer);
use mailset::types::{InboxTabName, TabrulesAddParams};

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

let answer = mailset
    .tabrules()
    .add(TabrulesAddParams {
        r#match: "stripe.com".into(),
        tab: InboxTabName::Updates,
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/tabrules.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"tab":"updates","match":"stripe.com"}}'

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 tabrules add stripe.com --tab updates
Response
{
  "ok": true,
  "data": {
    "match": "text",
    "kind": "sender",
    "tab": "primary"
  }
}

tabrules.remove

Stop always filing a sender or domain in a tab.

POST/v1/tabrules.remove

API token

Parameters

  • matchstringrequired

    The sender’s address or domain, as it was added.

    At most 254 characters.

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.tabrules.remove({
	match: "stripe.com",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.tabrules.remove({"match": "stripe.com"})
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.TabrulesRemoveParams{
		Match: "stripe.com",
	}
	answer, err := client.Tabrules.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.tabrules.remove(match: 'stripe.com')
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->tabrules->remove([
    'match' => 'stripe.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.TabrulesRemoveParams;
import app.mailset.model.TabrulesRemoveResult;

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

var params = TabrulesRemoveParams.builder()
        .match("stripe.com")
        .build();
TabrulesRemoveResult answer =
        mailset.tabrules().remove(params);
System.out.println(answer);
use mailset::types::TabrulesRemoveParams;

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

let answer = mailset
    .tabrules()
    .remove(TabrulesRemoveParams {
        r#match: "stripe.com".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/tabrules.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"match":"stripe.com"}}'

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 tabrules remove stripe.com
Response
{
  "ok": true,
  "data": {
    "removed": true
  }
}