Skip to content

Affiliates endpoints ​

These REST routes manage affiliate partners and report on the clicks their short links receive. Each entry lists the permission, parameters, the response fields and the errors.

Sign-in, the response envelope and paging are explained in the REST API overview.

All paths are relative to the base URL /wp-json/link-manager-pro/v1. Every route here needs link_manager_pro_access. The examples use https://example.com and the Application Password placeholder USER:APPLICATION_PASSWORD.

A partner owns no short links directly. A short link counts for a partner when its destination is on the partner's domain. The comparison ignores letter case and a leading www., and the hidden links behind redirects never count.

When Affiliate link prefix is set, a short link to a partner's domain gets its address under that prefix, for example https://example.com/recommends/amazon-deal. Creating, changing or deleting a partner changes which links use it. See General settings.

A missing partner ID gives this 404 on every route with {id}:

json
{
  "code": "not_found",
  "message": "The requested resource was not found.",
  "data": { "status": 404 }
}

The affiliate object ​

List affiliates returns the stored fields plus extra counts. Create an affiliate and Update an affiliate return the stored fields under data.affiliate. The table is the link_manager_pro_affiliates table (Database tables).

FieldTypeWhat it holds
idintegerThe partner ID.
site_namestringThe partner's name, up to 100 characters.
domainstringThe host of affiliate_link without a leading www.. Read from the link on every save.
affiliate_linkstringThe full http or https URL. The plugin adds its query string or path to links to this domain.
keywordsarray of strings, or nullThe auto-linking keywords. null when none was ever saved. The create response leaves the field out.
enable_autolinkbooleanWhether auto-linking uses this partner.
autolink_priorityinteger0 to 100. Default 10.
attributesobject, or nullThe rel flags for links to this partner: nofollow, sponsored, ugc, noopener, noreferrer. Each value is 1 or 0.
utm_paramsobject, or nullThe UTM values the plugin adds. Any of utm_source, utm_medium, utm_campaign, utm_term, utm_content. null when none is set.
redirect_typeinteger301, 302 or 307. Default 301.
click_countintegerA stored counter column. Default 0. It counts clicks on short links to the domain, never Simple Redirect hits, and a backup restore recomputes it the same way. The create response leaves it out.
created_atstringWhen the partner was created, as Y-m-d\TH:i:s.v.
updated_atstringWhen the partner was last saved, in the same format.

Rows in the list also carry these fields:

FieldTypeWhat it holds
_autolink_termsarray of integersThe WordPress term IDs that limit where auto-linking applies. Empty means everywhere.
link_countintegerShort links whose destination is on the partner's domain.
clicksintegerAll recorded clicks on those links.
unique_clicksintegerThe unique clicks among them.
keyword_countintegerThe number of keywords.
autolinkbooleanThe same value as enable_autolink.
tagstringThe part the plugin adds for the partner: the query string with a leading ?, or else the path. An empty string for a bare domain, or when the URL ends in ? with no query.

Affiliates ​

List affiliates ​

GET /affiliates

Returns one page of affiliates with their link and click counts, plus totals for the auto-link filter.

Permission: link_manager_pro_access (Permissions)

Query parameters:

NameTypeRequiredDefaultWhat it does
searchstringNononeMatches part of the site name, domain, affiliate link or a keyword.
autolinkstringNononeon or off shows only partners with auto-linking on or off. Any other value is ignored.
pageintegerNo1The page number.
per_pageintegerNo15Partners per page.

Response: 200. data is a page object (Pagination) with one extra field.

FieldTypeWhat it holds
dataarrayThe partners, each as in the affiliate object, with the list fields.
countsobjectall, on and off: partner counts after search and before autolink.
import_path_tagsobjectPartners an import tagged with a path instead of a query tag. count (integer) is how many domains, and domains (array of strings) names at most 5 of them.

There is no sort parameter, and the code sets no order.

bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates?autolink=on"
json
{
  "success": true,
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 3,
        "site_name": "Example Shop",
        "domain": "shop.example.com",
        "affiliate_link": "https://shop.example.com/?tag=mysite-20",
        "keywords": ["blue widget"],
        "enable_autolink": true,
        "autolink_priority": 10,
        "attributes": { "nofollow": 1, "sponsored": 1 },
        "utm_params": null,
        "redirect_type": 301,
        "click_count": 0,
        "created_at": "2026-10-01T09:00:00.000",
        "updated_at": "2026-10-01T09:00:00.000",
        "_autolink_terms": [],
        "link_count": 4,
        "clicks": 57,
        "unique_clicks": 44,
        "keyword_count": 1,
        "autolink": true,
        "tag": "?tag=mysite-20"
      }
    ],
    "first_page_url": "/wp-json/link-manager-pro/v1/affiliates?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "/wp-json/link-manager-pro/v1/affiliates?page=1",
    "links": [
      { "url": null, "label": "Previous", "active": false },
      { "url": "/wp-json/link-manager-pro/v1/affiliates?page=1", "label": 1, "active": true },
      { "url": null, "label": "Next", "active": false }
    ],
    "next_page_url": null,
    "path": "/wp-json/link-manager-pro/v1/affiliates",
    "per_page": 15,
    "prev_page_url": null,
    "to": 1,
    "total": 1,
    "counts": { "all": 1, "on": 1, "off": 0 },
    "import_path_tags": { "count": 0, "domains": [] }
  }
}

Errors: None beyond the overview's sign-in and permission errors.

Create an affiliate ​

POST /affiliates

Creates an affiliate partner. The plugin reads the domain from affiliate_link and makes sure a short link for that URL exists.

Permission: link_manager_pro_access (Permissions)

Body parameters: JSON.

NameTypeRequiredDefaultWhat it does
site_namestringYesnoneThe partner's name. 100 characters or fewer.
affiliate_linkstringYesnoneA full http or https URL with a host, 2048 bytes or fewer. It sets the domain and the tag the plugin adds.
enable_autolinkstringYesnoneyes or no. Stored as a boolean.
attributesobjectYesnoneAt least one key. Each value is yes or no. Only nofollow, sponsored, ugc, noopener and noreferrer are kept. Stored as 1 or 0.
redirect_typeintegerYesnone301, 302 or 307.
keywordsarray or stringNononeAn array, or a comma-separated string. Duplicates are removed, ignoring case. The first spelling stays.
autolink_priorityintegerNo100 to 100. A number outside the range is a 422 on this field.
utm_paramsobjectNononeAny of utm_source, utm_medium, utm_campaign, utm_term, utm_content. Each 200 characters or fewer. Empty values are dropped.
autolink_termsarray of integersNononeWordPress term IDs that limit where auto-linking applies. An empty array removes the limit. Without the field, the stored terms stay.

Response: 200, with message set to "Affiliate created." data holds:

FieldTypeWhat it holds
affiliateobjectThe stored fields from the affiliate object. It has no click_count, and no keywords when the request sent none.
bash
curl -X POST -u USER:APPLICATION_PASSWORD \
  -H "Content-Type: application/json" \
  -d '{
    "site_name": "Example Shop",
    "affiliate_link": "https://shop.example.com/?tag=mysite-20",
    "enable_autolink": "yes",
    "attributes": { "nofollow": "yes", "sponsored": "yes" },
    "redirect_type": 301,
    "keywords": ["blue widget"]
  }' \
  https://example.com/wp-json/link-manager-pro/v1/affiliates
json
{
  "success": true,
  "data": {
    "affiliate": {
      "site_name": "Example Shop",
      "affiliate_link": "https://shop.example.com/?tag=mysite-20",
      "enable_autolink": true,
      "attributes": { "nofollow": 1, "sponsored": 1 },
      "redirect_type": 301,
      "autolink_priority": 10,
      "utm_params": null,
      "keywords": ["blue widget"],
      "domain": "shop.example.com",
      "updated_at": "2026-10-23T09:20:00.000",
      "created_at": "2026-10-23T09:20:00.000",
      "id": 3
    }
  },
  "message": "Affiliate created."
}

Errors:

StatusWhen
422errors.affiliate_link: the URL is not a full http or https URL with a host ("Enter a full URL, starting with https://"), or its domain already has a partner ("shop.example.com is already an affiliate (Example Shop). Edit that affiliate instead.").
422errors.site_name, errors.enable_autolink, errors.attributes or errors.redirect_type: the field is missing or has a value outside the rules above.
422errors.autolink_priority: not a number from 0 to 100.
422site_name or a utm_params.* value is longer than its limit.

Update an affiliate ​

PUT /affiliates/{id}

Saves a partner and returns it. The body needs the same required fields as create.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Body parameters: JSON. The same fields as Create an affiliate, with three differences. A missing keywords leaves the stored keywords as they are. A missing utm_params clears them. A missing autolink_priority becomes 10. A new affiliate_link on another domain changes the domain.

Response: 200, with message set to "Affiliate saved." data.affiliate holds every stored field of the affiliate object, including click_count.

bash
curl -X PUT -u USER:APPLICATION_PASSWORD \
  -H "Content-Type: application/json" \
  -d '{
    "site_name": "Example Shop",
    "affiliate_link": "https://shop.example.com/?tag=mysite-21",
    "enable_autolink": "yes",
    "attributes": { "nofollow": "yes", "sponsored": "yes" },
    "redirect_type": 302
  }' \
  https://example.com/wp-json/link-manager-pro/v1/affiliates/3
json
{
  "success": true,
  "data": {
    "affiliate": {
      "id": 3,
      "site_name": "Example Shop",
      "domain": "shop.example.com",
      "affiliate_link": "https://shop.example.com/?tag=mysite-21",
      "keywords": ["blue widget"],
      "enable_autolink": true,
      "autolink_priority": 10,
      "attributes": { "nofollow": 1, "sponsored": 1 },
      "utm_params": null,
      "redirect_type": 302,
      "click_count": 0,
      "created_at": "2026-10-01T09:00:00.000",
      "updated_at": "2026-10-23T09:25:00.000"
    }
  },
  "message": "Affiliate saved."
}

Errors:

StatusWhen
404No partner has that ID.
422The same field errors as create. A domain counts as taken only when another partner holds it.

Delete an affiliate ​

DELETE /affiliates/{id}

Deletes the partner and its auto-link targeting. Short links to that domain stay.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Response: 200, with message set to "Affiliate deleted." data is null.

bash
curl -X DELETE -u USER:APPLICATION_PASSWORD \
  https://example.com/wp-json/link-manager-pro/v1/affiliates/3
json
{
  "success": true,
  "data": null,
  "message": "Affiliate deleted."
}

Errors:

StatusWhen
404No partner has that ID.

Affiliate reports ​

The report routes read recorded clicks on the partner's short links. Dates are site-time days written as Y-m-d. A value that is not a real date counts as missing.

Get an affiliate report ​

GET /affiliates/{id}/report

Returns click totals, breakdowns and the 20 newest clicks for one partner, plus the partner's settings and auto-link status.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
startstringNononeFirst day, Y-m-d. Without it the range has no start.
endstringNononeLast day, Y-m-d. The whole day counts. Without it the range has no end.

With neither parameter, the report covers all clicks. The plugin may serve a saved copy of the click part for a short time, so new clicks can take a moment to show.

Response: 200. data holds:

FieldTypeWhat it holds
entityobjecttype ("affiliate"), id (integer), name (the site name), domain and url (the affiliate link).
summaryobjectclicks, unique_clicks and qualified_clicks (integers), conversion_label (the string "Qualified Clicks"), first_click_at and last_click_at (UTC Y-m-d H:i:s strings, null before the first click). Qualified clicks come from a post on this site.
breakdownsobjectClick counts by group, described in the next table.
recentarrayThe 20 newest clicks in the range, each a click row.
metaobjectmatched_links: the number of short links counted for this partner.
partnerobjectThe partner's settings, as the next table shows.
link_countintegerShort links counted for this partner.
last_click_atstring or nullThe newest click of all time, UTC. Ignores start and end.
autolinkobjectHow much auto-linking sends, as the table below shows.
posts_countintegerThe number of different posts that sent a click, all time.
trackingobjectThe tracking flags, as the table below shows.

breakdowns holds these keys. Every list is sorted by count, highest first.

KeyTypeWhat it holds
device, os, browser, country, referrerarrayRows of label (string) and count (integer). At most 10 rows for country and referrer. An unknown country is Unknown, and no referrer is Direct.
utmobjectsource, medium and campaign: top 10 rows of label and count. totals holds the full tagged-click count for each.
sourceobjectcontent, site (another page of this site), referral and direct: counts that add up to all clicks.
postsarrayTop 10 posts: post_id, label (the title, or Post #id) and count.
sitesarrayTop 10 referrer domains for clicks that did not come from a post. This site's own host is left out.

partner holds:

FieldTypeWhat it holds
id, site_name, domain, affiliate_linkinteger, stringThe same values as the affiliate object.
tagstringThe added query string or path, as in the list rows.
created_atstring or nullCreation time, UTC Y-m-d H:i:s.
redirect_type, autolink_priorityintegerAs in the affiliate object.
enable_autolinkbooleanAs in the affiliate object.
attributes, utm_paramsobjectThe saved values. An empty object {} when none.
keywordsarray of stringsThe cleaned keyword list.
categoriesarray{ "id": 4, "name": "Tech" } for each targeted term that still exists. Both categories and tags appear.

autolink holds:

FieldTypeWhat it holds
short_link_idinteger or nullThe short link for the affiliate link URL, the one auto-linking uses. null when none exists.
clicksintegerAll-time clicks on that link.
shareinteger or nullThe percentage of all-time partner clicks that came through it, rounded. null with no clicks.
readybooleantrue when auto-linking is on, the partner has keywords and the short link exists.

tracking holds:

FieldTypeWhat it holds
tracking_enabledbooleanWhether click tracking is on.
retention_daysintegerDays clicks are kept. 0 keeps them all.
autolink_site_enabledbooleanWhether auto-linking is on for the site.
history_trustedbooleanWhether the last 90 days of clicks were fully recorded.
history_reasonstringWhy not: tracking_off, retention_short, tracking_resumed, retention_changed, clicks_restored or gap. An empty string when trusted.
bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/report?start=2026-10-01&end=2026-10-23"
json
{
  "success": true,
  "data": {
    "entity": {
      "type": "affiliate",
      "id": 3,
      "name": "Example Shop",
      "domain": "shop.example.com",
      "url": "https://shop.example.com/?tag=mysite-20"
    },
    "summary": {
      "clicks": 57,
      "unique_clicks": 44,
      "qualified_clicks": 30,
      "conversion_label": "Qualified Clicks",
      "first_click_at": "2026-10-02 07:11:40",
      "last_click_at": "2026-10-22 18:03:09"
    },
    "breakdowns": {
      "device": [{ "label": "Desktop", "count": 40 }],
      "os": [{ "label": "Windows", "count": 22 }],
      "browser": [{ "label": "Chrome", "count": 35 }],
      "country": [{ "label": "US", "count": 31 }],
      "referrer": [{ "label": "Direct", "count": 20 }],
      "utm": {
        "source": [{ "label": "newsletter", "count": 12 }],
        "medium": [],
        "campaign": [],
        "totals": { "source": 12, "medium": 0, "campaign": 0 }
      },
      "source": { "content": 30, "site": 2, "referral": 5, "direct": 20 },
      "posts": [{ "post_id": 18, "label": "Best widgets", "count": 21 }],
      "sites": [{ "label": "news.example.org", "count": 5 }]
    },
    "recent": [
      {
        "clicked_at": "2026-10-22 18:03:09",
        "is_unique": true,
        "post_id": 18,
        "device": "Desktop",
        "os": "Windows",
        "referrer_domain": null,
        "referrer_url": null,
        "browser": "Chrome",
        "country_code": "US",
        "post_title": "Best widgets"
      }
    ],
    "meta": { "matched_links": 4 },
    "partner": {
      "id": 3,
      "site_name": "Example Shop",
      "domain": "shop.example.com",
      "tag": "?tag=mysite-20",
      "affiliate_link": "https://shop.example.com/?tag=mysite-20",
      "created_at": "2026-10-01 09:00:00",
      "redirect_type": 301,
      "attributes": { "nofollow": 1, "sponsored": 1 },
      "utm_params": {},
      "enable_autolink": true,
      "autolink_priority": 10,
      "keywords": ["blue widget"],
      "categories": [{ "id": 4, "name": "Tech" }]
    },
    "link_count": 4,
    "last_click_at": "2026-10-22 18:03:09",
    "autolink": { "short_link_id": 61, "clicks": 25, "share": 44, "ready": true },
    "posts_count": 6,
    "tracking": {
      "tracking_enabled": true,
      "retention_days": 0,
      "autolink_site_enabled": true,
      "history_trusted": true,
      "history_reason": ""
    }
  }
}

Errors:

StatusWhen
404No partner has that ID.

Click rows ​

A click row appears in recent of the report and in the rows of Get recent affiliate clicks.

FieldTypeWhat it holds
clicked_atstringWhen the click happened, UTC.
is_uniquebooleanWhether it counted as a unique click.
post_idintegerThe post the click came from. 0 when none.
device, os, browserstringRead from the visitor's user agent.
referrer_domainstring or nullThe referring host.
referrer_urlstring or nullThe referring page.
country_codestring or nullA two-letter country code.
post_titlestring or nullThe post's title, or Post #id. null when post_id is 0.

Get recent affiliate clicks ​

GET /affiliates/{id}/report/recent

Returns one page of the partner's clicks, newest first, for a "recent activity" list.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
pageintegerNo1The page number.
per_pageintegerNo10Clicks per page. A value below 1 counts as 1, and a value above 100 counts as 100.

Response: 200. data is a page object (Pagination). data.data holds click rows, ordered by clicked_at, newest first.

bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/report/recent?per_page=10"
json
{
  "success": true,
  "data": {
    "current_page": 1,
    "data": [
      {
        "clicked_at": "2026-10-22 18:03:09",
        "is_unique": true,
        "post_id": 18,
        "device": "Desktop",
        "os": "Windows",
        "referrer_domain": null,
        "referrer_url": null,
        "browser": "Chrome",
        "country_code": "US",
        "post_title": "Best widgets"
      }
    ],
    "from": 1,
    "last_page": 6,
    "per_page": 10,
    "to": 10,
    "total": 57
  }
}

The page object also holds the link fields shown under Pagination. The example leaves them out.

Errors:

StatusWhen
404No partner has that ID.

Export an affiliate report as CSV ​

GET /affiliates/{id}/report/export

Downloads every recorded click on the partner's short links as a CSV file, newest first. It is the "Download CSV" action of the partner report.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
startstringNononeFirst day, Y-m-d in site time. Without it the export has no start.
endstringNononeLast day, Y-m-d. The whole day counts. Without it the export has no end.

Response: 200. The body is CSV, not JSON, with no envelope. The headers are:

HeaderValue
Content-Typetext/csv; charset=utf-8
Content-Dispositionattachment; filename="link-manager-pro-report-{domain}-{Y-m-d}.csv". The date is today in site time.
Cache-Controlno-cache, no-store, must-revalidate

The first row is a header row. Each later row is one click. The file has these columns, in this order:

ColumnWhat it holds
Clicked AtThe click time in site time, Y-m-d H:i:s.
Link SlugThe slug of the short link that was clicked.
Target URLThe destination recorded for the click.
CountryA two-letter country code, or empty.
Referrer DomainThe referring host, or empty.
Referrer URLThe referring page, or empty.
DeviceDesktop, mobile or another device type, from the user agent.
OSThe operating system family.
BrowserThe browser family.
Uniqueyes or no.
Post IDThe post the click came from, or empty.
UTM Source, UTM Medium, UTM Campaign, UTM Term, UTM ContentThe UTM values recorded for the click, or empty.

A cell that starts with =, +, -, @, a tab or a carriage return gets a leading single quote, so a spreadsheet does not run it as a formula.

bash
curl -u USER:APPLICATION_PASSWORD -o report.csv \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/report/export?start=2026-10-01&end=2026-10-23"
text
Clicked At,"Link Slug","Target URL",Country,"Referrer Domain","Referrer URL",Device,OS,Browser,Unique,"Post ID","UTM Source","UTM Medium","UTM Campaign","UTM Term","UTM Content"
"2026-10-22 18:03:09",blue-widget,"https://shop.example.com/?tag=mysite-20",US,,,Desktop,Windows,Chrome,yes,18,newsletter,,,,

Errors:

StatusWhen
404No partner has that ID. The body is the JSON not_found error.

Get affiliate clicks over time ​

GET /affiliates/{id}/clicks

Returns one row per day with the total and unique clicks on the partner's short links, for a chart.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
startstringNosee belowFirst day, Y-m-d in site time.
endstringNotodayLast day, Y-m-d. Never later than today.

With neither parameter, the range runs from the earlier of the partner's creation day and its first click, up to today. With only end, it covers the 30 days ending on that day. A reversed range is swapped. A range is capped at 7305 days. Every day has a row, with zeros when there were no clicks.

Response: 200. data is an array of days:

FieldTypeWhat it holds
datestringThe day, Y-m-d, in site time.
totalintegerClicks that day.
uniqueintegerUnique clicks that day.
bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/clicks?start=2026-10-21&end=2026-10-23"
json
{
  "success": true,
  "data": [
    { "date": "2026-10-21", "total": 4, "unique": 3 },
    { "date": "2026-10-22", "total": 9, "unique": 7 },
    { "date": "2026-10-23", "total": 0, "unique": 0 }
  ]
}

Errors:

StatusWhen
404No partner has that ID.

List posts sending affiliate clicks ​

GET /affiliates/{id}/posts

Returns one page of the posts whose content sent clicks to the partner, most clicks first, all time.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
pageintegerNo1The page number. A value below 1 counts as 1.
per_pageintegerNo10Posts per page. Kept between 1 and 100.

Response: 200. data is a small page object, not the standard one:

FieldTypeWhat it holds
dataarrayThe posts, as the next table shows.
totalintegerThe number of different posts.
current_pageintegerThe page returned.
per_pageintegerThe page size used.
last_pageintegerThe last page number. At least 1.

Each post row holds:

FieldTypeWhat it holds
post_idintegerThe post ID.
titlestringThe post title, Post #id when it has none, or (deleted post) when the post is gone.
urlstring or nullThe post's permalink. null when the post is gone.
categoriesarray of stringsUp to two category names.
clicksintegerAll clicks from that post to the partner.
auto_clicksintegerClicks through the partner's auto-link short link.
manual_clicksintegerThe other clicks: clicks minus auto_clicks.
auto_linksinteger1 when the post sent clicks through the auto-link short link, else 0.
manual_linksintegerThe number of other short links the post sent clicks through.
bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/posts?per_page=10"
json
{
  "success": true,
  "data": {
    "data": [
      {
        "post_id": 18,
        "title": "Best widgets",
        "url": "https://example.com/best-widgets/",
        "categories": ["Reviews"],
        "clicks": 21,
        "auto_clicks": 15,
        "manual_clicks": 6,
        "auto_links": 1,
        "manual_links": 1
      }
    ],
    "total": 6,
    "current_page": 1,
    "per_page": 10,
    "last_page": 1
  }
}

Errors:

StatusWhen
404No partner has that ID.

Get affiliate keywords ​

GET /affiliates/{id}/keywords

Returns the partner's auto-linking keywords with the number of published posts that contain each one, and whether auto-linking is ready.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters: None.

Response: 200. data holds:

FieldTypeWhat it holds
enabledbooleanWhether auto-linking is on for this partner.
site_enabledbooleanWhether auto-linking is on for the whole site.
priorityintegerThe partner's auto-link priority.
max_per_keywordintegerThe site setting for links per keyword in a post. At least 1.
keywordsarrayOne row per keyword: keyword (string) and posts (integer, or null).
categoriesarray of stringsThe names of the targeted categories and tags. Empty means everywhere.
readybooleantrue when reason is empty.
reasonstringWhy keywords are not linking: off, no_keywords, site_off or no_short_link. An empty string when ready.

posts counts published posts of the auto-linked post types that contain the keyword as a whole word, with tags stripped. On a very large site (over 1,000 candidate posts for a keyword, or over 5,000 posts read in one count) it falls back to a plain text-contains count. It is "found in", not "linked in". Only the first 50 keywords are counted, and later ones have posts set to null. The counts are saved for an hour, and a save of the partner clears them.

bash
curl -u USER:APPLICATION_PASSWORD \
  https://example.com/wp-json/link-manager-pro/v1/affiliates/3/keywords
json
{
  "success": true,
  "data": {
    "enabled": true,
    "site_enabled": true,
    "priority": 10,
    "max_per_keyword": 1,
    "keywords": [{ "keyword": "blue widget", "posts": 12 }],
    "categories": ["Tech"],
    "ready": true,
    "reason": ""
  }
}

Errors:

StatusWhen
404No partner has that ID.

GET /affiliates/{id}/links

Returns one page of the short links counted for the partner, most recorded clicks first.

Permission: link_manager_pro_access (Permissions)

Path parameters:

NameTypeWhat it is
idintegerThe partner ID.

Query parameters:

NameTypeRequiredDefaultWhat it does
pageintegerNo1The page number. A value below 1 counts as 1.
per_pageintegerNo10Links per page. Kept between 1 and 100.

Response: 200. data is the same small page object as in List posts sending affiliate clicks. data.data holds:

FieldTypeWhat it holds
idintegerThe short link ID.
slugstringThe slug.
short_urlstringThe public address of the link. When Affiliate link prefix is set, it uses that prefix, because the destination is on the partner's domain.
target_urlstringThe destination, on the partner's domain.
clicksintegerRecorded clicks on the link. These add up to the partner's clicks.
click_countintegerThe link's own lifetime counter.
made_bystringautolink for the short link that auto-linking uses, otherwise manual.

With no matching links, data.data is empty, total is 0 and last_page is 1.

bash
curl -u USER:APPLICATION_PASSWORD \
  "https://example.com/wp-json/link-manager-pro/v1/affiliates/3/links?per_page=10"
json
{
  "success": true,
  "data": {
    "data": [
      {
        "id": 61,
        "slug": "example-shop",
        "short_url": "https://example.com/link/example-shop",
        "target_url": "https://shop.example.com/?tag=mysite-20",
        "clicks": 25,
        "click_count": 25,
        "made_by": "autolink"
      }
    ],
    "total": 4,
    "current_page": 1,
    "per_page": 10,
    "last_page": 1
  }
}

Errors:

StatusWhen
404No partner has that ID.