--- displayed_sidebar: jsClientSidebar slug: /references/js-client/AdminInvitesResource --- import ParameterTypes from "@site/src/components/ParameterTypes" # AdminInvitesResource This class is used to send requests to [Admin Invite API Routes](https://docs.medusajs.com/api/admin#invites). All its method are available in the JS Client under the `medusa.admin.invites` property. All methods in this class require [user authentication](AdminAuthResource.mdx#createsession). An admin can invite new users to manage their team. This would allow new users to authenticate as admins and perform admin functionalities. Related Guide: [How to manage invites](https://docs.medusajs.com/modules/users/admin/manage-invites). ## Methods ### accept Accept an Invite. This will also delete the invite and create a new user that can log in and perform admin functionalities. The user will have the email associated with the invite, and the password provided in the `payload` parameter. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites .accept({ token, user: { first_name: "Brigitte", last_name: "Collier", password: "supersecret", }, }) .then(() => { // successful }) .catch(() => { // an error occurred }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns ___ ### create Create an invite. This will generate a token associated with the invite and trigger an `invite.created` event. If you have a Notification Provider installed that handles this event, a notification should be sent to the email associated with the invite to allow them to accept the invite. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites .create({ user: "user@example.com", role: "admin", }) .then(() => { // successful }) .catch(() => { // an error occurred }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns ___ ### delete Delete an invite. Only invites that weren't accepted can be deleted. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.delete(inviteId).then(({ id, object, deleted }) => { console.log(id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns ___ ### list Retrieve a list of invites. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites.list().then(({ invites }) => { console.log(invites.length) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "role", "type": "[UserRoles](../internal/enums/internal.internal.UserRoles.mdx)", "description": "The user's role. These roles don't change the privileges of the user.", "optional": false, "defaultValue": "member", "expandable": false, "children": [] }, { "name": "token", "type": "`string`", "description": "The token used to accept the invite.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "user_email", "type": "`string`", "description": "The email of the user being invited.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ ### resend Resend an invite. This renews the expiry date by seven days and generates a new token for the invite. It also triggers the `invite.created` event, so if you have a Notification Provider installed that handles this event, a notification should be sent to the email associated with the invite to allow them to accept the invite. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged in or use api token medusa.admin.invites .resend(inviteId) .then(() => { // successful }) .catch(() => { // an error occurred }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns