invite - JS SDK Admin Reference
This documentation provides a reference to the sdk.admin.invite
set of methods used to send requests to Medusa's Admin API routes.
accept#
This method accepts an invite. It requires sending a previous request to the Auth.register.
This method sends a request to the [Accept Invite] (https://docs.medusajs.com/api/admin#invites_postinvitesaccept) API route.
Example#
1await sdk.auth.register("user", "emailpass", {2 email: "user@gmail.com",3 password: "supersecret"4})5 6// all subsequent requests will use the token in the header7const { user } = await sdk.admin.invite.accept(8 {9 email: "user@gmail.com",10 first_name: "John",11 last_name: "Smith",12 invite_token: "12345..."13 },14)
Parameters#
input
AdminAcceptInvite & objectThe details of the user to create.
input
AdminAcceptInvite & objectConfigure the fields to retrieve in the user.
Headers to pass in the request
Returns#
Promise
Promise<AdminAcceptInviteResponse>The user's details.
Promise
Promise<AdminAcceptInviteResponse>create#
This method creates an invite. It sends a request to the Create Invite API route.
Example#
Parameters#
The invite's details.
Configure the fields to retrieve in the invite.
Headers to pass in the request
Returns#
Promise
Promise<AdminInviteResponse>The invite's details.
Promise
Promise<AdminInviteResponse>retrieve#
This method retrieves an invite by its ID. It sends a request to the Get Invite API route.
Example#
To retrieve an invite its ID:
To specify the fields and relations to retrieve:
Learn more about the fields
property in the API reference.
Parameters#
id
stringConfigure the fields to retrieve in the invite.
Headers to pass in the request
Returns#
Promise
Promise<AdminInviteResponse>The invite's details.
Promise
Promise<AdminInviteResponse>list#
This method retrieves a paginated list of invites. It sends a request to the List Invites API route.
Example#
To retrieve the list of invites:
To configure the pagination, pass the limit
and offset
query parameters.
For example, to retrieve only 10 items and skip 10 items:
Using the fields
query parameter, you can specify the fields and relations to retrieve
in each invite:
Learn more about the fields
property in the API reference.
Parameters#
Filters and pagination configurations.
Headers to pass in the request.
Returns#
Promise
Promise<AdminInviteListResponse>The paginated list of invites.
Promise
Promise<AdminInviteListResponse>resend#
This method refreshes the token of an invite. It sends a request to the Refresh Invite Token API route.
Example#
Parameters#
id
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminInviteResponse>The invite's details.
Promise
Promise<AdminInviteResponse>delete#
This method deletes an invite. It sends a request to the Delete Invite API route.
Example#
Parameters#
id
stringHeaders to pass in the request.
Returns#
Promise
Promise<AdminInviteDeleteResponse>The deletion's details.
Promise
Promise<AdminInviteDeleteResponse>