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

# Create ghost user

> Create an anonymous guest user session without requiring authentication.

## Request

```http theme={null}
POST /auth/ghost
Content-Type: application/json
x-shop-id: {shopId}
```

## Headers

| Header         | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| `Content-Type` | string | Always set to `application/json`.                      |
| `x-shop-id`    | string | Shop identifier to associate the user with your store. |

<Note>
  This endpoint does not require authentication and creates an anonymous guest
  session for browsing.
</Note>

## Successful response

```json theme={null}
{
    "status": 201,
    "success": true,
    "message": "Ghost user created successfully",
    "data": {
        "_id": "690a1654ffc615e6ccfc65a6",
        "email": "ghost_690a1654ffc615e6ccfc65a6@guest.salesive.com",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "isGuest": true,
        "createdAt": "2025-11-14T15:45:00.000Z"
    }
}
```

<Check>
  You receive a temporary token that allows guest users to browse, add items
  to cart, and use the wishlist before registering.
</Check>

## Error response

```json theme={null}
{
    "status": 500,
    "success": false,
    "message": "Failed to create guest user",
    "data": {}
}
```


## OpenAPI

````yaml POST /auth/ghost
openapi: 3.1.0
info:
  title: Salesive Store API
  description: >-
    REST interface for querying products, categories, and merchandising banners
    exposed by Salesive storefronts.
  version: 1.0.0
servers:
  - description: Production
    url: https://store.salesive.com/api/v1
security:
  - BearerAuth: []
    ShopIdHeader: []
paths:
  /auth/ghost:
    post:
      summary: Create ghost user
      description: Create an anonymous guest user session without requiring authentication.
      parameters:
        - $ref: '#/components/parameters/XShopIdHeader'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
      responses:
        '201':
          description: Ghost user created successfully.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - success
                  - message
                  - data
                properties:
                  status:
                    type: integer
                  success:
                    type: boolean
                  message:
                    type: string
                  data:
                    type: object
                    required:
                      - _id
                      - email
                      - token
                      - isGuest
                    properties:
                      _id:
                        type: string
                        description: Ghost user identifier.
                      email:
                        type: string
                        format: email
                        description: Generated email for the ghost user.
                      token:
                        type: string
                        description: JWT token issued to the ghost user.
                      isGuest:
                        type: boolean
                        description: Indicates this is a guest/anonymous user.
                      createdAt:
                        type: string
                        format: date-time
        '500':
          description: Failed to create ghost user.
      security: []
components:
  parameters:
    XShopIdHeader:
      name: x-shop-id
      in: header
      description: >-
        Optional identifier that scopes responses to a specific storefront when
        the referer cannot be inferred.
      required: false
      schema:
        type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT issued by the Salesive Store API for authenticated shoppers.
    ShopIdHeader:
      type: apiKey
      in: header
      name: x-shop-id
      description: >-
        Optional storefront identifier sent as a header to scope responses to a
        specific shop. Try It requests remember this value once provided.

````