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

# Create customer

> Adds a customer to the store's base with at least one identifier: external_id, tax_id, email or phone. If one of them already belongs to an active customer (looked up in that order, as with events), that customer is returned unchanged, with 200, and nothing about it changes. A new customer is created with 201 and triggers the customer.created webhook, with the same object as the response. Without consent, the new customer has no marketing opt-in. No flow starts and no message is sent. Send Idempotency-Key to retry the request safely. Requires an API key with the write scope.



## OpenAPI

````yaml /openapi.en.json post /v1/customers
openapi: 3.1.0
info:
  title: Bevits API
  version: 1.0.0
  description: >-
    Bevits public API for querying and managing CRM data, customers, purchases,
    segments, tags, automations, recipes, campaigns, email templates, brand kit,
    custom events, and webhooks.
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
servers:
  - url: https://api.bevits.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: System
    description: API availability.
  - name: Identity
    description: Organization and API key identity.
  - name: Customers
    description: Customers and their relationships.
  - name: Segments
    description: Customer segments.
  - name: Purchases
    description: >-
      Purchases from store integrations and purchases created through the API by
      organizations that sell through their own system.
  - name: CRM data
    description: Tags and attribute definitions.
  - name: Automations
    description: Automation flows.
  - name: Campaigns
    description: Email, WhatsApp, and SMS campaigns.
  - name: Account and brand
    description: Account context, brand kit, and images.
  - name: Recipes
    description: Ready-made automations created from recipes, with undo.
  - name: Email templates
    description: Creating and importing email templates.
  - name: Events
    description: Custom events sent by the store and their types.
  - name: Webhooks
    description: Endpoints that receive the store's events, and the delivery log.
paths:
  /v1/customers:
    post:
      tags:
        - Customers
      summary: Create customer
      description: >-
        Adds a customer to the store's base with at least one identifier:
        external_id, tax_id, email or phone. If one of them already belongs to
        an active customer (looked up in that order, as with events), that
        customer is returned unchanged, with 200, and nothing about it changes.
        A new customer is created with 201 and triggers the customer.created
        webhook, with the same object as the response. Without consent, the new
        customer has no marketing opt-in. No flow starts and no message is sent.
        Send Idempotency-Key to retry the request safely. Requires an API key
        with the write scope.
      operationId: createCustomer
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCustomerRequest'
            example:
              external_id: u_8842
              email: ana@exemplo.com.br
              phone: '+5511988887777'
              name: Ana Souza
              attributes:
                plano: vip
              consent:
                email: true
                whatsapp: true
      responses:
        '200':
          $ref: '#/components/responses/CustomerExisting'
        '201':
          $ref: '#/components/responses/CustomerCreated'
        '400':
          $ref: '#/components/responses/InvalidBody'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/WriteScopeRequired'
        '409':
          $ref: '#/components/responses/IdempotencyConflict'
        '422':
          $ref: '#/components/responses/CustomerValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/CreateUnavailable'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      description: >-
        Unique key for the operation, 1 to 255 characters (a UUID, for example).
        Repeating the same key with the same body within 24 hours returns the
        original response instead of running it again.
      schema:
        type: string
  schemas:
    CreateCustomerRequest:
      type: object
      additionalProperties: false
      description: >-
        At least one of external_id, tax_id, email or phone. These are the same
        fields as the customer of an event.
      properties:
        external_id:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            The customer's id in your system. Letter case is ignored; leading
            and trailing spaces are removed.
        tax_id:
          type: string
          maxLength: 32
          description: CPF or CNPJ, with or without punctuation. Must be valid.
        email:
          type: string
          format: email
          maxLength: 256
          description: Stored in lowercase.
        phone:
          type: string
          maxLength: 32
          description: >-
            E.164 (+5511988887777). Without a country code, the store's country
            is assumed.
        name:
          type: string
          minLength: 1
          maxLength: 256
        attributes:
          type: object
          description: >-
            Custom attributes by name. A new attribute is created with the
            inferred type. Ignored when the customer already exists.
          additionalProperties:
            oneOf:
              - type: string
                maxLength: 256
              - type: number
              - type: boolean
        consent:
          type: object
          additionalProperties: false
          description: >-
            Marketing opt-in of the new customer. Without it, the customer is
            created without opt-in.
          properties:
            email:
              type: boolean
            whatsapp:
              type: boolean
    Customer:
      allOf:
        - $ref: '#/components/schemas/CustomerSummary'
        - type: object
          required:
            - tags
            - attributes
          properties:
            external_id:
              type: string
              description: >-
                The id the store's system gave the customer (external_id of the
                create and of events).
            identification:
              type: string
            tags:
              type: array
              items:
                type: object
                required:
                  - id
                  - name
                properties:
                  id:
                    type: string
                    pattern: ^tag_[A-Za-z0-9_-]+$
                  name:
                    type: string
            attributes:
              type: object
              additionalProperties:
                oneOf:
                  - type: string
                  - type: number
                  - type: boolean
                  - type: 'null'
            default_address:
              $ref: '#/components/schemas/Address'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
    RateLimitErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          required:
            - retry_after
          properties:
            retry_after:
              type: integer
              minimum: 1
              description: Seconds before retrying.
    CustomerSummary:
      type: object
      required:
        - object
        - id
        - created_at
        - updated_at
        - html_url
      properties:
        object:
          type: string
          const: customer
        id:
          type: string
          pattern: ^cus_[A-Za-z0-9_-]+$
        name:
          type: string
        email:
          type: string
          format: email
        phone:
          type: string
          description: Phone number with country code, when available.
        source:
          type: string
        is_subscribed:
          type: boolean
        is_subscribed_to_email:
          type: boolean
        total_spent_in_cents:
          type: integer
        total_orders:
          type: integer
        first_purchase_date:
          type: string
          format: date-time
        last_purchase_date:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        html_url:
          type: string
          format: uri
    Address:
      type: object
      required:
        - id
        - street
        - number
        - city
        - state
        - country
        - zip_code
      properties:
        id:
          type: string
        street:
          type: string
        number:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
        zip_code:
          type: string
        neighborhood:
          type: string
        complement:
          type: string
    Error:
      type: object
      required:
        - type
        - message
        - request_id
      properties:
        type:
          type: string
          enum:
            - authentication_error
            - conflict
            - internal_error
            - invalid_request
            - not_found
            - permission_denied
            - rate_limited
            - service_unavailable
            - validation_error
        code:
          type: string
          description: >-
            Stable, machine-readable reason within type, such as
            invalid_event_name. Present when the error has a named reason.
        message:
          type: string
        param:
          type: string
          description: >-
            Full path of the offending field, such as customer.email or
            events[3].name.
        suggestion:
          type: string
          description: A value that would be accepted, when there is an obvious one.
        request_id:
          type: string
          pattern: ^req_[a-f0-9]{24}$
  responses:
    CustomerExisting:
      description: >-
        An active customer already had one of the identifiers sent. It is
        returned unchanged, nothing about it changes and no webhook is sent.
      headers:
        Location:
          $ref: '#/components/headers/Location'
        Idempotent-Replayed:
          $ref: '#/components/headers/IdempotentReplayed'
        ETag:
          $ref: '#/components/headers/ETag'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Customer'
    CustomerCreated:
      description: >-
        Customer created. The customer.created webhook carries this same object
        in data.customer.
      headers:
        Location:
          $ref: '#/components/headers/Location'
        Idempotent-Replayed:
          $ref: '#/components/headers/IdempotentReplayed'
        ETag:
          $ref: '#/components/headers/ETag'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Customer'
          example:
            object: customer
            id: cus_ckabc123
            name: Ana Souza
            email: ana@exemplo.com.br
            phone: '+5511988887777'
            source: API
            is_subscribed: true
            is_subscribed_to_email: true
            created_at: '2026-11-24T14:03:00.000Z'
            updated_at: '2026-11-24T14:03:00.000Z'
            html_url: https://app.bevits.com/customers/ckabc123
            external_id: u_8842
            tags: []
            attributes:
              plano: vip
    InvalidBody:
      description: >-
        Missing request body, a body that is not a JSON object, or an invalid
        route parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, expired, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: authentication_error
              message: Invalid API key.
              request_id: req_07f6cdc3c20249d6afcd90b4
    WriteScopeRequired:
      description: The API key does not have the write scope.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: permission_denied
              code: missing_scope
              message: This API key does not have the required "write" scope.
              param: scope
              request_id: req_07f6cdc3c20249d6afcd90b4
    IdempotencyConflict:
      description: The Idempotency-Key was already used with a different request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    CustomerValidationError:
      description: >-
        No identifier, an unknown field, an invalid email, phone or CPF/CNPJ, or
        an attribute of the wrong type.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: validation_error
              code: invalid_phone
              message: >-
                phone is not a valid number. Send it in E.164 (+5511988887777),
                or without a country code for a number in the store's country.
              param: phone
              request_id: req_07f6cdc3c20249d6afcd90b4
    RateLimited:
      description: Request limit exceeded.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitErrorResponse'
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    CreateUnavailable:
      description: >-
        The database could not confirm the operation right now. Retry the same
        request with the same Idempotency-Key: it is applied at most once.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              type: service_unavailable
              code: temporarily_unavailable
              message: >-
                The request could not be confirmed right now. Retry it with the
                same Idempotency-Key: it is applied at most once.
              request_id: req_07f6cdc3c20249d6afcd90b4
  headers:
    Location:
      description: Path of the resource created or found.
      schema:
        type: string
        example: /v1/customers/cus_ckabc123
    IdempotentReplayed:
      description: >-
        Present with true when the response is the one saved for this
        Idempotency-Key by an earlier request.
      schema:
        type: string
        enum:
          - 'true'
    ETag:
      description: Content version identifier for conditional caching.
      schema:
        type: string
        example: '"v1-4ad31f5efb6b8f35"'
    RetryAfter:
      description: Seconds before retrying.
      schema:
        type: integer
        minimum: 1
    RateLimitLimit:
      description: Total limit for the current window.
      schema:
        type: integer
        example: 600
    RateLimitRemaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
        example: 599
    RateLimitReset:
      description: UTC instant when the current window ends.
      schema:
        type: string
        format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: bvt_live_...
      description: API key created in the organization settings.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.