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

# Get Customer

> Retrieves details of a given customer by customer's `id` or `source_id`.



## OpenAPI

````yaml /openapi/customers.json get /v1/customers/{customerId}
openapi: 3.0.1
info:
  title: Voucherify API - Customers
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/customers/{customerId}:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterCustomerId'
        name: customerId
        in: path
        required: true
        description: A Voucherify customer's `id` or `source_id`.
    get:
      tags:
        - Customers
      summary: Get Customer
      description: Retrieves details of a given customer by customer's `id` or `source_id`.
      operationId: get-customer
      parameters: []
      responses:
        '200':
          description: Returns a customer object if a valid identifier was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomersGetResponseBody'
              examples:
                Example:
                  value:
                    id: cust_T849EgzNVVmn5icJ2FAkT2rO
                    source_id: alice.morgan@email.com
                    name: Alice Morgan
                    email: alice.morgan@email.com
                    address: null
                    summary:
                      redemptions:
                        total_redeemed: 2
                        total_failed: 0
                        total_succeeded: 2
                        total_rolled_back: 0
                        total_rollback_failed: 0
                        total_rollback_succeeded: 0
                        gift:
                          redeemed_amount: 0
                          amount_to_go: 0
                        loyalty_card:
                          redeemed_points: 0
                          points_to_go: 3303
                      orders:
                        total_amount: 203900
                        total_count: 2
                        average_amount: 101950
                        last_order_amount: 3900
                        last_order_date: '2022-07-26T14:59:52.814Z'
                    loyalty:
                      points: 3303
                      referred_customers: 0
                      campaigns:
                        Summer Campaign:
                          points: 3303
                          referred_customers: 0
                    referrals:
                      total: 0
                      campaigns: []
                    system_metadata: {}
                    created_at: '2022-02-07T08:28:23.644Z'
                    updated_at: '2022-07-26T14:59:59.806Z'
                    assets:
                      cockpit_url: '{{internalVoucherifyURL}}'
                    object: customer
        '404':
          description: >-
            Not Found. When requesting the ID of a customer that has been
            deleted or does not exist in the system, the resource will not be
            returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: Cannot find customer with id cust_sehkNIi8Uq2qQuRqSr7xn4Z
                    request_id: v-0b4c590350857970df
                    resource_id: cust_sehkNIi8Uq2qQuRqSr7xn4Z
                    resource_type: customer
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - customers
components:
  schemas:
    ParameterCustomerId:
      type: string
      example: cust_nk0N1uNQ1YnupAoJGOgvsODC
    CustomersGetResponseBody:
      title: Customers Get Response Body
      description: Response body schema for **GET** `v1/customers/{customerId}`.
      allOf:
        - $ref: '#/components/schemas/CustomerWithSummaryLoyaltyReferrals'
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    CustomerWithSummaryLoyaltyReferrals:
      title: Customer With Summary Loyalty Referrals
      allOf:
        - type: object
          title: Customer Response Data
          properties:
            id:
              type: string
              description: >-
                The ID of an existing customer that will be linked to redemption
                in this request.
            source_id:
              type: string
              description: >-
                A unique identifier of the customer who validates a voucher. It
                can be a customer ID or email from a CRM system, database, or a
                third-party service. If you also pass a customer ID (unique ID
                assigned by Voucherify), the source ID will be ignored.
            summary:
              nullable: true
              allOf:
                - $ref: '#/components/schemas/CustomerSummary'
            loyalty:
              nullable: true
              allOf:
                - $ref: '#/components/schemas/CustomerLoyalty'
            referrals:
              nullable: true
              allOf:
                - $ref: '#/components/schemas/CustomerReferrals'
            system_metadata:
              type: object
              description: Object used to store system metadata information.
            created_at:
              type: string
              description: >-
                Timestamp representing the date and time when the customer was
                created. The value is shown in the ISO 8601 format.
              example: '2022-08-30T06:32:07.380Z'
              format: date-time
            updated_at:
              type: string
              description: >-
                Timestamp representing the date and time when the customer was
                updated. The value is shown in the ISO 8601 format.
              example: '2022-08-31T06:32:07.380Z'
              format: date-time
            assets:
              type: object
              description: >-
                Contains information about the customer's cockpit.


                ⚠️ Warning: Customer cockpits were removed. The customer cockpit
                URLs redirect to customer preference center.
              properties:
                cockpit_url:
                  type: string
                  description: >-
                    URL address to customer preference center. Previously, a
                    customer's cockpit URL address.
                cockpit_preference_center_url:
                  type: string
                  description: URL address to customer preference center.
            object:
              type: string
              description: The type of the object represented by JSON.
              default: customer
              enum:
                - customer
          required:
            - summary
            - loyalty
            - referrals
            - object
        - $ref: '#/components/schemas/CustomerBase'
    CustomerSummary:
      title: Customer Summary
      type: object
      properties:
        redemptions:
          $ref: '#/components/schemas/CustomerSummaryRedemptions'
        orders:
          $ref: '#/components/schemas/CustomerSummaryOrders'
      required:
        - redemptions
        - orders
    CustomerLoyalty:
      title: Customer Loyalty
      type: object
      properties:
        points:
          type: integer
          description: >-
            Customer's loyalty points minus expired for all loyalty cards which
            the customer has.
        referred_customers:
          type: integer
          description: Total number of customers referred by the customer.
        campaigns:
          type: object
          description: >-
            Contains campaigns with details about point balances and how many
            customers were referred by the customer.
          additionalProperties:
            type: object
            description: >-
              Contains details about the point balances left on loyalty cards
              and the number of referred customers in each campaign.
            properties:
              points:
                type: integer
                description: Remaining point balance in campaign.
              loyalty_tier:
                type: string
                example: ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x
                description: Customer's loyalty tier within the campaign.
              referred_customers:
                type: integer
                description: Number of customers referred by the customer in campaign.
      required:
        - points
        - referred_customers
        - campaigns
    CustomerReferrals:
      title: Customer Referrals
      type: object
      description: >-
        Summary of customer's referrals, in this case, the customer being the
        referee, i.e. information about the source of referrals and number of
        times the customer was referred by other customers.
      properties:
        total:
          type: integer
          description: >-
            Total number of times this customer received a referral, i.e. was
            referred by another customer.
        campaigns:
          type: array
          description: >-
            Contains an array of campaigns that served as the source of a
            referral for the customer.
          items:
            title: Customer Referrals Campaigns Item
            type: object
            description: Contains information about the source of the referral.
            properties:
              campaign_id:
                type: string
                description: Unique campaign ID, assigned by Voucherify.
                example: camp_rRsfatlwN7unSeUIJDCYedal
              referrer_id:
                type: string
                example: cust_sehkNIi8Uq2qQuRqSr7xn4Zi
                description: >-
                  Unique referrer ID, assigned by Voucherify. This is the
                  customer ID of a customer that is referring this customer.
              related_object_id:
                type: string
                description: Related object id
                example: r_0b9d4cc4aa164dd073
              related_object_type:
                type: string
                description: Related object type, i.e. `redemption`.
              date:
                type: string
                format: date-time
                example: '2022-08-30T10:19:39.196Z'
                description: >-
                  Timestamp representing the date and time when the customer was
                  referred in ISO 8601 format.
            required:
              - campaign_id
              - referrer_id
              - related_object_id
              - related_object_type
              - date
      required:
        - total
        - campaigns
    CustomerBase:
      title: Customer Base
      type: object
      properties:
        name:
          type: string
          description: Customer's first and last name.
        description:
          type: string
          description: An arbitrary string that you can attach to a customer object.
        email:
          type: string
          description: Customer's email address.
        phone:
          type: string
          description: >-
            Customer's phone number. This parameter is mandatory when you try to
            send out codes to customers via an SMS channel.
        birthday:
          type: string
          description: '`Deprecated`. ~~Customer''s birthdate; format YYYY-MM-DD~~.'
          format: date
        birthdate:
          type: string
          description: Customer's birthdate; format YYYY-MM-DD.
          format: date
        address:
          type: object
          nullable: true
          description: Customer's address.
          properties:
            city:
              type: string
              description: City
            state:
              type: string
              description: State
            line_1:
              type: string
              description: First line of address.
            line_2:
              type: string
              description: Second line of address.
            country:
              type: string
              description: Country.
            postal_code:
              type: string
              description: Postal code.
        metadata:
          type: object
          description: >-
            A set of custom key/value pairs that you can attach to a customer.
            The metadata object stores all custom attributes assigned to the
            customer. It can be useful for storing additional information about
            the customer in a structured format. This metadata can be used for
            validating whether the customer qualifies for a discount or it can
            be used in building customer segments.
    CustomerSummaryRedemptions:
      title: Customer Summary Redemptions
      type: object
      properties:
        total_redeemed:
          type: integer
          description: Total number of redemptions made by the customer.
        total_failed:
          type: integer
          description: Total number of redemptions that failed.
        total_succeeded:
          type: integer
          description: Total number of redemptions that succeeded.
        total_rolled_back:
          type: integer
          description: Total number of redemptions that were rolled back for the customer.
        total_rollback_failed:
          type: integer
          description: Total number of redemption rollbacks that failed.
        total_rollback_succeeded:
          type: integer
          description: Total number of redemption rollbacks that succeeded.
        gift:
          type: object
          description: Summary of gift card credits.
          required:
            - redeemed_amount
            - amount_to_go
          properties:
            redeemed_amount:
              type: integer
              description: >-
                Total amount of gift card credits redeemed by customer. The
                value is multiplied by 100 to represent 2 decimal places. For
                example `10000 cents` for `$100.00`.
              default: 0
            amount_to_go:
              type: integer
              description: >-
                Remaining gift card balance across all gift cards. The value is
                multiplied by 100 to represent 2 decimal places. For example
                `10000 cents` for `$100.00`.
              default: 0
        loyalty_card:
          type: object
          description: Summary of loyalty points.
          required:
            - redeemed_points
            - points_to_go
          properties:
            redeemed_points:
              type: integer
              description: Total number of loyalty points redeemed by the customer.
            points_to_go:
              type: integer
              description: >-
                Sum of remaining available point balance across all loyalty
                cards.
      required:
        - total_redeemed
        - total_failed
        - total_succeeded
        - total_rolled_back
        - total_rollback_failed
        - total_rollback_succeeded
        - gift
        - loyalty_card
    CustomerSummaryOrders:
      title: Customer Summary Orders
      description: >-
        Lists details about orders related to the customer. Lists only data for
        orders with the `PAID` or `FULFILLED` status. Data from orders with a
        `CREATED` or `CANCELED` status are not included. The data is updated
        also when an order changes status.
      type: object
      properties:
        total_amount:
          type: integer
          description: >-
            The total amount spent by the customer. The value is multiplied by
            100 to represent 2 decimal places. For example `10000 cents` for
            `$100.00`.
        total_count:
          type: integer
          description: Total number of orders made by the customer.
        average_amount:
          type: integer
          description: >-
            Average amount spent on orders. `total_amount` &divide;
            `total_count`. The value is multiplied by 100 to represent 2 decimal
            places. For example `10000 cents` for `$100.00`.
        last_order_amount:
          type: integer
          description: >-
            Amount spent on last order. The value is multiplied by 100 to
            represent 2 decimal places. For example `10000 cents` for `$100.00`.
        last_order_date:
          type: string
          format: date-time
          example: '2022-08-30T11:51:08.029Z'
          description: >-
            Timestamp representing the date and time of the customer's last
            order in ISO 8601 format.
      required:
        - total_amount
        - total_count
        - average_amount
        - last_order_amount
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````