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

# Create an Account

> Creates a new account



## OpenAPI

````yaml /api-reference/storefront.yaml post /api/v2/storefront/account
openapi: 3.0.3
info:
  version: 2.0.0
  title: Storefront API
  description: >-
    Storefront API is a modern REST API based on the [JSON API
    spec](https://jsonapi.org/) which provides you with all the necessary
    endpoints to build amazing user interfaces either in JavaScript frameworks
    or native mobile libraries.


    Import to
    [Postman](https://raw.githubusercontent.com/spree/spree/main/docs/api-reference/storefront.yaml)
  contact:
    name: Vendo Connect Inc.
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  license:
    name: BSD-3-Clause
    url: https://github.com/spree/spree/blob/main/LICENSE.md
servers:
  - url: https://demo.spreecommerce.org
    description: demo
  - url: http://localhost:3000
    description: localhost
security: []
tags:
  - name: Account
  - name: Account / Address
  - name: Account / Credit Cards
  - name: Account / Orders
  - name: Cart
  - name: Cart / Line Items
  - name: Cart / Coupons
  - name: Cart / Other
  - name: Checkout
  - name: Checkout / State
  - name: Checkout / Shipments
  - name: Checkout / Payments
  - name: Checkout / Store Credit
  - name: Stripe
  - name: Adyen
  - name: Countries
  - name: Digital Downloads
  - name: Order Status
  - name: Products
  - name: Variants
  - name: Stores
  - name: Policies
  - name: Taxons
  - name: Vendors
  - name: Wishlists
  - name: Wishlists / Wished Items
paths:
  /api/v2/storefront/account:
    post:
      tags:
        - Account
      summary: Create an Account
      description: Creates a new account
      operationId: account-creation
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              type: object
              properties:
                user:
                  type: object
                  properties:
                    email:
                      type: string
                      example: john@snow.org
                    first_name:
                      type: string
                      example: John
                    last_name:
                      type: string
                      example: Snow
                    selected_locale:
                      type: string
                      example: en
                    password:
                      type: string
                      example: spree123
                    password_confirmation:
                      type: string
                      example: spree123
                    public_metadata:
                      type: object
                      example:
                        user_segment: supplier
                      description: The public metadata for this User
                    private_metadata:
                      type: object
                      example:
                        has_abandoned_cart: false
                      description: The private metadata for this User
        description: ''
      responses:
        '200':
          $ref: '#/components/responses/User'
        '422':
          $ref: '#/components/responses/422UnprocessableEntity'
components:
  responses:
    User:
      description: 200 Success - Returns the `user` object.
      content:
        application/vnd.api+json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/User'
              included:
                type: array
                items:
                  allOf:
                    - $ref: '#/components/schemas/Address'
            required:
              - data
          examples:
            Standard response:
              value:
                data:
                  id: '1'
                  type: user
                  attributes:
                    email: spree@example.com
                    first_name: John
                    last_name: Snow
                    selected_locale: en
                    store_credits: 0
                    completed_orders: 0
                    tags:
                      - VIP
                      - supplier
                    public_metadata:
                      user_segment: supplier
                  relationships:
                    default_billing_address:
                      data:
                        id: '2'
                        type: address
                    default_shipping_address:
                      data:
                        id: '1'
                        type: address
            Including Addresses:
              value:
                data:
                  id: '1'
                  type: user
                  attributes:
                    email: spree@example.com
                    store_credits: 0
                    completed_orders: 0
                  relationships:
                    default_billing_address:
                      data:
                        id: '2'
                        type: address
                    default_shipping_address:
                      data:
                        id: '1'
                        type: address
                included:
                  - id: '2'
                    type: address
                    attributes:
                      firstname: Destiny
                      lastname: Maggio
                      address1: 12775 Runolfsdottir Greens
                      address2: Apt. 704
                      city: Kochmouth
                      zipcode: '16804'
                      phone: 1-257-860-8433
                      state_name: New York
                      company: null
                      country_name: United States
                      country_iso3: USA
                      country_iso: US
                      state_code: NY
                  - id: '1'
                    type: address
                    attributes:
                      firstname: Aimee
                      lastname: Jast
                      address1: 56593 Baumbach Meadows
                      address2: Suite 632
                      city: Port Michaelafort
                      zipcode: '16804'
                      phone: (846)556-4478
                      state_name: New York
                      company: null
                      country_name: United States
                      country_iso3: USA
                      country_iso: US
                      state_code: NY
    422UnprocessableEntity:
      description: 422 Unprocessable Entity
      content:
        application/vnd.api+json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            422 Example:
              value:
                error: Example is invalid
                errors:
                  example:
                    - Example is invalid
  schemas:
    User:
      type: object
      title: User
      description: ' '
      x-internal: false
      properties:
        id:
          type: string
          example: '1'
        type:
          type: string
          default: user
        attributes:
          type: object
          properties:
            email:
              type: string
              example: spree@example.com
            first_name:
              type: string
              example: John
            last_name:
              type: string
              example: Doe
            selected_locale:
              type: string
              example: fr
            store_credits:
              type: number
              example: 150.75
            completed_orders:
              type: number
              example: 3
              description: Number of placed Orders by this User
            tags:
              type: array
              items:
                type: string
              description: List of tags associated with the user
            public_metadata:
              type: object
              example:
                user_segment: supplier
              description: The public metadata for this User
        relationships:
          type: object
          properties:
            default_billing_address:
              type: object
              description: Default billing address associated with this Account
              properties:
                data:
                  $ref: '#/components/schemas/Relation'
            default_shipping_address:
              type: object
              description: Default shipping address associated with this Account
              properties:
                data:
                  $ref: '#/components/schemas/Relation'
      required:
        - id
        - type
        - attributes
        - relationships
    Address:
      type: object
      title: Address
      description: >-
        The Address model holds the customer details, such as name, address, and
        phone number.
      properties:
        id:
          type: string
          example: '1'
        type:
          type: string
          default: address
        attributes:
          type: object
          properties:
            firstname:
              type: string
              example: John
            lastname:
              type: string
              example: Doe
            address1:
              type: string
              example: 1600 Amphitheatre Pkwy
            address2:
              type: string
              example: Suite 1
              nullable: true
            city:
              type: string
              example: Mountain View
            zipcode:
              type: string
              example: '94043'
            phone:
              type: string
              example: (+1) 123 456 789
              nullable: true
            state_name:
              type: string
              example: California
            state_code:
              type: string
              example: CA
              description: State abbreviation
              nullable: true
            country_name:
              type: string
              example: United States of America
            country_iso3:
              type: string
              example: USA
              description: Country ISO3 code
            company:
              type: string
              example: Google Inc.
              description: Company name
              nullable: true
            label:
              type: string
              description: The internal name for this address (Work, Home)
              example: Home
              nullable: true
      required:
        - id
        - type
        - attributes
      x-internal: false
    Error:
      x-internal: false
      title: Error
      type: object
      properties:
        error:
          type: string
    Relation:
      type: object
      nullable: true
      properties:
        id:
          type: string
        type:
          type: string
      required:
        - id
        - type
      x-internal: false
      description: ''

````