# Get Campaign

GET https://services.leadconnectorhq.com/affiliate-manager/{locationId}/campaigns/{campaignId}

Retrieve a single affiliate campaign by id for a location.

## Authentication

Send `Authorization: Bearer <token>` using any one of:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `affiliate-manager.readonly`
- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `affiliate-manager.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location Id |
| `campaignId` | string | Yes | Campaign Id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-04-15"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/affiliate-manager/{locationId}/campaigns/{campaignId}": {
      "get": {
        "summary": "Get Campaign",
        "operationId": "getCampaign",
        "description": "Retrieve a single affiliate campaign by id for a location.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-04-15"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "description": "Location Id",
            "schema": {
              "example": "ve9EPM428h8vShlRW1KT",
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "required": true,
            "in": "path",
            "description": "Campaign Id",
            "schema": {
              "example": "6385d230f6d19db03eef6fb2",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCampaignResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "affiliate-manager.readonly"
            ]
          },
          {
            "Location-Access": [
              "affiliate-manager.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetCampaignResponseDto": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Campaign id",
            "example": "6385d230f6d19db03eef6fb2"
          },
          "locationId": {
            "type": "string",
            "description": "Location id the campaign belongs to",
            "example": "ve9EPM428h8vShlRW1KT"
          },
          "name": {
            "type": "string",
            "description": "Campaign name",
            "example": "Summer launch"
          },
          "description": {
            "type": "string",
            "description": "Campaign description",
            "example": "Affiliate campaign for the summer launch"
          },
          "trackType": {
            "type": "string",
            "description": "What the campaign tracks",
            "enum": [
              "forms",
              "surveys",
              "calenders",
              "funnels",
              "websites",
              "store",
              "external_source",
              "community"
            ],
            "example": "funnels"
          },
          "subTrackType": {
            "type": "string",
            "description": "Sub track type",
            "enum": [
              "lead",
              "product",
              "donation"
            ],
            "example": "product"
          },
          "liveMode": {
            "type": "boolean",
            "description": "Whether the campaign is live",
            "example": true
          },
          "currency": {
            "type": "string",
            "description": "Campaign currency",
            "example": "USD"
          },
          "payoutFrequency": {
            "type": "string",
            "description": "How often affiliates are paid out",
            "enum": [
              "PAY_7",
              "PAY_15",
              "PAY_30",
              "PAY_45",
              "PAY_60",
              "PAY_90"
            ],
            "example": "PAY_30"
          },
          "cookieLife": {
            "type": "number",
            "description": "Referral cookie lifetime in days",
            "example": 30
          },
          "commissionType": {
            "type": "string",
            "description": "First tier commission type",
            "enum": [
              "flat",
              "percentage"
            ],
            "example": "percentage"
          },
          "commission": {
            "type": "number",
            "description": "First tier commission value",
            "example": 10
          },
          "commissionTier": {
            "type": "number",
            "description": "Number of commission tiers",
            "example": 1
          },
          "leadCommissionTier": {
            "type": "number",
            "description": "Number of lead commission tiers",
            "example": 1
          },
          "isGlobalCommission": {
            "type": "boolean",
            "description": "Whether one commission applies to every product on the campaign",
            "example": true
          },
          "secondTierCommissionType": {
            "type": "string",
            "description": "Second tier commission type",
            "enum": [
              "flat",
              "percentage"
            ],
            "example": "percentage"
          },
          "secondTierCommission": {
            "type": "number",
            "description": "Second tier commission value",
            "example": 5
          },
          "calculateSetupFee": {
            "type": "boolean",
            "description": "Whether setup fees count towards commission",
            "example": false
          },
          "referralPermalink": {
            "type": "string",
            "description": "Referral link slug",
            "example": "summer-launch"
          },
          "referralRealLink": {
            "type": "string",
            "description": "Full referral link",
            "example": "https://example.com/summer-launch"
          },
          "domain": {
            "type": "string",
            "description": "Domain the referral link points at",
            "example": "example.com"
          },
          "stepId": {
            "type": "string",
            "description": "Funnel or page step id being tracked",
            "example": "6385d230f6d19db03eef6fb3"
          },
          "subAfLink": {
            "type": "string",
            "description": "Sub affiliate signup link",
            "example": "https://example.com/sub-affiliate-signup"
          },
          "enableSubAffiliateLink": {
            "type": "boolean",
            "description": "Whether sub affiliate signup is enabled",
            "example": false
          },
          "enableAutoEnrollSubAffiliate": {
            "type": "boolean",
            "description": "Whether sub affiliates are auto enrolled",
            "example": true
          },
          "createdAt": {
            "type": "string",
            "description": "Campaign creation timestamp",
            "example": "2026-01-01T00:00:00.000Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Campaign update timestamp",
            "example": "2026-01-02T00:00:00.000Z"
          },
          "commissionV2": {
            "description": "Per-tier commission configuration. This is what the commission engine applies; the flat commissionType and commission fields are the legacy fallback used only when this is empty.",
            "example": [
              {
                "tier": 1,
                "defaultCommission": {
                  "commissionType": "percentage",
                  "commission": 10
                },
                "commissionLength": {
                  "lengthType": "by-count",
                  "length": 3
                }
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tier": {
                  "type": "number",
                  "description": "Tier this configuration applies to",
                  "example": 1
                },
                "defaultCommission": {
                  "description": "Rate applied to any product without an override",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "commissionType": {
                          "type": "string",
                          "description": "Whether the commission is a percentage or a flat amount",
                          "enum": [
                            "flat",
                            "percentage"
                          ],
                          "example": "percentage"
                        },
                        "commission": {
                          "type": "number",
                          "description": "Commission value, in percent or in campaign currency",
                          "example": 10
                        }
                      },
                      "required": [
                        "commissionType",
                        "commission"
                      ],
                      "title": "CommissionValueResponseDto"
                    }
                  ]
                },
                "productBasedCommission": {
                  "description": "Per-price overrides, which win over defaultCommission",
                  "example": [
                    {
                      "productId": "6385d230f6d19db03eef6fb9",
                      "productName": "Starter Course",
                      "priceId": "price_1MoBy5AbCdEfGhIj",
                      "commissionType": "flat",
                      "commission": 25
                    }
                  ],
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "productId": {
                        "type": "string",
                        "description": "Product the override applies to",
                        "example": "6385d230f6d19db03eef6fb9"
                      },
                      "productName": {
                        "type": "string",
                        "description": "Product name at the time the override was set",
                        "example": "Starter Course"
                      },
                      "priceId": {
                        "type": "string",
                        "description": "Price the override applies to",
                        "example": "price_1MoBy5AbCdEfGhIj"
                      },
                      "commissionType": {
                        "type": "string",
                        "description": "Whether the override is a percentage or a flat amount",
                        "enum": [
                          "flat",
                          "percentage"
                        ],
                        "example": "flat"
                      },
                      "commission": {
                        "type": "number",
                        "description": "Override commission value",
                        "example": 25
                      }
                    },
                    "required": [
                      "productId",
                      "productName",
                      "priceId",
                      "commissionType",
                      "commission"
                    ],
                    "title": "ProductCommissionResponseDto"
                  }
                },
                "commissionLength": {
                  "description": "How long commission keeps accruing",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "lengthType": {
                          "type": "string",
                          "description": "Whether commission runs forever, for a number of payments, or for a period",
                          "enum": [
                            "life-time",
                            "by-count",
                            "time-span"
                          ],
                          "example": "by-count"
                        },
                        "length": {
                          "type": "number",
                          "description": "Number of payments or days, per lengthType",
                          "example": 3
                        }
                      },
                      "required": [
                        "lengthType",
                        "length"
                      ],
                      "title": "CommissionLengthResponseDto"
                    }
                  ]
                },
                "variableCommission": {
                  "description": "Reduced or raised rate after an initial run of payments",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "enabled": {
                          "type": "string",
                          "description": "Whether a different rate applies after the first payments",
                          "enum": [
                            "yes",
                            "no"
                          ],
                          "example": "yes"
                        },
                        "count": {
                          "type": "number",
                          "description": "Payments after which the variable rate takes over",
                          "example": 2
                        },
                        "commissionType": {
                          "type": "string",
                          "description": "Variable rate commission type",
                          "enum": [
                            "flat",
                            "percentage"
                          ],
                          "example": "flat"
                        },
                        "commission": {
                          "type": "number",
                          "description": "Variable rate commission value",
                          "example": 5
                        }
                      },
                      "title": "VariableCommissionResponseDto"
                    }
                  ]
                }
              },
              "required": [
                "tier"
              ],
              "title": "CommissionTierResponseDto"
            }
          },
          "leadCommissionV2": {
            "description": "Per-tier lead commission configuration, applied to lead-tracking campaigns",
            "example": [
              {
                "tier": 1,
                "defaultCommission": {
                  "commissionType": "flat",
                  "commission": 5
                }
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tier": {
                  "type": "number",
                  "description": "Tier this configuration applies to",
                  "example": 1
                },
                "defaultCommission": {
                  "description": "Flat amount paid per lead — commissionType is always flat here",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "commissionType": {
                          "type": "string",
                          "description": "Whether the commission is a percentage or a flat amount",
                          "enum": [
                            "flat",
                            "percentage"
                          ],
                          "example": "percentage"
                        },
                        "commission": {
                          "type": "number",
                          "description": "Commission value, in percent or in campaign currency",
                          "example": 10
                        }
                      },
                      "required": [
                        "commissionType",
                        "commission"
                      ],
                      "title": "CommissionValueResponseDto"
                    }
                  ]
                }
              },
              "required": [
                "tier"
              ],
              "title": "LeadCommissionTierResponseDto"
            }
          },
          "products": {
            "description": "Products and prices attached to the campaign. For commission calculation use commissionV2[].productBasedCommission, which is typed and authoritative.",
            "example": [
              {
                "_id": "6385d230f6d19db03eef6fc1",
                "productId": "6385d230f6d19db03eef6fb9",
                "priceId": "price_1MoBy5AbCdEfGhIj",
                "productName": "Starter Course",
                "commission": 25,
                "commissionType": "flat"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string",
                  "description": "Mapping id",
                  "example": "6385d230f6d19db03eef6fc1"
                },
                "productId": {
                  "type": "string",
                  "description": "Product this price belongs to",
                  "example": "6385d230f6d19db03eef6fb9",
                  "nullable": true
                },
                "priceId": {
                  "type": "string",
                  "description": "Price on the campaign",
                  "example": "price_1MoBy5AbCdEfGhIj"
                },
                "productName": {
                  "type": "string",
                  "description": "Product name at the time it was added",
                  "example": "Starter Course"
                },
                "commission": {
                  "type": "number",
                  "description": "Commission value recorded for this product",
                  "example": 25,
                  "nullable": true
                },
                "commissionType": {
                  "type": "string",
                  "description": "Commission type recorded for this product",
                  "example": "flat",
                  "nullable": true
                }
              },
              "required": [
                "_id",
                "priceId",
                "productName"
              ],
              "title": "CampaignProductResponseDto"
            }
          }
        },
        "required": [
          "_id",
          "locationId",
          "name",
          "liveMode",
          "cookieLife"
        ],
        "title": "GetCampaignResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-04-15'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-04-15'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/affiliate-manager/{locationId}/campaigns/{campaignId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-04-15"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-04-15',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-04-15")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-04-15")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2021-04-15"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-04-15"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/affiliate-manager/<locationId>/campaigns/<campaignId>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
