Users
Easily manage users with MailerSend's API. Invite, update, delete and retrieve a list of users in your account.
Get a list of account users
Retrieve information about account users with this GET request:
GET https://api.mailersend.com/v1/usersRequest parameters
| Query parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
limit | int | no | Min: 10, Max: 100 | Default: 25 |
page | int | no | Min: 1 |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->user->getAll();import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.list()
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.page(1)
.limit(25)
.build_users_list())
response = ms.users.list_users(request)package main
import (
"context"
"log"
"time"
"github.com/mailersend/mailersend-go"
)
var APIKey = "Api Key Here"
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(APIKey)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
options := &mailersend.ListUserOptions{
Page: 1,
Limit: 25,
}
_, _, err := ms.User.List(ctx, options)
if err != nil {
log.Fatal(err)
}
}import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
import com.mailersend.sdk.users.User;
import com.mailersend.sdk.users.UsersList;
public void getUsers() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
UsersList response = ms.users()
.page(1)
.limit(25)
.getUsers();
for (User user : response.users) {
System.out.println(user.id);
System.out.println(user.name);
System.out.println(user.email);
System.out.println(user.role);
}
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": [
{
"id": "83gwk2j7zqz1nxyd",
"avatar": null,
"email": "user@example.com",
"last_name": "User",
"name": "User",
"2fa": false,
"created_at": "2024-01-18T06:59:00.000000Z",
"updated_at": "2024-01-18T07:01:26.000000Z",
"role": "Custom User",
"permissions": ["read-suppressions", "read-invoice", "read-own-templates"],
"domains": [
{
"id": "0z76k5jg0o3yeg2d",
"name": "example-domain.com",
"created_at": "2024-02-20T08:13:17.000000Z",
"updated_at": "2024-02-20T08:13:22.000000Z"
},
{
"id": "9dnxr7qvdqg6pm0e",
"name": "another-domain.com",
"created_at": "2024-02-20T08:47:06.000000Z",
"updated_at": "2024-02-20T08:47:11.000000Z"
}
],
"templates": [
{
"id": "n3k6d1jreo50x4ve",
"name": "Template",
"description": null,
"type": "gh",
"created_at": "2024-02-23T15:40:51.000000Z"
}
]
}
],
"links": {
"first": "https://api.mailersend.com/v1/users?page=1",
"last": "https://api.mailersend.com/v1/users?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "https://api.mailersend.com/v1/users?page=1",
"label": "1",
"page": 1,
"active": true
},
{
"url": null,
"label": "Next »",
"page": null,
"active": false
}
],
"path": "https://api.mailersend.com/v1/users",
"per_page": 25,
"to": 1,
"total": 1
}
}Error
Response Code: 422 Unprocessable EntitySee - Validation errors
Get a single account user
If you want to retrieve a single account user, use this GET request:
GET https://api.mailersend.com/v1/users/{user_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
user_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->user->find('userId');import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.single("user-id")
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.user_id("user-id")
.build_user_get())
response = ms.users.get_user(request)package main
import (
"context"
"log"
"time"
"github.com/mailersend/mailersend-go"
)
var APIKey = "Api Key Here"
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(APIKey)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
userID := "user-id"
_, _, err := ms.User.Get(ctx, userID)
if err != nil {
log.Fatal(err)
}
}import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.users.User;
import com.mailersend.sdk.exceptions.MailerSendException;
public void GetUser() {
MailerSend ms = new MailerSend();
ms.setToken("api token");
try {
User user = ms.users().getUser("user-id");
System.out.println(user.id);
System.out.println(user.email);
System.out.println(user.name);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": {
"id": "83gwk2j7zqz1nxyd",
"avatar": null,
"email": "user@example.com",
"last_name": "User",
"name": "User",
"2fa": false,
"created_at": "2024-01-18T06:59:00.000000Z",
"updated_at": "2024-01-18T07:01:26.000000Z",
"role": "Custom User",
"permissions": ["read-suppressions", "read-invoice", "read-own-templates"],
"domains": [
{
"id": "0z76k5jg0o3yeg2d",
"name": "example-domain.com",
"created_at": "2024-02-20T08:13:17.000000Z",
"updated_at": "2024-02-20T08:13:22.000000Z"
},
{
"id": "9dnxr7qvdqg6pm0e",
"name": "another-domain.com",
"created_at": "2024-02-20T08:47:06.000000Z",
"updated_at": "2024-02-20T08:47:11.000000Z"
}
],
"templates": [
{
"id": "n3k6d1jreo50x4ve",
"name": "Template",
"description": null,
"type": "gh",
"created_at": "2024-02-23T15:40:51.000000Z"
}
]
}
}Error
Response Code: 404 Not FoundInvite a user to account
If you want to add a new user to your account, use this POST request:
POST https://api.mailersend.com/v1/usersRequest Parameters
JSON parameters are provided in dot notation
| JSON Parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
email | string | yes | Max 320 characters, unique | |
role | string | yes | Must be the name of a role, case-sensitive | View roles |
permissions | string[] | yes* | Must be list of permission names | *Only required if role is a Custom User. Ignored for other roles. View permissions |
templates | string[] | no | Must be list of template IDs | Requires read-own-templates in permissions. Ignored unless role is a Custom User. |
domains | string[] | no | Must be list of domain IDs | |
requires_periodic_password_change | boolean | no |
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\UserParams;
use MailerSend\Common\Roles;
use MailerSend\Common\Permissions;
$mailersend = new MailerSend(['api_key' => 'key']);
// Basic invite with admin role
$mailersend->user->create(
(new UserParams('newuser@example.com', Roles::ADMIN))
);
// Custom invite with specific permissions and access
$mailersend->user->create(
(new UserParams('designer@example.com', Roles::CUSTOM_USER))
->setDomains(['domain-id'])
->setTemplates(['template-id'])
->setPermissions([Permissions::READ_OWN_TEMPLATES])
->setRequiresPeriodicPasswordChange(true)
);import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
// Basic invite with admin role
mailerSend.user.create({
email: "newuser@example.com",
role: "Admin",
})
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));
// Custom invite with specific permissions
mailerSend.user.create({
email: "designer@example.com",
role: "Custom User",
permissions: ["read-own-templates", "manage-template"],
templates: ["template-id"],
domains: ["domain-id"],
requires_periodic_password_change: true,
})
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
# Basic invite with admin role
request = (UsersBuilder()
.email("newuser@example.com")
.admin_role()
.build_user_invite())
response = ms.users.invite_user(request)
# Custom invite with specific permissions and access
request = (UsersBuilder()
.email("designer@example.com")
.custom_user_role()
.add_permission("read-own-templates")
.add_permission("manage-template")
.add_template("template-id")
.add_domain("domain-id")
.requires_periodic_password_change(True)
.build_user_invite())
response = ms.users.invite_user(request)package main
import (
"context"
"log"
"time"
"github.com/mailersend/mailersend-go"
)
var APIKey = "Api Key Here"
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(APIKey)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
options := &mailersend.InviteUserOptions{
Email: "newuser@example.com",
Role: "Admin",
}
_, _, err := ms.User.Invite(ctx, options)
if err != nil {
log.Fatal(err)
}
}import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
import com.mailersend.sdk.users.Invite;
public void inviteUser() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
// Basic invite with admin role
Invite invite = ms.users().builder()
.email("newuser@example.com")
.role("Admin")
.inviteUser();
System.out.println(invite.id);
// Custom invite with specific permissions
Invite customInvite = ms.users().builder()
.email("designer@example.com")
.role("Custom User")
.addPermission("read-own-templates")
.addPermission("manage-template")
.addTemplate("template-id")
.addDomain("domain-id")
.requiresPeriodicPasswordChange(true)
.inviteUser();
System.out.println(customInvite.id);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
| Response Key | Type | Details |
|---|---|---|
id | string | ID of the invite. |
email | string | Email address the invite was sent to. |
data.domains | string[] | IDs of the domains the user gets access to. |
data.templates | string[] | IDs of the templates the user gets access to. |
permissions | string[] | Permissions the user gets. |
role | string | Role the user gets. |
requires_periodic_password_change | boolean | Whether the user has to change their password periodically. |
created_at | datetime | |
updated_at | datetime |
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"id": "n3k6d1jrveq50x4v",
"email": "user@example.com",
"data": {
"domains": [],
"templates": []
},
"permissions": ["manage-api-token", "read-filemanager"],
"role": "Custom User",
"requires_periodic_password_change": false,
"created_at": "2024-01-24T06:40:19.000000Z",
"updated_at": "2024-01-24T06:40:19.000000Z"
}Invalid
Response Code: 422 Unprocessable EntitySee - Validation errors
Users limit error
Response Code: 403 Forbidden
Response Headers:
content-type: application/json{
"message": "You've reached the maximum users limit. Upgrade to add more users."
}Update account user
If you want to update the information of an existing account user, use this PUT request:
PUT https://api.mailersend.com/v1/users/{user_id}Request Parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
user_id | string | yes |
JSON parameters are provided in dot notation
| JSON Parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
role | string | yes | Must be the name of a role, case-sensitive | View roles |
permissions | string[] | yes* | Must be list of permission names | *Only required if role is a Custom User. Ignored for other roles. View permissions |
templates | string[] | no | Must be list of template IDs | Requires read-own-templates in permissions. Reset unless role is a Custom User. |
domains | string[] | no | Must be list of domain IDs | |
requires_periodic_password_change | boolean | no |
use MailerSend\MailerSend;
use MailerSend\Helpers\Builder\UserParams;
use MailerSend\Common\Roles;
use MailerSend\Common\Permissions;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->user->update(
'userId',
(new UserParams())
->setRole(Roles::CUSTOM_USER)
->setDomains(['domain-id'])
->setPermissions([Permissions::READ_OWN_TEMPLATES])
->setRequiresPeriodicPasswordChange(true)
);import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.update("user-id", {
role: "Manager",
permissions: ["read-analytics", "read-activity"],
domains: ["domain-id"],
})
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.user_id("user-id")
.manager_role()
.add_permission("read-analytics")
.add_permission("read-activity")
.add_domain("domain-id")
.build_user_update())
response = ms.users.update_user(request)package main
import (
"context"
"log"
"time"
"github.com/mailersend/mailersend-go"
)
var APIKey = "Api Key Here"
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(APIKey)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
userID := "user-id"
options := &mailersend.UpdateUserOptions{
Role: "Manager",
}
_, _, err := ms.User.Update(ctx, userID, options)
if err != nil {
log.Fatal(err)
}
}import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.users.User;
import com.mailersend.sdk.exceptions.MailerSendException;
public void UpdateUser() {
MailerSend ms = new MailerSend();
ms.setToken("api token");
try {
User user = ms.users().builder()
.role("Manager")
.addPermission("read-analytics")
.addPermission("read-activity")
.addDomain("domain-id")
.updateUser("user-id");
System.out.println(user.id);
System.out.println(user.email);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
| Response Key | Type | Details |
|---|---|---|
id | string | ID of the user. |
avatar | string|null | URL of the user's avatar. |
email | string | |
name | string | |
last_name | string | |
2fa | boolean | Whether two-factor authentication is on. |
role | string | |
permissions | string[] | |
domains | object[] | Domains the user has access to. |
templates | object[] | Templates the user has access to. |
created_at | datetime | |
updated_at | datetime |
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"id": "4k386zo42j07xv52",
"avatar": null,
"email": "user@example.com",
"last_name": "User",
"name": "User",
"2fa": false,
"created_at": "2024-01-22T09:35:04.000000Z",
"updated_at": "2024-01-22T23:40:44.000000Z",
"role": "Manager",
"permissions": [],
"domains": [
{
"id": "0z76k5jg0o3yeg2d",
"name": "example-domain.com",
"created_at": "2024-02-20T08:13:17.000000Z",
"updated_at": "2024-02-20T08:13:22.000000Z"
},
{
"id": "9dnxr7qvdqg6pm0e",
"name": "another-domain.com",
"created_at": "2024-02-20T08:47:06.000000Z",
"updated_at": "2024-02-20T08:47:11.000000Z"
}
],
"templates": [
{
"id": "n3k6d1jreo50x4ve",
"name": "Template",
"description": null,
"type": "gh",
"created_at": "2024-02-23T15:40:51.000000Z"
}
]
}Invalid
Response Code: 422 Unprocessable EntitySee - Validation errors
Users limit error
Response Code: 403 Forbidden
Response Headers:
content-type: application/json{
"message": "You've reached the maximum users limit. Upgrade to add more users."
}Delete a user from account
If you want to delete a user from account, use this DELETE request:
DELETE https://api.mailersend.com/v1/users/{user_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
user_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->user->delete('userId');import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.delete("user-id")
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.user_id("user-id")
.build_user_delete())
response = ms.users.delete_user(request)package main
import (
"context"
"log"
"time"
"github.com/mailersend/mailersend-go"
)
var APIKey = "Api Key Here"
func main() {
// Create an instance of the mailersend client
ms := mailersend.NewMailersend(APIKey)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
userID := "user-id"
_, err := ms.User.Delete(ctx, userID)
if err != nil {
log.Fatal(err)
}
}import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
public void DeleteUser() {
MailerSend ms = new MailerSend();
ms.setToken("api token");
try {
ms.users().deleteUser("user-id");
System.out.println("User deleted successfully");
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 204 No ContentError
Response Code: 404 Not FoundGet a list of invites
Retrieve information about account invited users with this GET request:
GET https://api.mailersend.com/v1/invitesRequest parameters
| Query parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
limit | int | no | Min: 10, Max: 100 | Default: 25 |
page | int | no | Min: 1 |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->invite->getAll();import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.listInvites({ page: 1, limit: 25 })
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.page(1)
.limit(25)
.build_invites_list())
response = ms.users.list_invites(request)import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
import com.mailersend.sdk.users.Invite;
import com.mailersend.sdk.users.InvitesList;
public void getInvites() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
InvitesList response = ms.users()
.page(1)
.limit(25)
.getInvites();
for (Invite invite : response.invites) {
System.out.println(invite.id);
System.out.println(invite.email);
System.out.println(invite.role);
}
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"data": [
{
"id": "dle1krod2jvn8gwm",
"email": "user@example.com",
"data": {
"domains": ["n3k6d1jrveq50x4v"],
"templates": ["0z76k5jg0o3yeg2d"]
},
"role": "Custom User",
"permissions": ["read-own-templates"],
"requires_periodic_password_change": true,
"created_at": "2024-04-25T17:09:23.000000Z",
"updated_at": "2024-04-25T17:09:23.000000Z"
}
],
"links": {
"first": "https://api.mailersend.com/v1/invites?page=1",
"last": "https://api.mailersend.com/v1/invites?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"page": null,
"active": false
},
{
"url": "https://api.mailersend.com/v1/invites?page=1",
"label": "1",
"page": 1,
"active": true
},
{
"url": null,
"label": "Next »",
"page": null,
"active": false
}
],
"path": "https://api.mailersend.com/v1/invites",
"per_page": 25,
"to": 1,
"total": 1
}
}Error
Response Code: 422 Unprocessable EntitySee - Validation errors
Get a single invite
If you want to retrieve a single invite, use this GET request:
GET https://api.mailersend.com/v1/invites/{invite_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
invite_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->invite->find('inviteId');import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.singleInvite("invite-id")
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.invite_id("invite-id")
.build_invite_get())
response = ms.users.get_invite(request)import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
import com.mailersend.sdk.users.Invite;
public void getInvite() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
Invite invite = ms.users().getInvite("invite-id");
System.out.println(invite.id);
System.out.println(invite.email);
System.out.println(invite.role);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"id": "dle1krod2jvn8gwm",
"email": "test7@user.com",
"data": {
"domains": ["n3k6d1jrveq50x4v"],
"templates": ["0z76k5jg0o3yeg2d"]
},
"role": "Custom User",
"permissions": ["read-own-templates"],
"requires_periodic_password_change": true,
"created_at": "2024-04-25T17:09:23.000000Z",
"updated_at": "2024-04-25T17:09:23.000000Z"
}Resend an invite
If you want to resend a user invite, use this POST request:
POST https://api.mailersend.com/v1/invites/{invite_id}/resendRequest parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
invite_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->invite->resend('inviteId');import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.resendInvite("invite-id")
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.invite_id("invite-id")
.build_invite_resend())
response = ms.users.resend_invite(request)import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
import com.mailersend.sdk.users.Invite;
public void resendInvite() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
Invite invite = ms.users().resendInvite("invite-id");
System.out.println(invite.id);
System.out.println(invite.email);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 200 OK
Response Headers:
content-type: application/json{
"id": "dle1krod2jvn8gwm",
"email": "test7@user.com",
"data": {
"domains": ["n3k6d1jrveq50x4v"],
"templates": ["0z76k5jg0o3yeg2d"]
},
"role": "Custom User",
"permissions": ["read-own-templates"],
"requires_periodic_password_change": true,
"created_at": "2024-04-25T17:09:23.000000Z",
"updated_at": "2024-04-25T17:09:23.000000Z"
}Error
Response Code: 404 Not FoundCancel an invite
If you want to cancel a user invite from account, use this DELETE request:
DELETE https://api.mailersend.com/v1/invites/{invite_id}Request parameters
| URL parameter | Type | Required | Limitations | Details |
|---|---|---|---|---|
invite_id | string | yes |
use MailerSend\MailerSend;
$mailersend = new MailerSend(['api_key' => 'key']);
$mailersend->invite->cancel('inviteId');import 'dotenv/config';
import { MailerSend } from "mailersend";
const mailerSend = new MailerSend({
apiKey: process.env.API_KEY,
});
mailerSend.user.deleteInvite("invite-id")
.then((response) => console.log(response.body))
.catch((error) => console.log(error.body));from mailersend import MailerSendClient, UsersBuilder
ms = MailerSendClient()
request = (UsersBuilder()
.invite_id("invite-id")
.build_invite_cancel())
response = ms.users.cancel_invite(request)import com.mailersend.sdk.MailerSend;
import com.mailersend.sdk.exceptions.MailerSendException;
public void deleteInvite() {
MailerSend ms = new MailerSend();
ms.setToken("Your API token");
try {
boolean deleted = ms.users().deleteInvite("invite-id");
System.out.println("Invite deleted: " + deleted);
} catch (MailerSendException e) {
e.printStackTrace();
}
}Responses
Valid
Response Code: 204 OKError
Response Code: 404 Not FoundRoles
| Name | Description |
|---|---|
| Admin | Administrator has full access and can perform all actions in the account. |
| Manager | Managers have full access, but can not access API or access billing. |
| Designer | Designers can only view and create templates. |
| Accountant | Can only manage payments and access invoices. |
| Custom User | Select the sections of your account that the user should have access to. |
Permissions
| Name | Description | Group |
|---|---|---|
| read-all-templates | View all templates | Templates |
| read-own-templates | View specific templates | Templates |
| manage-template | Manage templates | Templates |
| read-filemanager | View the file manager | Templates |
| manage-domain | Manage domain | Domains |
| manage-inbound | Manage inbound routes | Domains |
| manage-webhook | Manage webhooks | Domains |
| control-sendings | Control sendings | Domains |
| control-tracking-options | Control tracking option | Domains |
| access-smtp-credentials | Access SMTP credentials | Domains |
| view-smtp-users | View SMTP users | Domains |
| manage-smtp-users | Manage SMTP users | Domains |
| read-recipient | View recipients | Recipient |
| read-activity | View email activity | Activity |
| read-email | View email content | Activity |
| read-analytics | View email analytics | Analytics |
| read-sender-identities | View sender identities | Sender identities |
| manage-sender-identities | Manage sender identities | Sender identities |
| read-email-verification | View email verifications lists | Email verification |
| manage-email-verification | Manage email verification lists | Email verification |
| manage-sms | Manage numbers | SMS |
| read-sms | View SMS activity | SMS |
| manage-verified-recipients | Manage verified recipients | SMS |
| view-sms-webhooks | View number webhooks | SMS |
| manage-sms-webhooks | Manage number webhooks | SMS |
| view-sms-inbound | View number inbound routes | SMS |
| manage-sms-inbound | Manage number inbound routes | SMS |
| view-whatsapp | View WhatsApp | |
| manage-whatsapp | Manage WhatsApp | |
| read-dmarc-monitoring | View DMARC monitoring lists | Monitoring |
| manage-dmarc-monitoring | Manage DMARC monitoring lists | Monitoring |
| read-blocklist-monitoring | View blocklist monitoring | Monitoring |
| manage-blocklist-monitoring | Manage blocklist monitoring | Monitoring |
| read-billing | View plan and billing information | Plan and Billing |
| update-plan | Manage plans | Plan and Billing |
| read-invoice | View invoices | Plan and Billing |
| manage-account | Edit account settings | Account settings |
| manage-api-token | Manage API tokens | Account settings |
| read-suppressions | View suppressions lists | Account settings |
| manage-suppressions | Manage suppressions | Account settings |
| read-ip-addresses | View IP allowlist | Account settings |
| manage-ip-addresses | Manage IP allowlist | Account settings |
| read-error-log | View error log | Account settings |