Policies
The org’s rules on forwarding and sessions.
An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.
On this page
policies.get
Show the org’s policies.
POST/v1/policies.get
Parameters
It takes no input: send an empty object.
Beside input
The org this is about. Needed when the caller is in more than one.
Returns
data is an object with:
Forwarding rules: allowed with a
passkeycheck, ornever.One of
passkeyneverDefault
passkey.How long a new sign-in lasts, in days: 30, 7 or 0.5 (12 hours).
Default
30.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.policies.get();
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.policies.get()
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.Policies.Get(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Println(answer)
}
require 'mailset'
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new
answer = mailset.policies.get
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->policies->get();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Policies;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
Policies answer = mailset.policies().get();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset.policies().get().await?;
println!("{answer:?}");
curl https://mailset.app/v1/policies.get \
-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 shows how.
mailset policies get
{
"ok": true,
"data": {
"forwarding": "passkey",
"sharedAi": true,
"sessionDays": 30
}
}
policies.set
Change the org’s policies.
POST/v1/policies.set
Parameters
Forwarding rules: allowed with a
passkeycheck, ornever.One of
passkeyneverHow long a new sign-in lasts, in days: 30, 7 or 0.5 (12 hours).
Beside input
The org this is about. Needed when the caller is in more than one.
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:
Forwarding rules: allowed with a
passkeycheck, ornever.One of
passkeyneverDefault
passkey.How long a new sign-in lasts, in days: 30, 7 or 0.5 (12 hours).
Default
30.
import { Mailset } from 'mailset';
// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();
const answer = await mailset.policies.set({
forwarding: "never",
sessionDays: 7,
});
console.log(answer);
from mailset import Mailset
# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()
answer = mailset.policies.set(
{"forwarding": "never", "session_days": 7}
)
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.PoliciesSetParams{
Forwarding: mailset.SettingsForwardingNever,
SessionDays: mailset.Int(7),
}
answer, err := client.Policies.Set(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.policies.set(
forwarding: 'never',
session_days: 7
)
p answer
<?php
require 'vendor/autoload.php';
// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();
$answer = $mailset->policies->set([
'forwarding' => 'never',
'sessionDays' => 7,
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.Policies;
import app.mailset.model.PoliciesSetParams;
import app.mailset.model.SettingsForwarding;
// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();
var params = PoliciesSetParams.builder()
.forwarding(SettingsForwarding.NEVER)
.sessionDays(7L)
.build();
Policies answer = mailset.policies().set(params);
System.out.println(answer);
use mailset::types::{
PoliciesSetParams, SettingsForwarding,
};
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;
let answer = mailset
.policies()
.set(PoliciesSetParams {
forwarding: Some(SettingsForwarding::Never),
session_days: Some(7),
..Default::default()
})
.await?;
println!("{answer:?}");
curl https://mailset.app/v1/policies.set \
-H "Authorization: Bearer $TOKEN" \
-H "ms-time: $MS_TIME" \
-H "ms-proof: $MS_PROOF" \
-H "Content-Type: application/json" \
-d '{"input":{"forwarding":"never","sessionDays":7},"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 shows how.
mailset policies set --forwarding never --session-days 7
{
"ok": true,
"data": {
"forwarding": "passkey",
"sharedAi": true,
"sessionDays": 30
}
}