Who am I

Who am I

Who a credential signs in as.

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

On this page
  1. whoami

whoami

Show who you are signed in as.

POST/v1/whoami

Any app keyAPI token

Parameters

It takes no input: send an empty object.

Returns

data is an object with:

  • userobject

    The account signed in.

    Show child attributesHide child attributes
    • idstring

      The account’s id.

    • emailstring

      The address they sign in with.

    • namenullable string

      Their name. Null when they haven’t given one.

  • orgsarray of objects

    The orgs the account is in.

    Show child attributesHide child attributes
    • idstring

      The org’s id: what --org takes.

    • namestring

      The org’s name, as its people see it.

    • roleenum

      Your role in it: owner, admin or member.

      One ofowneradminmember

  • deviceobject

    The device, token or app key this call is signed in as.

    Show child attributesHide child attributes
    • idstring

      The device’s id.

    • namestring

      Its name: “Safari on iPhone”, or the name an app or token was given.

    • kindenum

      What it is: a browser, the cli, an API token, an app with a key, or the iPhone app (phone).

      One ofbrowserclitokenappphone

  • defaultFromnullable string

    The address new mail goes out from. Null when they haven’t picked one.

  • sessionEndsAtnumberoptional

    When this session ends, in ms since the epoch, unless it’s ended sooner. Only whoami says it.

  • passkeyHandlestringoptional

    The user handle the account’s passkeys carry. Only whoami says it, and only to a person’s own device.

In the CLIErrors

import { Mailset } from 'mailset';

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

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

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

answer = mailset.whoami()
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

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

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

answer = mailset.whoami
p answer
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->whoami();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Me;

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

Me answer = mailset.whoami();
System.out.println(answer);
// Reads MAILSET_KEY from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.whoami().await?;
println!("{answer:?}");
curl https://mailset.app/v1/whoami \
  -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 whoami
Response
{
  "ok": true,
  "data": {
    "user": {
      "id": "out_3f9a1c0e7b2d",
      "email": "moc.elpmaxe@olleh",
      "name": "Acme API"
    },
    "orgs": [
      {
        "id": "out_3f9a1c0e7b2d",
        "name": "Acme API",
        "role": "owner"
      }
    ],
    "device": {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "kind": "browser"
    },
    "defaultFrom": "text",
    "sessionEndsAt": 1796048940000,
    "passkeyHandle": "text"
  }
}