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

# Get Affiliate

> Retrieve a single affiliate by id for a account.

Retrieve a single affiliate by id for a account.

```http theme={null}
GET https://services.leadconnectorhq.com/affiliate-manager/{locationId}/affiliates/{affiliateId}
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Path parameters

<ParamField path="locationId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Account Id
</ParamField>

<ParamField path="affiliateId" type="string" required default="ve9EPM428h8vShlRW1KT">
  Affiliate Id
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="_id" type="string" required default="63d147176c5bbc30e9e091a4">
    Affiliate id
  </ResponseField>

  <ResponseField name="firstName" type="string" default="John">
    Affiliate first name
  </ResponseField>

  <ResponseField name="lastName" type="string" default="Doe">
    Affiliate last name
  </ResponseField>

  <ResponseField name="phone" type="string" default="+1 888 888-8888">
    Affiliate phone number
  </ResponseField>

  <ResponseField name="deleted" type="boolean" default="False">
    Whether the affiliate is deleted
  </ResponseField>

  <ResponseField name="locationId" type="string" required default="ve9EPM428h8vShlRW1KT">
    Account id
  </ResponseField>

  <ResponseField name="active" type="boolean" default="True">
    Whether the affiliate is active
  </ResponseField>

  <ResponseField name="address" type="string" default="123 Main St">
    Affiliate address
  </ResponseField>

  <ResponseField name="avatar" type="string" default="https://example.com/avatar.png">
    Affiliate avatar URL
  </ResponseField>

  <ResponseField name="createdAt" type="string" default="2024-06-16T00:00:00.000Z">
    Created at timestamp
  </ResponseField>

  <ResponseField name="createdBy" type="object">
    Created by audit info
  </ResponseField>

  <ResponseField name="facebookUrl" type="string" default="https://facebook.com/johndoe">
    Facebook URL
  </ResponseField>

  <ResponseField name="instagramUrl" type="string" default="https://instagram.com/johndoe">
    Instagram URL
  </ResponseField>

  <ResponseField name="linkedInUrl" type="string" default="https://linkedin.com/in/johndoe">
    LinkedIn URL
  </ResponseField>

  <ResponseField name="twitterUrl" type="string" default="https://twitter.com/johndoe">
    Twitter URL
  </ResponseField>

  <ResponseField name="youtubeUrl" type="string" default="https://youtube.com/channel">
    YouTube URL
  </ResponseField>

  <ResponseField name="websiteUrl" type="string" default="https://example.com">
    Website URL
  </ResponseField>

  <ResponseField name="contactId" type="string" default="ve9EPM428h8vShlRW1KT">
    Contact id associated with the affiliate
  </ResponseField>

  <ResponseField name="campaignIds" type="string[]">
    Campaign ids
  </ResponseField>

  <ResponseField name="vatId" type="string" default="VAT123">
    VAT ID
  </ResponseField>

  <ResponseField name="updatedAt" type="string" default="2024-06-16T00:00:00.000Z">
    Updated at timestamp
  </ResponseField>

  <ResponseField name="w8Form" type="string">
    W8 form URL
  </ResponseField>

  <ResponseField name="w9Form" type="string">
    W9 form URL
  </ResponseField>

  <ResponseField name="lastUpdatedBy" type="object">
    Last updated by audit info
  </ResponseField>

  <ResponseField name="email" type="string" required default="john.doe@example.com">
    Affiliate email
  </ResponseField>

  <ResponseField name="revenue" type="number" default="1250.5">
    Affiliate revenue
  </ResponseField>

  <ResponseField name="customer" type="number" default="15">
    Customer count
  </ResponseField>

  <ResponseField name="lead" type="number" default="5">
    Lead count
  </ResponseField>

  <ResponseField name="droppedCustomer" type="number" default="2">
    Dropped customer count
  </ResponseField>

  <ResponseField name="clickCount" type="number" default="100">
    Click count
  </ResponseField>

  <ResponseField name="paid" type="number" default="500">
    Paid amount
  </ResponseField>

  <ResponseField name="currency" type="string" default="USD">
    Currency code
  </ResponseField>

  <ResponseField name="owned" type="number" default="750">
    Owned amount
  </ResponseField>

  ```json theme={null}
  {
    "_id": "63d147176c5bbc30e9e091a4",
    "firstName": "John",
    "lastName": "Doe",
    "phone": "+1 888 888-8888",
    "deleted": false,
    "locationId": "ve9EPM428h8vShlRW1KT",
    "active": true,
    "address": "123 Main St",
    "avatar": "https://example.com/avatar.png",
    "createdAt": "2024-06-16T00:00:00.000Z",
    "createdBy": {},
    "facebookUrl": "https://facebook.com/johndoe",
    "instagramUrl": "https://instagram.com/johndoe",
    "linkedInUrl": "https://linkedin.com/in/johndoe",
    "twitterUrl": "https://twitter.com/johndoe",
    "youtubeUrl": "https://youtube.com/channel",
    "websiteUrl": "https://example.com",
    "contactId": "ve9EPM428h8vShlRW1KT",
    "campaignIds": [
      "650173614761b33c46d33b19"
    ],
    "vatId": "VAT123",
    "updatedAt": "2024-06-16T00:00:00.000Z",
    "w8Form": "string",
    "w9Form": "string",
    "lastUpdatedBy": {},
    "email": "john.doe@example.com",
    "revenue": 1250.5,
    "customer": 15,
    "lead": 5,
    "droppedCustomer": 2,
    "clickCount": 100,
    "paid": 500,
    "currency": "USD",
    "owned": 750
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://services.leadconnectorhq.com/affiliate-manager/YOUR_locationId/affiliates/YOUR_affiliateId' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/affiliate-manager/YOUR_locationId/affiliates/YOUR_affiliateId', {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'GET',
      'https://services.leadconnectorhq.com/affiliate-manager/YOUR_locationId/affiliates/YOUR_affiliateId',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/affiliate-manager/YOUR_locationId/affiliates/YOUR_affiliateId');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
