POST
/
admin
/
invites
/
accept
JS SDK
import Medusa from "@medusajs/js-sdk"

export const sdk = new Medusa({
  baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
  debug: import.meta.env.DEV,
  auth: {
    type: "session",
  },
})

await sdk.auth.register("user", "emailpass", {
  email: "user@gmail.com",
  password: "supersecret"
})

// all subsequent requests will use the token in the header
const { user } = await sdk.admin.invite.accept(
  {
    email: "user@gmail.com",
    first_name: "John",
    last_name: "Smith",
    invite_token: "12345..."
  },
)
{
"user": {
"id": "<string>",
"email": "jsmith@example.com",
"first_name": "<string>",
"last_name": "<string>",
"avatar_url": "<string>",
"metadata": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
}
}

Authorizations

connect.sid
string
cookie
required

Body

application/json

The details of the user to be created.

email
string<email>

The user's email.

first_name
string

The user's first name.

last_name
string

The user's last name.

Response

OK

  • Option 1
  • Option 2

The created user's details.

user
object
required

The user's details.