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

# Get Affiliate

> Retrieve details of a specific affiliate by their unique code

Retrieves detailed information about a specific affiliate by their unique affiliate code. This endpoint returns comprehensive affiliate information including their account details, performance statistics, and earnings.

## Path Parameters

<ParamField path="affiliateCode" type="string" required>
  The unique affiliate code (e.g., `CREATOR123`, `PARTNER2025`)
</ParamField>

## Response

<ResponseField name="message" type="string">
  Response status message
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="id" type="string">
      Unique store affiliate identifier (e.g., `saff_abc123xyz`)
    </ResponseField>

    <ResponseField name="status" type="string">
      Affiliate status: `active`, `inactive`, or `suspended`
    </ResponseField>

    <ResponseField name="source" type="object">
      How the affiliate joined the store

      <Expandable title="source object">
        <ResponseField name="label" type="string">
          Human-readable label (e.g., `Invitation`, `Application`)
        </ResponseField>

        <ResponseField name="description" type="string">
          Description of the source
        </ResponseField>

        <ResponseField name="value" type="string">
          Source value: `invitation`, `application`, `manual`
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total_visits" type="integer">
      Total number of visits through affiliate links
    </ResponseField>

    <ResponseField name="total_sales" type="integer">
      Total number of sales made through referrals
    </ResponseField>

    <ResponseField name="total_earnings" type="object">
      Total commission earnings

      <Expandable title="total_earnings object">
        <ResponseField name="value" type="integer">
          Earnings amount
        </ResponseField>

        <ResponseField name="formatted" type="string">
          Formatted earnings with currency symbol (e.g., `$1,250.00`)
        </ResponseField>

        <ResponseField name="short" type="string">
          Short formatted earnings (e.g., `$1,250`)
        </ResponseField>

        <ResponseField name="currency" type="string">
          Currency code (e.g., `USD`)
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="first_visit_at" type="string|null">
      ISO 8601 timestamp of first referral visit
    </ResponseField>

    <ResponseField name="last_visit_at" type="string|null">
      ISO 8601 timestamp of most recent referral visit
    </ResponseField>

    <ResponseField name="suspended_at" type="string|null">
      ISO 8601 timestamp when affiliate was suspended (if applicable)
    </ResponseField>

    <ResponseField name="suspended_reason" type="string|null">
      Reason for suspension (if applicable)
    </ResponseField>

    <ResponseField name="account" type="object">
      Affiliate account details

      <Expandable title="account object">
        <ResponseField name="id" type="string">
          Affiliate account public ID
        </ResponseField>

        <ResponseField name="pseudo" type="string">
          Affiliate's display name/username
        </ResponseField>

        <ResponseField name="country" type="object">
          Affiliate's country information
        </ResponseField>

        <ResponseField name="status" type="string">
          Account status
        </ResponseField>

        <ResponseField name="user" type="object">
          User details (name, email, etc.)
        </ResponseField>

        <ResponseField name="created_at" type="string">
          Account creation timestamp
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 creation timestamp
    </ResponseField>

    <ResponseField name="updated_at" type="string">
      ISO 8601 last update timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="errors" type="array">
  Array of error messages (empty on success)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.chariow.com/v1/affiliates/CREATOR123" \
    -H "Authorization: Bearer sk_live_your_api_key"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.chariow.com/v1/affiliates/CREATOR123', {
    headers: {
      'Authorization': 'Bearer sk_live_your_api_key'
    }
  });
  const { data } = await response.json();
  console.log(data);
  ```

  ```php PHP theme={null}
  $ch = curl_init('https://api.chariow.com/v1/affiliates/CREATOR123');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer sk_live_your_api_key'
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  $data = json_decode($response, true);
  ```

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

  response = requests.get(
      'https://api.chariow.com/v1/affiliates/CREATOR123',
      headers={'Authorization': 'Bearer sk_live_your_api_key'}
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Response (200) theme={null}
  {
    "message": "Affiliate retrieved successfully",
    "data": {
      "id": "saff_xyz789abc",
      "status": "active",
      "source": {
        "label": "Invitation",
        "description": "Joined via invitation",
        "value": "invitation"
      },
      "total_visits": 150,
      "total_sales": 25,
      "total_earnings": {
        "value": 1250,
        "formatted": "$1,250.00",
        "short": "1.25K",
        "currency": "USD"
      },
      "first_visit_at": "2025-01-16T09:00:00+00:00",
      "last_visit_at": "2025-01-25T14:30:00+00:00",
      "suspended_at": null,
      "suspended_reason": null,
      "account": {
        "id": "aff_abc123def",
        "pseudo": "creative_studio",
        "country": {
          "code": "US",
          "name": "United States"
        },
        "status": "active",
        "user": {
          "name": "John Doe",
          "email": "john@example.com"
        },
        "created_at": "2025-01-15T10:30:00+00:00"
      },
      "created_at": "2025-01-15T10:30:00+00:00",
      "updated_at": "2025-01-25T14:30:00+00:00"
    },
    "errors": []
  }
  ```

  ```json Not Found (404) theme={null}
  {
    "message": "Affiliate not found",
    "data": [],
    "errors": []
  }
  ```

  ```json Unauthorised (401) theme={null}
  {
    "message": "Unauthenticated",
    "data": [],
    "errors": []
  }
  ```
</ResponseExample>
