App keys
The keys your product’s servers hold, and what each one may do.
An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.
keys.list
List your app keys: what each sends as, and when it was last used.
POST/v1/keys.list
Parameters
It takes no input: send an empty object.
Returns
data is a list of Key status objects.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.keys.list();
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.keys.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.Keys.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.keys.list
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->keys->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.KeyStatus;
import java.util.List;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
List<KeyStatus> answer = mailset.keys().list();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset.keys().list().await?;
println!("{answer:?}");
curl https://mailset.app/v1/keys.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 keys list
{
"ok": true,
"data": [
{
"id": "grant_3f9a1c0e7b2d",
"name": "Acme API",
"createdAt": 1793456940000,
"lastSeenAt": 1796048940000,
"expiresAt": 1803824940000,
"paused": null,
"mailboxes": [
{
"address": "moc.elpmaxe@olleh",
"access": [
"send"
],
"sendAs": [
"moc.elpmaxe@olleh"
],
"sending": "ready"
}
],
"domains": [],
"campaigns": null
}
]
}
keys.revoke
Revoke an app key. Its server can’t send with it any more.
POST/v1/keys.revoke
Parameters
The app’s id, from
keys list.
Returns
data is an object with:
True when the app was there to disconnect.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.keys.revoke({
id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.keys.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.KeysRevokeParams{
ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
}
answer, err := client.Keys.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.keys.revoke(
id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->keys->revoke([
'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.KeysRevokeParams;
import app.mailset.model.KeysRevokeResult;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = KeysRevokeParams.builder()
.id("d_4b8e2a6c9f1d3057b3e8a2c6")
.build();
KeysRevokeResult answer = mailset.keys().revoke(params);
System.out.println(answer);
use mailset::types::KeysRevokeParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.keys()
.revoke(KeysRevokeParams {
id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/keys.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 keys revoke d_4b8e2a6c9f1d3057b3e8a2c6
{
"ok": true,
"data": {
"revoked": true
}
}
keys.renew
Keep an app key working for 90 more days, with the same key.
POST/v1/keys.renew
Parameters
The app’s id, from
keys list.
Beside input
An approval’s id, once someone approved it with their passkey. Without one, the answer is
step_up_requiredand names what to approve.
Returns
data is an object with:
When its key stops working now, in ms since the epoch.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.keys.renew({
id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.keys.renew(
{"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.KeysRenewParams{
ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
}
answer, err := client.Keys.Renew(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.keys.renew(
id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->keys->renew([
'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.KeysRenewParams;
import app.mailset.model.KeysRenewResult;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = KeysRenewParams.builder()
.id("d_4b8e2a6c9f1d3057b3e8a2c6")
.build();
KeysRenewResult answer = mailset.keys().renew(params);
System.out.println(answer);
use mailset::types::KeysRenewParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.keys()
.renew(KeysRenewParams {
id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/keys.renew \
-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 keys renew d_4b8e2a6c9f1d3057b3e8a2c6
{
"ok": true,
"data": {
"expiresAt": 1796048940000
}
}
keys.resume
Let an app key its brake paused send again, once you know why it was.
POST/v1/keys.resume
Parameters
The app’s id, from
keys list.
Beside input
An approval’s id, once someone approved it with their passkey. Without one, the answer is
step_up_requiredand names what to approve.
Returns
data is an object with:
True when it was paused and may send again.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.keys.resume({
id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.keys.resume(
{"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.KeysResumeParams{
ID: "d_4b8e2a6c9f1d3057b3e8a2c6",
}
answer, err := client.Keys.Resume(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.keys.resume(
id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->keys->resume([
'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.KeysResumeParams;
import app.mailset.model.KeysResumeResult;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = KeysResumeParams.builder()
.id("d_4b8e2a6c9f1d3057b3e8a2c6")
.build();
KeysResumeResult answer = mailset.keys().resume(params);
System.out.println(answer);
use mailset::types::KeysResumeParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.keys()
.resume(KeysResumeParams {
id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/keys.resume \
-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 keys resume d_4b8e2a6c9f1d3057b3e8a2c6
{
"ok": true,
"data": {
"resumed": true
}
}
keys.update
Change the From addresses a domain key sends as.
POST/v1/keys.update
Parameters
The key’s id, from
keys list.The From addresses it may send as from now on, all on its domain. 1 to 25.
1 to 25 items.
Any address on its domain instead: only for a domain where nobody has a mailbox.
Beside input
An approval’s id, once someone approved it with their passkey. Without one, the answer is
step_up_requiredand names what to approve.
Returns
data is the Key status object.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.keys.update({
from: [
"moc.elpmaxe@stpiecer",
"moc.elpmaxe@ylperon",
],
id: "d_4b8e2a6c9f1d3057b3e8a2c6",
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.keys.update(
{
"from": [
"moc.elpmaxe@stpiecer",
"moc.elpmaxe@ylperon",
],
"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.KeysUpdateParams{
require 'mailset'
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new
answer = mailset.keys.update(
from: ['moc.elpmaxe@stpiecer', 'moc.elpmaxe@ylperon'],
id: 'd_4b8e2a6c9f1d3057b3e8a2c6'
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->keys->update([
'from' => [
'moc.elpmaxe@stpiecer',
'moc.elpmaxe@ylperon',
],
'id' => 'd_4b8e2a6c9f1d3057b3e8a2c6',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.KeyStatus;
import app.mailset.model.KeysUpdateParams;
import java.util.List;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = KeysUpdateParams.builder()
.from(List.of(
"moc.elpmaxe@stpiecer",
"moc.elpmaxe@ylperon"))
.id("d_4b8e2a6c9f1d3057b3e8a2c6")
.build();
KeyStatus answer = mailset.keys().update(params);
System.out.println(answer);
use mailset::types::KeysUpdateParams;
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.keys()
.update(KeysUpdateParams {
id: "d_4b8e2a6c9f1d3057b3e8a2c6".into(),
from: Some(vec![
"moc.elpmaxe@stpiecer".into(),
"moc.elpmaxe@ylperon".into(),
]),
..Default::default()
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/keys.update \
-H "Authorization: Bearer $TOKEN" \
-H "ms-time: $MS_TIME" \
-H "ms-proof: $MS_PROOF" \
-H "Content-Type: application/json" \
-d '{"input":{"from":["moc.elpmaxe@stpiecer","moc.elpmaxe@ylperon"],"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 keys update d_4b8e2a6c9f1d3057b3e8a2c6 --from moc.elpmaxe@stpiecer --from moc.elpmaxe@ylperon
{
"ok": true,
"data": {
"id": "grant_3f9a1c0e7b2d",
"name": "Acme API",
"createdAt": 1793456940000,
"lastSeenAt": 1796048940000,
"expiresAt": 1803824940000,
"paused": null,
"mailboxes": [
{
"address": "moc.elpmaxe@olleh",
"access": [
"send"
],
"sendAs": [
"moc.elpmaxe@olleh"
],
"sending": "ready"
}
],
"domains": [],
"campaigns": null
}
}