# createInvites - User Module Reference

This documentation provides a reference to the `createInvites` method. This belongs to the User Module.

You should only use this methods when implementing complex customizations. For common cases, check out [available workflows instead](https://docs.medusajs.com/medusa-workflows-reference).

## createInvites(data, sharedContext?): Promise\<[InviteDTO](https://docs.medusajs.com/var/task/www/apps/resources/references/user/interfaces/user.InviteDTO)\[]>

This method creates invites.

### Example

```ts
const invites = await userModuleService.createInvites([
  {
    email: "john@doe.com"
  },
  {
    email: "john2@doe.com"
  }
])
```

### Parameters

- data: (\[CreateInviteDTO]\(../../../interfaces/user.CreateInviteDTO/page.mdx)\[]) The invites to be created.

  - email: (\`string\`) The email of the invite.

  - accepted: (\`boolean\`) Whether the invite is accepted.

  - metadata: (\`null\` \\| \`Record\<string, unknown>\`) Holds custom data in key-value pairs.
- sharedContext: (\[Context]\(../../../interfaces/user.Context/page.mdx)) A context used to share resources, such as transaction manager, between the application and the module.

  - transactionManager: (TManager) An instance of a transaction manager of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`transactionManager\`.

  - manager: (TManager) An instance of a manager, typically an entity manager, of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`manager\`.

  - isolationLevel: (\`string\`) A string indicating the isolation level of the context. Possible values are \`READ UNCOMMITTED\`, \`READ COMMITTED\`, \`REPEATABLE READ\`, or \`SERIALIZABLE\`.

  - enableNestedTransactions: (\`boolean\`) A boolean value indicating whether nested transactions are enabled.

  - eventGroupId: (\`string\`) A string indicating the ID of the group to aggregate the events to be emitted at a later point.

  - transactionId: (\`string\`) A string indicating the ID of the current transaction.

  - runId: (\`string\`) A string indicating the ID of the current run.

  - messageAggregator: (\[IMessageAggregator]\(../../../interfaces/user.IMessageAggregator/page.mdx)) An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.

  - requestId: (\`string\`) A string indicating the ID of the current request.

  - idempotencyKey: (\`string\`) A string indicating the idempotencyKey of the current workflow execution.

  - parentStepIdempotencyKey: (\`string\`) A string indicating the idempotencyKey of the parent workflow execution.

  - preventReleaseEvents: (\`boolean\`) preventReleaseEvents

  - isCancelling: (\`boolean\`) A boolean value indicating whether the current workflow execution is being cancelled.

  - cancelingFromParentStep: (\`boolean\`) Weither or not a sub workflow cancellation is being triggered from a parent step.
    If true, the parent step will not be triggered by the sub workflow.

### Returns

- Promise: (Promise\&#60;\[InviteDTO]\(../../../interfaces/user.InviteDTO/page.mdx)\[]\&#62;) The created invites.

  - InviteDTO\[]: (\[InviteDTO]\(../../../interfaces/user.InviteDTO/page.mdx)\[])

    - id: (\`string\`) The ID of the invite.

    - email: (\`string\`) The email of the invite.

    - accepted: (\`boolean\`) Whether the invite is accepted.

    - token: (\`string\`) The token of the invite.

    - expires\_at: (\`Date\`) The invite's expiry date.

    - metadata: (\`null\` \\| \`Record\<string, unknown>\`) Holds custom data in key-value pairs.

    - created\_at: (\`Date\`) The invite's creation date.

    - updated\_at: (\`Date\`) The invite's update date.

    - deleted\_at: (\`null\` \\| \`Date\`) The invite's deletion date.

    - roles: (\`null\` \\| \`string\`\[]) The RBAC roles to assign to the user when the invite is accepted.

## createInvites(data, sharedContext?): Promise\<[InviteDTO](https://docs.medusajs.com/var/task/www/apps/resources/references/user/interfaces/user.InviteDTO)>

This method creates a invite.

### Example

```ts
const invite = await userModuleService.createInvites({
  email: "john@doe.com"
})
```

### Parameters

- data: (\[CreateInviteDTO]\(../../../interfaces/user.CreateInviteDTO/page.mdx)) The invite to be created.

  - email: (\`string\`) The email of the invite.

  - accepted: (\`boolean\`) Whether the invite is accepted.

  - metadata: (\`null\` \\| \`Record\<string, unknown>\`) Holds custom data in key-value pairs.
- sharedContext: (\[Context]\(../../../interfaces/user.Context/page.mdx)) A context used to share resources, such as transaction manager, between the application and the module.

  - transactionManager: (TManager) An instance of a transaction manager of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`transactionManager\`.

  - manager: (TManager) An instance of a manager, typically an entity manager, of type \`TManager\`, which is a typed parameter passed to the context to specify the type of the \`manager\`.

  - isolationLevel: (\`string\`) A string indicating the isolation level of the context. Possible values are \`READ UNCOMMITTED\`, \`READ COMMITTED\`, \`REPEATABLE READ\`, or \`SERIALIZABLE\`.

  - enableNestedTransactions: (\`boolean\`) A boolean value indicating whether nested transactions are enabled.

  - eventGroupId: (\`string\`) A string indicating the ID of the group to aggregate the events to be emitted at a later point.

  - transactionId: (\`string\`) A string indicating the ID of the current transaction.

  - runId: (\`string\`) A string indicating the ID of the current run.

  - messageAggregator: (\[IMessageAggregator]\(../../../interfaces/user.IMessageAggregator/page.mdx)) An instance of a message aggregator, which is used to aggregate messages to be emitted at a later point.

  - requestId: (\`string\`) A string indicating the ID of the current request.

  - idempotencyKey: (\`string\`) A string indicating the idempotencyKey of the current workflow execution.

  - parentStepIdempotencyKey: (\`string\`) A string indicating the idempotencyKey of the parent workflow execution.

  - preventReleaseEvents: (\`boolean\`) preventReleaseEvents

  - isCancelling: (\`boolean\`) A boolean value indicating whether the current workflow execution is being cancelled.

  - cancelingFromParentStep: (\`boolean\`) Weither or not a sub workflow cancellation is being triggered from a parent step.
    If true, the parent step will not be triggered by the sub workflow.

### Returns

- Promise: (Promise\&#60;\[InviteDTO]\(../../../interfaces/user.InviteDTO/page.mdx)\&#62;) The created invite.

  - id: (\`string\`) The ID of the invite.

  - email: (\`string\`) The email of the invite.

  - accepted: (\`boolean\`) Whether the invite is accepted.

  - token: (\`string\`) The token of the invite.

  - expires\_at: (\`Date\`) The invite's expiry date.

  - metadata: (\`null\` \\| \`Record\<string, unknown>\`) Holds custom data in key-value pairs.

  - created\_at: (\`Date\`) The invite's creation date.

  - updated\_at: (\`Date\`) The invite's update date.

  - deleted\_at: (\`null\` \\| \`Date\`) The invite's deletion date.

  - roles: (\`null\` \\| \`string\`\[]) The RBAC roles to assign to the user when the invite is accepted.


---

The best way to deploy Medusa is through Medusa Cloud where you get autoscaling production infrastructure fine tuned for Medusa. Create an account by signing up at cloud.medusajs.com/signup.
