Link Builder API Documentation
Overview
The Link Builder API generates affiliate tracking links for any destination URL. POST a URL and the API automatically detects the advertiser and network, then returns a ready-to-use affiliate link. This powers the Hi Energy Chrome extension and can be used by any authorized client.
Key Features
- Multi-network – Supports Awin, Avantlink, CJ, Connexity, FlexOffers, Impact, Partnerize, Pepperjam, and Skimlinks.
- Two-step flow – Omit
networkto discover available networks for the merchant; supplynetworkto generate. - Auto-detection – Automatically identifies the advertiser and network from the URL domain.
- Custom tracking – Optional
custom_codeparameter for clickref/sub-ID tracking. - Feature-gated – Requires
link_generator_enabledon your publisher (or admin access). - Rate limited – Standard API rate limits apply.
Endpoint
Generate tracking link
POST /api/v1/deeplinks/generate
Generates an affiliate tracking link for the given URL. Returns the tracking URL, network, and advertiser name.
Authentication
X-Api-Key: YOUR_API_KEY
Sign in to get your API key.
API Playground
Drive the endpoint right from this page: paste your API key, type a destination URL, detect the supported networks for the merchant, then generate a tracking link and copy it. Sign in to enable live testing with your API key.
Try it live
Paste a product URL, detect which affiliate networks support the merchant, then generate a tracking link.
POST /api/v1/deeplinks/generate
link_generator_enabled.
X-Api-Key.
Create one.
Tracking link
Response
—
Equivalent cURL
cURL reference
| Action | Method | Endpoint | Description |
|---|---|---|---|
| List available networks | POST |
/api/v1/deeplinks/generate |
POST with only url. Response JSON includes domain, advertiser_name, and the supported networks for that merchant. |
| Generate tracking link | POST |
/api/v1/deeplinks/generate |
POST with url and network. Response JSON includes deeplink, network, advertiser_name. |
| With custom code | POST |
/api/v1/deeplinks/generate |
Include custom_code param for clickref/sub-ID tracking. |
List available networks for a URL
curl -X POST "https://app.hienergy.ai/api/v1/deeplinks/generate" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "url=https://www.example-merchant.com/product/123"
Generate a tracking link
curl -X POST "https://app.hienergy.ai/api/v1/deeplinks/generate" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "url=https://www.example-merchant.com/product/123" \
-d "network=awin"
Generate with custom tracking code
curl -X POST "https://app.hienergy.ai/api/v1/deeplinks/generate" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "url=https://www.example-merchant.com/sale" \
-d "network=awin" \
-d "custom_code=spring_campaign"
Parameters
Send parameters as form data or JSON in the POST request body.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The destination URL to generate an affiliate tracking link for. Must be a valid URL with a domain matching an advertiser in your catalog. |
network | string | No | Network slug — one of awin, avantlink, cj, connexity, flexoffers, impact, partnerize, pepperjam, skimlinks. When omitted, the API returns the discovery payload listing available networks for the URL. When supplied, the API generates a deeplink and verifies the URL belongs to that network. |
custom_code | string | No | Custom tracking code (clickref/sub-ID) to embed in the generated link. Maximum 50 characters. |
program_id | integer | No | Advertiser/program ID to generate against directly. When supplied, network detection is skipped and the program's network is used. Agency users may use programs that belong to publishers their agency manages. |
publisher_id | integer | No | Publisher to use for URL discovery and generation. Required for agency users who manage more than one publisher unless program_id is provided. |
Response Format
Generation success (200 OK)
Returned when network is supplied (or program_id):
{
"ok": true,
"deeplink": "https://www.awin1.com/cread.php?awinmid=12345&awinaffid=99999&ued=https%3A%2F%2Fwww.example-merchant.com%2Fproduct%2F123",
"network": "awin",
"advertiser_name": "Example Merchant"
}
| Field | Type | Description |
|---|---|---|
ok | boolean | Always true on success. |
deeplink | string | The generated affiliate tracking URL, ready to use. |
network | string | The affiliate network used (e.g. awin, cj, impact). |
advertiser_name | string | The matched advertiser's name. |
Discovery success (200 OK)
Returned when network is omitted — lists the supported networks the publisher can generate links for on this merchant:
{
"ok": true,
"domain": "example-merchant.com",
"advertiser_name": "Example Merchant",
"networks": [
{ "symbol": "awin", "name": "Awin", "advertiser_id": 123, "advertiser_name": "Example Merchant" },
{ "symbol": "cj", "name": "CJ", "advertiser_id": 456, "advertiser_name": "Example Merchant" }
]
}
| Field | Type | Description |
|---|---|---|
ok | boolean | Always true on success. |
domain | string | Bare domain extracted from the supplied URL. |
advertiser_name | string | Primary advertiser name matched for the domain. |
networks | array | Deduplicated list of supported networks. Each item has symbol, name, advertiser_id, and advertiser_name. Pass any symbol back as the network parameter to generate a link. |
Error Handling
All errors follow the standard Hi Energy API error format:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description"
}
}
| HTTP Status | Error Code | Description |
|---|---|---|
400 | MISSING_PARAMETER | The url parameter is missing or blank. |
400 | INVALID_URL | The url uses an unsupported scheme (only http and https are accepted). |
400 | PUBLISHER_REQUIRED | Your account manages multiple publishers with the Link Builder enabled. Resend with publisher_id. |
401 | UNAUTHORIZED | Missing or invalid API key. |
403 | FORBIDDEN | Link generator is not enabled for your account, or the requested publisher is outside the publishers you can generate for. |
404 | PROGRAM_NOT_FOUND | The supplied program_id does not exist or does not belong to a publisher you can access. |
422 | VALIDATION_ERROR | A parameter failed validation (e.g. custom_code exceeds 50 characters). |
422 | UNSUPPORTED_NETWORK | The supplied network is not a supported value, or the resolved program belongs to a network we cannot generate links for yet. |
422 | NETWORK_MISMATCH | The supplied network differs from the network detected from the URL. error.details includes both requested_network and detected_network. |
422 | GENERATION_FAILED | Could not generate a tracking link. Domain may be unrecognized, ignored (Amazon/eBay), or the network API call failed. |
429 | RATE_LIMITED | Rate limit exceeded. Check Retry-After header. |
Frequently Asked Questions
link_generator_enabled feature flag turned on, or admin access. Free users and publishers without the feature enabled receive a 403 Forbidden response — if you get a 403 and believe your account should have access, contact your account admin or support.custom_code parameter in your POST request body. This sets the clickref or sub-ID for the generated link, allowing you to track campaigns and sources. The custom code must be 50 characters or fewer.network parameter you pass back from the discovery response.POST /api/v1/deeplinks/generate with only the url parameter (omit network). The response includes domain, advertiser_name, and a deduplicated networks array. Pick the desired network's symbol and call the same endpoint again with network set to generate the link.NETWORK_MISMATCH is returned when the network you supplied does not match the network detected from the URL. The error.details object includes both requested_network and detected_network so you can re-issue the request with the correct value (or call the discovery flow first).