MailerSend
Account

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/users

Request parameters

Query parameterTypeRequiredLimitationsDetails
limitintnoMin: 10, Max: 100Default: 25
pageintnoMin: 1
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->user->getAll();

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .page(1)
          .limit(25)
          .build_users_list())

response = ms.users.list_users(request)

More examples

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)
	}
}

More examples

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();
    }
}

More examples

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 Entity

See - 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 parameterTypeRequiredLimitationsDetails
user_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->user->find('userId');

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .user_id("user-id")
          .build_user_get())

response = ms.users.get_user(request)

More examples

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)
	}
}

More examples

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();
    }
}

More examples

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 Found

Invite 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/users

Request Parameters

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
emailstringyesMax 320 characters, unique
rolestringyesMust be the name of a role, case-sensitiveView roles
permissionsstring[]yes*Must be list of permission names*Only required if role is a Custom User. Ignored for other roles. View permissions
templatesstring[]noMust be list of template IDsRequires read-own-templates in permissions. Ignored unless role is a Custom User.
domainsstring[]noMust be list of domain IDs
requires_periodic_password_changebooleanno
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)
);

More examples

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));

More examples

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)

More examples

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)
	}
}

More examples

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();
    }
}

More examples

Responses

Response KeyTypeDetails
idstringID of the invite.
emailstringEmail address the invite was sent to.
data.domainsstring[]IDs of the domains the user gets access to.
data.templatesstring[]IDs of the templates the user gets access to.
permissionsstring[]Permissions the user gets.
rolestringRole the user gets.
requires_periodic_password_changebooleanWhether the user has to change their password periodically.
created_atdatetime
updated_atdatetime

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 Entity

See - 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 parameterTypeRequiredLimitationsDetails
user_idstringyes

JSON parameters are provided in dot notation

JSON ParameterTypeRequiredLimitationsDetails
rolestringyesMust be the name of a role, case-sensitiveView roles
permissionsstring[]yes*Must be list of permission names*Only required if role is a Custom User. Ignored for other roles. View permissions
templatesstring[]noMust be list of template IDsRequires read-own-templates in permissions. Reset unless role is a Custom User.
domainsstring[]noMust be list of domain IDs
requires_periodic_password_changebooleanno
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)
);

More examples

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));

More examples

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)

More examples

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)
	}
}

More examples

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();
    }
}

More examples

Responses

Response KeyTypeDetails
idstringID of the user.
avatarstring|nullURL of the user's avatar.
emailstring
namestring
last_namestring
2fabooleanWhether two-factor authentication is on.
rolestring
permissionsstring[]
domainsobject[]Domains the user has access to.
templatesobject[]Templates the user has access to.
created_atdatetime
updated_atdatetime

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 Entity

See - 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 parameterTypeRequiredLimitationsDetails
user_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->user->delete('userId');

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .user_id("user-id")
          .build_user_delete())

response = ms.users.delete_user(request)

More examples

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)
	}
}

More examples

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();
    }
}

More examples

Responses

Valid

Response Code: 204 No Content

Error

Response Code: 404 Not Found

Get a list of invites

Retrieve information about account invited users with this GET request:

GET https://api.mailersend.com/v1/invites

Request parameters

Query parameterTypeRequiredLimitationsDetails
limitintnoMin: 10, Max: 100Default: 25
pageintnoMin: 1
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->invite->getAll();

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .page(1)
          .limit(25)
          .build_invites_list())

response = ms.users.list_invites(request)

More examples

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();
    }
}

More examples

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 Entity

See - 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 parameterTypeRequiredLimitationsDetails
invite_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->invite->find('inviteId');

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .invite_id("invite-id")
          .build_invite_get())

response = ms.users.get_invite(request)

More examples

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();
    }
}

More examples

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}/resend

Request parameters

URL parameterTypeRequiredLimitationsDetails
invite_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->invite->resend('inviteId');

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .invite_id("invite-id")
          .build_invite_resend())

response = ms.users.resend_invite(request)

More examples

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();
    }
}

More examples

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 Found

Cancel 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 parameterTypeRequiredLimitationsDetails
invite_idstringyes
use MailerSend\MailerSend;

$mailersend = new MailerSend(['api_key' => 'key']);

$mailersend->invite->cancel('inviteId');

More examples

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));

More examples

from mailersend import MailerSendClient, UsersBuilder

ms = MailerSendClient()

request = (UsersBuilder()
          .invite_id("invite-id")
          .build_invite_cancel())

response = ms.users.cancel_invite(request)

More examples

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();
    }
}

More examples

Responses

Valid

Response Code: 204 OK

Error

Response Code: 404 Not Found

Roles

NameDescription
AdminAdministrator has full access and can perform all actions in the account.
ManagerManagers have full access, but can not access API or access billing.
DesignerDesigners can only view and create templates.
AccountantCan only manage payments and access invoices.
Custom UserSelect the sections of your account that the user should have access to.

Permissions

NameDescriptionGroup
read-all-templatesView all templatesTemplates
read-own-templatesView specific templatesTemplates
manage-templateManage templatesTemplates
read-filemanagerView the file managerTemplates
manage-domainManage domainDomains
manage-inboundManage inbound routesDomains
manage-webhookManage webhooksDomains
control-sendingsControl sendingsDomains
control-tracking-optionsControl tracking optionDomains
access-smtp-credentialsAccess SMTP credentialsDomains
view-smtp-usersView SMTP usersDomains
manage-smtp-usersManage SMTP usersDomains
read-recipientView recipientsRecipient
read-activityView email activityActivity
read-emailView email contentActivity
read-analyticsView email analyticsAnalytics
read-sender-identitiesView sender identitiesSender identities
manage-sender-identitiesManage sender identitiesSender identities
read-email-verificationView email verifications listsEmail verification
manage-email-verificationManage email verification listsEmail verification
manage-smsManage numbersSMS
read-smsView SMS activitySMS
manage-verified-recipientsManage verified recipientsSMS
view-sms-webhooksView number webhooksSMS
manage-sms-webhooksManage number webhooksSMS
view-sms-inboundView number inbound routesSMS
manage-sms-inboundManage number inbound routesSMS
view-whatsappView WhatsAppWhatsApp
manage-whatsappManage WhatsAppWhatsApp
read-dmarc-monitoringView DMARC monitoring listsMonitoring
manage-dmarc-monitoringManage DMARC monitoring listsMonitoring
read-blocklist-monitoringView blocklist monitoringMonitoring
manage-blocklist-monitoringManage blocklist monitoringMonitoring
read-billingView plan and billing informationPlan and Billing
update-planManage plansPlan and Billing
read-invoiceView invoicesPlan and Billing
manage-accountEdit account settingsAccount settings
manage-api-tokenManage API tokensAccount settings
read-suppressionsView suppressions listsAccount settings
manage-suppressionsManage suppressionsAccount settings
read-ip-addressesView IP allowlistAccount settings
manage-ip-addressesManage IP allowlistAccount settings
read-error-logView error logAccount settings

On this page