openapi: 3.1.0
info:
  title: Storefront Customers
  version: 1.0.0
paths:
  /customers:
    post:
      operationId: createCustomer
      summary: Create Customer
      description: |-
        Create a *Customer*.

        > #### Note
        > * Substitute your storefront domain for `yourstore.example.com`. 
        > * The Send a Test Request feature is not currently supported for this endpoint.
      tags:
        - customers
      responses:
        '204':
          description: Customer successfully created.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        '400':
          description: Could not create customer.
          content:
            application/json:
              schema:
                description: Any type
        '409':
          description: Thereʼs already an account for the provided email. Please enter a different email address or sign in.
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: Missing Required Fields.
          content:
            application/json:
              schema:
                description: Any type
        '429':
          description: Spam Protection Failed.
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        description: Data sent to the customer endpoint when creating a customer during checkout.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerCreateData'
servers:
  - url: https://your_store.example.com/api/storefront
    description: https://{store_domain}/api/storefront
components:
  schemas:
    CustomFieldsFieldValue:
      oneOf:
        - type: string
        - type: number
          format: double
        - type: array
          items:
            type: string
      title: CustomFieldsFieldValue
    CustomFields:
      type: object
      properties:
        fieldId:
          type: string
        fieldValue:
          $ref: '#/components/schemas/CustomFieldsFieldValue'
      title: CustomFields
    CustomerCreateData:
      type: object
      properties:
        firstName:
          type: string
          description: First name of customer.
        lastName:
          type: string
          description: Last name of customer.
        email:
          type: string
          description: Email of customer.
        password:
          type: string
          description: Password of customer.
        acceptsMarketingEmails:
          type: boolean
          description: Indicates whether customer provided consent to receive marketing emails.
        token:
          type: string
          description: >-
            A valid [reCAPTCHA](/developer/docs/storefront/guides/graphql-storefront-api#recaptcha) token from a
            successful verification response.
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomFields'
      title: CustomerCreateData
