> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mercurjs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# createSellerAccountWorkflow

> Create a seller with its owner member during self-registration.

Creates a seller with `pending_approval` status, ensures the default seller roles exist, creates (or reuses) the owner member, and links the member's auth identity via app metadata. Optionally sets the seller address, professional details, and payment details in the same run. Triggered by `POST /vendor/sellers` during vendor registration. Emits `seller.created`.

## Usage

```ts theme={null}
import { createSellerAccountWorkflow } from "@mercurjs/core/workflows"

const { result } = await createSellerAccountWorkflow(container).run({
  input: {
    auth_identity_id: "authid_123",
    seller: { name: "Acme", email: "hello@acme.co", currency_code: "usd" },
    member_email: "owner@acme.co",
    first_name: "Jane",
    last_name: "Doe",
  },
})
```

## Input

<ParamField body="auth_identity_id" type="string" required>Auth identity to bind to the owner member.</ParamField>

<ParamField body="seller" type="CreateSellerDTO" required>
  Seller to create; `status` is forced to `pending_approval`.

  <Expandable title="properties">
    <ParamField body="name" type="string" required>Display name of the seller.</ParamField>
    <ParamField body="email" type="string" required>Contact email of the seller.</ParamField>
    <ParamField body="currency_code" type="string" required>Default currency of the seller.</ParamField>
    <ParamField body="handle" type="string">URL handle; auto-generated when omitted.</ParamField>
    <ParamField body="description" type="string">Public seller description.</ParamField>
    <ParamField body="metadata" type="object">Custom key-value data.</ParamField>
  </Expandable>
</ParamField>

<ParamField body="member_email" type="string">Email for the new owner member; required when `member_id` is not provided.</ParamField>
<ParamField body="member_id" type="string">Existing member to link as owner instead of creating one.</ParamField>
<ParamField body="first_name" type="string">Owner member first name.</ParamField>
<ParamField body="last_name" type="string">Owner member last name.</ParamField>
<ParamField body="address" type="UpdateSellerAddressDTO">Seller address to set after creation.</ParamField>
<ParamField body="professional_details" type="UpdateProfessionalDetailsDTO">Professional details to set after creation.</ParamField>
<ParamField body="payment_details" type="UpdatePaymentDetailsDTO">Payment details to set after creation.</ParamField>
<ParamField body="additional_data" type="object">Custom data passed through to the workflow hooks.</ParamField>

## Result

<ResponseField name="result" type="SellerDTO">The created seller.</ResponseField>

## Hooks

* `sellerAccountCreated` — runs after the account is assembled with `{ seller, additional_data }`.

```ts theme={null}
createSellerAccountWorkflow.hooks.sellerAccountCreated(async ({ seller }) => {
  // provision extra resources for the new seller
})
```
