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

# Fetch Customer

> Retrieve details of a specific customer by their ID

## Overview

Retrieve detailed information about a specific customer using their unique identifier. This endpoint supports field selection, response versioning, and conditional fetching.

## Base URL

```bash theme={null}
GET /customers/{id}
```

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the customer. Example: `6f7e1e7f-93d1-4fcc-b7a4-738f869615c8`
</ParamField>

## Query Parameters

<ParamField query="fields" type="string">
  Comma-separated list of fields to include in the response. Example: `fields=first_name,email,phone_number`
</ParamField>

<ParamField query="version" type="string">
  API version for backwards compatibility. Default: Latest version
</ParamField>

<ParamField query="include" type="string">
  Additional related resources to include. Example: `include=transactions,payment_methods`
</ParamField>

## Request Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.spendjuice.com/customers/6f7e1e7f-93d1-4fcc-b7a4-738f869615c8" \
  -H "Authorization:  YOUR_API_KEY" \
  -H "Accept: application/json"
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios');

  try {
    const response = await axios.get(
      'https://api.spendjuice.com/customers/6f7e1e7f-93d1-4fcc-b7a4-738f869615c8',
      {
        headers: {
          'Authorization': ' YOUR_API_KEY',
          'Accept': 'application/json'
        }
      }
    );
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching customer:', error.response.data);
  }
  ```

  ```python Python theme={null}
  import requests

  headers = {
      'Authorization': ' YOUR_API_KEY',
      'Accept': 'application/json'
  }

  try:
      response = requests.get(
          'https://api.spendjuice.com/customers/6f7e1e7f-93d1-4fcc-b7a4-738f869615c8',
          headers=headers
      )
      response.raise_for_status()
      print(response.json())
  except requests.exceptions.RequestException as e:
      print('Error fetching customer:', e)
  ```
</CodeGroup>

## Response

<CodeGroup>
  ```json 200 Success theme={null}
  {
      "data": {
          "id": "6f7e1e7f-93d1-4fcc-b7a4-738f869615c8",
          "first_name": "Test",
          "last_name": "Customer",
          "email": "test@custom.com",
          "phone_number": "+2348012345678",
          "billing_address": {
              "line1": "123 Test lane",
              "line2": "3456 Mike Drive",
              "city": "Anon",
              "state": "Acme",
              "zip_code": "12345",
              "country": "US"
          },
          "created_at": "2024-03-15T12:00:00Z",
          "updated_at": "2024-03-15T12:00:00Z"
      }
  }
  ```

  ```json 404 Not Found theme={null}
  {
      "error": {
          "code": "customer_not_found",
          "message": "No customer found with ID: 6f7e1e7f-93d1-4fcc-b7a4-738f869615c8"
      }
  }
  ```
</CodeGroup>

## Rate Limiting

<Note>
  This endpoint has a rate limit of 1000 requests per hour per API key. Rate limit information is included in the response headers:

  * `X-RateLimit-Limit`: Total requests allowed per hour
  * `X-RateLimit-Remaining`: Remaining requests in the current period
  * `X-RateLimit-Reset`: Time when the rate limit resets (Unix timestamp)
</Note>

## Common Use Cases

<AccordionGroup>
  <Accordion title="Fetch Basic Customer Info">
    ```bash theme={null}
    GET /customers/{id}?fields=first_name,last_name,email
    ```

    Returns only the customer's basic contact information.
  </Accordion>

  <Accordion title="Include Related Data">
    ```bash theme={null}
    GET /customers/{id}?include=transactions,payment_methods
    ```

    Returns customer details along with their transaction history and saved payment methods.
  </Accordion>

  <Accordion title="Versioned Response">
    ```bash theme={null}
    GET /customers/{id}?version=2023-01-01
    ```

    Returns customer data formatted according to the specified API version.
  </Accordion>
</AccordionGroup>

## Error Responses

| Status Code | Description                                        |
| ----------- | -------------------------------------------------- |
| 400         | Invalid request (malformed parameters)             |
| 401         | Authentication failed (invalid or missing API key) |
| 403         | Permission denied                                  |
| 404         | Customer not found                                 |
| 429         | Rate limit exceeded                                |
| 500         | Internal server error                              |

## Best Practices

1. Always use HTTPS for API requests
2. Implement proper error handling
3. Cache responses when appropriate
4. Monitor rate limits
5. Use field selection to minimize response payload size

<Card title="Need Help?">
  For additional assistance:

  * Check our [API Reference](/api-reference/overview)
  * Contact [Support](mailto:support@juicyway.com)
</Card>
