POST
/
admin
/
invites
/
accept
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.

Response

200
application/json

OK

The created user's details.