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

# Get Customer

Retrieves detailed information about a specific customer using their unique reference ID.

## Query

<CodeGroup>
  ```graphql Query theme={null}
  query GetCustomerByRefId($input: GetCustomerByRefIdInput!) {
    getCustomerByRefId(input: $input) {
      customerId
      name
      email
      billingId
      billingCurrency
      hasActiveSubscription
      hasPaymentMethod
      additionalMetaData
      createdAt
      updatedAt
      subscriptions {
        subscriptionId
        status
        plan {
          refId
          displayName
        }
      }
      eligibleForTrial {
        eligible
        productRefId
      }
      promotionalEntitlements {
        id
        status
        feature {
          refId
        }
      }
    }
  }
  ```

  ```json Variables theme={null}
  {
    "input": {
      "customerId": "customer-123"
    }
  }
  ```

  ```json Response theme={null}
  {
    "data": {
      "getCustomerByRefId": {
        "customerId": "customer-123",
        "name": "Acme Corp",
        "email": "billing@acme.com",
        "billingId": "cus_ABC123",
        "billingCurrency": "USD",
        "hasActiveSubscription": true,
        "hasPaymentMethod": true,
        "additionalMetaData": {
          "industry": "Technology"
        },
        "createdAt": "2024-01-15T10:30:00Z",
        "updatedAt": "2024-01-20T15:45:00Z",
        "subscriptions": [
          {
            "subscriptionId": "sub-456",
            "status": "ACTIVE",
            "plan": {
              "refId": "plan-pro",
              "displayName": "Pro Plan"
            }
          }
        ],
        "eligibleForTrial": [
          {
            "eligible": false,
            "productRefId": "product-main"
          }
        ],
        "promotionalEntitlements": []
      }
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="input" type="GetCustomerByRefIdInput" required>
  Input object containing the customer identifier

  <Expandable title="properties">
    <ParamField body="customerId" type="String" required>
      The unique reference ID of the customer (your internal customer ID)
    </ParamField>

    <ParamField body="environmentId" type="UUID">
      The environment ID. If not provided, uses the environment from your API key.
    </ParamField>
  </Expandable>
</ParamField>

## Return Type

Returns a `Customer` object with the following key fields:

| Field                     | Type                      | Description                                 |
| ------------------------- | ------------------------- | ------------------------------------------- |
| `customerId`              | String                    | Unique customer identifier                  |
| `name`                    | String                    | Customer display name                       |
| `email`                   | String                    | Contact email address                       |
| `billingId`               | String                    | ID in billing provider (e.g., Stripe)       |
| `billingCurrency`         | Currency                  | Default billing currency                    |
| `hasActiveSubscription`   | Boolean                   | Whether customer has an active subscription |
| `hasPaymentMethod`        | Boolean                   | Whether a payment method is attached        |
| `subscriptions`           | \[CustomerSubscription]   | List of customer subscriptions              |
| `promotionalEntitlements` | \[PromotionalEntitlement] | Granted promotional entitlements            |
| `eligibleForTrial`        | \[EligibleForTrial]       | Trial eligibility per product               |
| `additionalMetaData`      | JSON                      | Custom metadata                             |

## Common Use Cases

<AccordionGroup>
  <Accordion title="Check subscription status on login">
    Verify the customer's subscription status when they log in to determine their access level.
  </Accordion>

  <Accordion title="Display account information">
    Fetch customer details for account settings pages.
  </Accordion>

  <Accordion title="Determine upgrade eligibility">
    Check `eligibleForTrial` and current subscription to show relevant upgrade options.
  </Accordion>
</AccordionGroup>

## Error Handling

| Error Code           | Description                             |
| -------------------- | --------------------------------------- |
| `CUSTOMER_NOT_FOUND` | No customer exists with the provided ID |
| `UNAUTHENTICATED`    | Invalid or missing API key              |

## Related Operations

* [List Customers](/api-and-sdks/api-reference/queries/list-customers) - Query multiple customers
* [Customer Portal](/api-and-sdks/api-reference/queries/customer-portal) - Get portal data for customer
* [Update Customer](/api-and-sdks/api-reference/mutations/update-customer) - Modify customer details
