> ## 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 a customer

> Create a new customer record in the store. Requires the WRITE_CUSTOMERS scope.

Creates a new customer in the store. The email must be unique within the store. The store is bound to your app token server-side — never send a shop id.


## OpenAPI

````yaml POST /customers
openapi: 3.1.0
info:
  title: Salesive Apps API — Customers & Categories
  version: 1.0.0
  description: >-
    Read and manage the store's customers and product categories from an
    installed third-party app. Every endpoint authenticates with an
    installed-app access token (prefix `app_`) and requires a specific OAuth
    scope. The target store is bound to the token server-side from the
    installation — never send a shop id.
servers:
  - url: https://api.salesive.com/api/v1
    description: Production
security:
  - AppToken: []
paths:
  /customers:
    post:
      tags:
        - Customers
      summary: Create a customer
      description: >-
        Creates a new customer record in the store. The email must be unique
        within the store; a duplicate email returns an error. The store is bound
        to the app token server-side from the installation — never send a shop
        id. Requires the `WRITE_CUSTOMERS` scope.
      operationId: createCustomer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerCreate'
            example:
              name: Ada Obi
              email: ada@example.com
              phone: '+2348012345678'
              active: true
      responses:
        '201':
          description: The created customer.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/EnvelopeBase'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/Customer'
              example:
                status: 201
                success: true
                message: Customer created successfully
                data:
                  _id: 665a1f2c9b1e4a0012ab34cd
                  user: null
                  shop: 664f0e2a1c2b3d4e5f6a7b8c
                  name: Ada Obi
                  phone: '+2348012345678'
                  email: ada@example.com
                  lastActive: '2026-06-28T08:00:00.000Z'
                  online: false
                  active: true
                  createdAt: '2026-06-28T08:00:00.000Z'
                  updatedAt: '2026-06-28T08:00:00.000Z'
                  avatar: >-
                    https://api.dicebear.com/9.x/initials/svg?seed=Ada%20Obi&backgroundColor=0d65d9
                  id: 665a1f2c9b1e4a0012ab34cd
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    CustomerCreate:
      type: object
      description: Fields accepted when creating a customer.
      required:
        - name
        - email
      properties:
        name:
          type: string
          description: Customer's display name.
        email:
          type: string
          format: email
          description: >-
            Customer email address. Required by the data model and must be
            unique within the store; must be a valid email.
        phone:
          type:
            - string
            - 'null'
          description: Customer phone number. May be null.
        user:
          type:
            - string
            - 'null'
          description: >-
            ObjectId of an existing platform user to link this customer to. May
            be null.
        active:
          type: boolean
          default: true
          description: Whether the customer is active. Defaults to true.
    EnvelopeBase:
      type: object
      description: >-
        Standard Salesive response envelope. The operation-specific payload is
        carried in `data`.
      required:
        - status
        - success
        - message
      properties:
        status:
          type: integer
          description: HTTP status code, echoed in the body.
        success:
          type: boolean
          description: Whether the request succeeded.
        message:
          type: string
          description: Human-readable result message.
    Customer:
      type: object
      description: A store-scoped customer record.
      properties:
        _id:
          type: string
        id:
          type: string
          description: Virtual alias of `_id`.
        user:
          oneOf:
            - $ref: '#/components/schemas/UserProfile'
            - type: 'null'
          description: >-
            Linked platform user, or null when the customer is not linked to a
            user.
        shop:
          type: string
          description: The store id (bound server-side).
        name:
          type: string
        phone:
          type:
            - string
            - 'null'
        email:
          type: string
        lastActive:
          type: string
          format: date-time
        online:
          type: boolean
        active:
          type: boolean
        avatar:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    UserProfile:
      type: object
      description: The platform user linked to the customer, when one exists.
      properties:
        _id:
          type: string
        name:
          type: string
        email:
          type: string
        avatar:
          type:
            - string
            - 'null'
    Envelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              description: Operation-specific payload (object, array, or null).
  responses:
    Unauthorized:
      description: Missing or invalid app access token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 401
            success: false
            message: Authentication required
            data: null
    Forbidden:
      description: The app token is missing the OAuth scope required for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            status: 403
            success: false
            message: Insufficient scope
            data: null
  securitySchemes:
    AppToken:
      type: http
      scheme: bearer
      description: >-
        Installed-app access token (prefix app_), issued by the OAuth install
        flow. The store is bound to the token server-side — never send a shop
        id.

````