Devices

Devices

Where you are signed in, and signing a device out.

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

On this page
  1. devices.list
  2. devices.revoke
  3. devices.revokeOthers

devices.list

List your signed-in devices.

POST/v1/devices.list

API token

Parameters

It takes no input: send an empty object.

Returns

data is a list of objects, each with:

  • idstring
  • namestring
  • kindenum

    One ofbrowserclitokenappphone

  • createdAtnumber
  • lastSeenAtnumber
  • currentboolean
  • ipnullable string

    Where the device last connected from. Null until it has, or when nothing says.

  • locationnullable string

In the CLIErrors

import { Mailset } from 'mailset';

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

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

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

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

require 'vendor/autoload.php';

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

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

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

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

let answer = mailset.devices().list().await?;
println!("{answer:?}");
curl https://mailset.app/v1/devices.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 devices list
Response
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "kind": "browser",
      "createdAt": 1796048940000,
      "lastSeenAt": 1796048940000,
      "current": true,
      "ip": "text",
      "location": "text"
    }
  ]
}

devices.revoke

Sign a device out for good.

POST/v1/devices.revoke

API token

Parameters

  • idstringrequired

    The device’s id, from devices list.

Returns

data is an object with:

  • revokedboolean

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.devices.revoke({
	id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
from mailset import Mailset

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

answer = mailset.devices.revoke(
    {"id": "d_4b8e2a6c9f1d3057b3e8a2c6"}
)
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.DevicesRevokeParams{
		ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
	}
	answer, err := client.Devices.Revoke(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.devices.revoke(
  id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->devices->revoke([
    'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.DevicesRevokeParams;
import app.mailset.model.DevicesRevokeResult;

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

var params = DevicesRevokeParams.builder()
        .id("d_4b8e2a6c9f1d3057b3e8a2c6")
        .build();
DevicesRevokeResult answer =
        mailset.devices().revoke(params);
System.out.println(answer);
use mailset::types::DevicesRevokeParams;

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

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

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 devices revoke --id d_4b8e2a6c9f1d3057b3e8a2c6
Response
{
  "ok": true,
  "data": {
    "revoked": true
  }
}

devices.revokeOthers

Sign out every device but this one. App keys and API tokens stay.

POST/v1/devices.revokeOthers

API tokenPasskey

Parameters

It takes no input: send an empty object.

Beside input

  • approvalstringoptional

    An approval’s id, once someone approved it with their passkey. Without one, the answer is step_up_required and names what to approve.

Returns

data is an object with:

  • revokednumber

In the CLIErrors

import { Mailset } from 'mailset';

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

const answer = await mailset.devices.revokeOthers();
console.log(answer);
from mailset import Mailset

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

answer = mailset.devices.revoke_others()
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.Devices.RevokeOthers(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

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

answer = mailset.devices.revoke_others
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->devices->revokeOthers();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.DevicesRevokeOthersResult;

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

DevicesRevokeOthersResult answer =
        mailset.devices().revokeOthers();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.devices().revoke_others().await?;
println!("{answer:?}");
curl https://mailset.app/v1/devices.revokeOthers \
  -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 devices revokeOthers
Response
{
  "ok": true,
  "data": {
    "revoked": 1
  }
}