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

# Create Customer

> Create a customer record.



## OpenAPI

````yaml POST /v1/customers
openapi: 3.1.0
info:
  title: PriceOS Public API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/customers:
    post:
      summary: Create customer
      description: Create a customer record.
      parameters:
        - schema:
            type: string
            description: API key from your PriceOS dashboard.
          required: true
          description: API key from your PriceOS dashboard.
          name: x-api-key
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customerId:
                  type: string
                  description: Internal customer ID.
                name:
                  type: string
                  description: Customer name.
                email:
                  type: string
                  description: Customer email address.
                usageStartedAt:
                  type: integer
                  description: >-
                    Unix timestamp (ms) when usage tracking started. This will
                    determine when usage gets reset for your limit features if a
                    customer is assigned a custom product.
                customProductKeys:
                  type: array
                  items:
                    type: string
                  description: Assigned custom product keys.
              required:
                - customerId
              additionalProperties: false
      responses:
        '201':
          description: Customer created
          content:
            application/json:
              schema:
                type: object
                properties:
                  customerId:
                    type: string
                    description: Internal customer ID.
                  stripeCustomerId:
                    type: string
                    description: Stripe customer ID.
                  hasPaymentMethod:
                    type: boolean
                    description: >-
                      Whether the Stripe customer has at least one saved payment
                      method.
                  name:
                    type: string
                    description: Customer name.
                  email:
                    type: string
                    description: Customer email address.
                  created:
                    type: integer
                    description: Unix timestamp (ms) when the customer was created.
                  usageStartedAt:
                    type: integer
                    description: >-
                      Unix timestamp (ms) when usage tracking started. This will
                      determine when usage gets reset for your limit features if
                      a customer is assigned a custom product.
                  enviroment:
                    type: string
                    enum:
                      - test
                      - live
                    description: Customer environment.
                  products:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Product ID.
                        key:
                          type: string
                          description: Product key.
                        name:
                          type: string
                          description: Product name.
                        type:
                          type: string
                          enum:
                            - stripe
                            - custom
                          description: Product type.
                        isDefault:
                          type: boolean
                          description: Whether this product is the default custom product.
                        status:
                          type: string
                          enum:
                            - incomplete
                            - incomplete_expired
                            - trialing
                            - active
                            - past_due
                            - paused
                            - unpaid
                            - canceled
                          description: Stripe subscription status (Stripe customers only).
                        version:
                          type: number
                          description: Product version number.
                        metadata:
                          type: object
                          additionalProperties:
                            type: string
                          description: Custom product metadata (custom products only).
                        canceledAt:
                          type:
                            - integer
                            - 'null'
                          description: >-
                            Unix timestamp (ms) when the subscription was
                            canceled (Stripe customers only).
                        startedAt:
                          type: integer
                          description: >-
                            Unix timestamp (ms) when the subscription started
                            (Stripe customers only).
                        currentPeriodStart:
                          type: integer
                          description: >-
                            Unix timestamp (ms) for the current period start
                            (Stripe customers only).
                        currentPeriodEnd:
                          type: integer
                          description: >-
                            Unix timestamp (ms) for the current period end
                            (Stripe customers only).
                        prices:
                          type: array
                          items:
                            type: object
                            properties:
                              stripePriceId:
                                type: string
                                description: Stripe price ID.
                              quantity:
                                type: number
                                description: Price quantity.
                              currency:
                                type: string
                                description: ISO currency code.
                              unitAmount:
                                type: number
                                description: Unit amount in the smallest currency unit.
                              recurringInterval:
                                type:
                                  - string
                                  - 'null'
                                description: Recurring interval, if any.
                              isActive:
                                type: boolean
                                description: Whether the price is active.
                              isDefault:
                                type: boolean
                                description: Whether this is the default price.
                              recurringIntervalCount:
                                type: number
                                description: Number of intervals between charges.
                            required:
                              - stripePriceId
                              - quantity
                              - currency
                              - unitAmount
                              - recurringInterval
                              - isActive
                              - isDefault
                              - recurringIntervalCount
                          description: Prices tied to this product (Stripe customers only).
                      required:
                        - id
                        - key
                        - name
                        - type
                        - isDefault
                        - status
                        - version
                    description: Subscribed or assigned products.
                  featureAccess:
                    type: object
                    additionalProperties:
                      oneOf:
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - boolean
                              description: Feature access type.
                            hasAccess:
                              type: boolean
                              description: Whether the customer has access.
                          required:
                            - type
                            - hasAccess
                          title: Boolean
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - limit
                              description: Feature access type.
                            hasAccess:
                              type: boolean
                              description: Whether the customer has access.
                            isUnlimited:
                              type: boolean
                              description: Whether the feature is unlimited.
                            limit:
                              type:
                                - number
                                - 'null'
                              description: Limit for the feature, when applicable.
                            usage:
                              type: object
                              properties:
                                used:
                                  type: number
                                  description: Usage consumed for the feature.
                                remaining:
                                  type:
                                    - number
                                    - 'null'
                                  description: Remaining base limit (limit - used).
                                bonusRemaining:
                                  type: number
                                  description: Remaining bonus amount.
                                hasReachedLimit:
                                  type: boolean
                                  description: >-
                                    Whether base limit is met or exceeded and no
                                    bonus amount remains.
                                bonusUsed:
                                  type: number
                                  description: Bonus amount consumed.
                                nextReset:
                                  type:
                                    - integer
                                    - 'null'
                                  description: >-
                                    Unix timestamp (ms) for the next reset, when
                                    applicable.
                                lastReset:
                                  type:
                                    - integer
                                    - 'null'
                                  description: >-
                                    Unix timestamp (ms) for the last reset, when
                                    applicable.
                              required:
                                - used
                                - remaining
                                - bonusRemaining
                                - hasReachedLimit
                                - bonusUsed
                                - nextReset
                                - lastReset
                              description: Usage details for tracked features.
                          required:
                            - type
                            - hasAccess
                            - isUnlimited
                            - limit
                          title: Limit
                    description: Feature access map.
                  bonuses:
                    type: array
                    items:
                      type: object
                      properties:
                        bonusId:
                          type: string
                          format: uuid
                          description: Bonus ID.
                        featureKey:
                          type: string
                          description: Feature key.
                        amount:
                          type: number
                          description: Bonus amount.
                        remainingAmount:
                          type: number
                          description: Remaining bonus amount.
                        expiresAt:
                          type:
                            - integer
                            - 'null'
                          description: Unix timestamp (ms) when the bonus expires.
                        reason:
                          type:
                            - string
                            - 'null'
                          description: Bonus reason.
                        metadata:
                          type: object
                          additionalProperties:
                            type: string
                          description: Bonus metadata.
                        createdAt:
                          type: integer
                          description: Unix timestamp (ms) when the bonus was created.
                        updatedAt:
                          type: integer
                          description: Unix timestamp (ms) when the bonus was updated.
                      required:
                        - bonusId
                        - featureKey
                        - amount
                        - remainingAmount
                        - createdAt
                        - updatedAt
                    description: Customer bonuses.
                required:
                  - hasPaymentMethod
                  - enviroment
                  - products
                  - featureAccess
                  - bonuses
                description: Customer info.
              example:
                customerId: customer_123
                stripeCustomerId: cus_abc123
                hasPaymentMethod: true
                name: Ada Lovelace
                email: ada@example.com
                created: 1735689600000
                usageStartedAt: 1735689600000
                enviroment: test
                products:
                  - id: prod_123
                    key: starter
                    name: Starter
                    type: stripe
                    isDefault: false
                    status: active
                    version: 1
                    metadata:
                      tier: starter
                    canceledAt: null
                    startedAt: 1735689600000
                    currentPeriodStart: 1735689600000
                    currentPeriodEnd: 1738368000000
                    prices:
                      - stripePriceId: price_123
                        quantity: 1
                        currency: usd
                        unitAmount: 2000
                        recurringInterval: month
                        isActive: true
                        isDefault: true
                        recurringIntervalCount: 1
                featureAccess:
                  api_calls:
                    hasAccess: true
                    type: limit
                    limit: 1000
                    isUnlimited: false
                    usage:
                      used: 120
                      remaining: 880
                      bonusRemaining: 25
                      hasReachedLimit: false
                      bonusUsed: 5
                      nextReset: 1738368000000
                      lastReset: 1735689600000
                  team_seats:
                    hasAccess: true
                    type: boolean
                bonuses:
                  - bonusId: 9e9be7e5-55d2-4b44-93af-c3687f4b8af5
                    featureKey: api_calls
                    amount: 50
                    remainingAmount: 50
                    expiresAt: 1738368000000
                    reason: Support credit
                    metadata:
                      source: support
                    createdAt: 1735689600000
                    updatedAt: 1735689600000
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message.
                required:
                  - error
      x-codeSamples:
        - lang: typescript
          label: Node.js
          source: >-
            import { PriceOS } from "priceos";

            import type { MyFeatures } from "./priceos.types";


            const priceos = new
            PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);


            const customer = await priceos.customers.create({
              customerId: "customer_123",
              email: "alex@acme.com",
              name: "Alex Johnson",
            });
        - lang: bash
          label: cURL
          source: |-
            curl -X POST "https://api.priceos.com/v1/customers" \
              -H "x-api-key: PRICEOS_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "customerId": "customer_123",
                "email": "alex@acme.com",
                "name": "Alex Johnson"
              }'

````