• Home
  • Features  
  • Integrations
  • Pricing
  • Demo

Content API

Important: Please only attempt to use the API with the support of a developer, who will help you avoid causing issues with your site due to custom code.

Available endpoints:

POST /v1/content/publish

You can trigger a site scan and link import using the /v1/content/publish endpoint.

As long as you have auto-import enabled, this will cause our system to crawl your newly published post for links and import them immediately for tracking.

Sample request

You'll tell the API which new post or page to crawl for affiliate links.

curl \    
     -X POST  
     -H "Authorization: Bearer YOUR_SECRET_API_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{ "url": "" }' \

Sample integration with WordPress

If you wanted to trigger a link import on every post update, here's how that could work.

function am_trigger_link_import($post_ID, $post, $update) {
     // Present because Gutenberg fires this hook twice, due to
     // backwards compatibility with the meta box loader
     if (!empty( $_REQUEST['meta-box-loader'])) {
     $apiToken = 'YOUR_API_TOKEN_HERE';
     $url = '';
     $body = [
          'url' => get_permalink($post->ID)
     $headers = array(
          'Authorization:Bearer ' . $apiToken,
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body));
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
add_action('wp_insert_post',  'am_trigger_link_import', 10, 3);

Available parameters

You can provide the following parameters:

  • url - Provide the full URL of the newly published or updated page/post on a website that is currently verified and active in your account.

Sample response

You'll get a 200 status code and a URL of the scan where you can watch the progress of the scan and import.

{ "scanUrl": "" }

Potential error states

Errors will return a JSON response including an error code as the field error and optionally a more detailed message under details, for example:

{ "error": "WRONG_METHOD", details: "Use POST method to make this request" }

Potential error codes include:

  • 401 NOT_AUTHORIZED – You did not provide a valid API token or provided it incorrectly.
  • 400 WRONG_METHOD – You tried to use a method for this endpoint other than POST.
  • 400 WRONG_CONTENT_TYPE – You failed to specify the Content-Type header as application/json.
  • 400 NO_URL_GIVEN – You forgot to provide, or provided incorrectly, a request body containing a valid URL.
  • 500 API_ERROR – A unknown error occurred while processing your request.

Have questions? Contact us at anytime.

Last Updated 11/22/2022

Related articles

Try the affiliate analytics platform for content websites

Affilimate aggregates all your affiliate commissions in one place, and then adds the missing attribution data you need to maximize your affiliate revenue from every post you publish.

Create your dashboard   Get a demo

 Free 15-day trial   No credit card required

Affilimate Analytics App

Hey, I'm Monica.

I'm the co-founder of Affilimate.

Once per month, I send insider tips and strategies for affiliates in this newsletter.

It's short, practical, and original. Try it out:

No spam, unsubscribe anytime.

AffilimateBy Adaero Software