Get updated Sourcepoint script via API

To assist in meeting your integration needs, SourcePoint offers a server-side script API that returns the latest release of either our detection or recovery script.

The API supports delivering the script as an external unblocked resource, an inline script to be placed on page, or as plain javaScript to be bundled as part of your deployment process.

SourcePoint uses API keys to allow access to the API. You can register and expire your API keys through our Sourcepoint analytics dashboard.

Create an API key

Your organization needs an API key to use this service. In your organization's dashboard account click on the Account icon (top right corner) and select API Keys.

The following page is a list of active API keys created previously. Enter the name of your new API key in the box below the list. Click the Create Key button.

Delete an API key

Your organization can delete an existing API key by clicking on the Delete icon alongside the API key name & token.

When asked to confirm the deletion of the API key, click Delete.

Example code using API keys (with PHP)

Your organization can retrieve the latest release of the Sourcepoint detection script with the API key and server side code. The following code in PHP is an example of how this can be done using CURL:

$api_endpoint = "https://api.sourcepoint.com/script/detection?delivery=script/";
$handle = curl_init($api_endpoint);
$fileHandle = fopen("api_script_sp", "w");
/* If you encounter an 'SSL certificate problem: unable to get local issuer certificate' then enable the following two lines */
/* This is NOT recommended as a solution and should only be used as a quick and temporary fix */
//curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 0);
//curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
$api_key = "Authorization: Token token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
curl_setopt($handle, CURLOPT_HTTPHEADER, [$api_key]);
curl_setopt($handle, CURLOPT_FILE, $fileHandle);
curl_exec($handle);
curl_close($handle);
fclose($fileHandle);

The example above connects to the Sourcepoint servers using the API key created in the previous step. The code retrieves the latest version of the detection script and save to a file api_script_sp. Your organization can choose if the response from Sourcepoint is saved to file or implemented into the webpage.

The API key must be sent in following way:

Authorization: Token token={__YOUR_API_KEY__}

Your API key replaces the placeholder {__YOUR_API_KEY__}

Get script options

Your organization can decide how the latest version of the detection script is delivered from Sourcepoint servers. Sourcepoint offers three options with a different endpoint for each:

Script delivery
Inline delivery
Bundle delivery
Script delivery

This option returns the latest unblocked script assets to be placed as a tag on the page, pointing to an external resource.

<script async="async" data-client-id="sourcepoint" type="text/javascript" src="//d1xfq2052q7thw.cloudfront.net/2.0.1199.js"></script>

The API endpoint for this option is this URL:

https://api.sourcepoint.com/script/detection?delivery=script/
Inline delivery

This option returns the latest release of the detection script to be placed as inline code on the page, eliminating the external resource which could become blocked.

<script async="async" data-client-id="sourcepoint" type="text/javascript">!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=472)}([function(e,t,n){var r,o;!function(i){"use strict";var u={};u.VERSION="1.3.0";var a,c={},f=function(e,t){return function() ... </script>

The API endpoint for this option is this URL:

https://api.sourcepoint.com/script/detection?delivery=inline/
Bundle delivery

This option returns the latest detection release as javascript to be bundled with other javascript assets as part of your deployment process.

!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"]}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=472)}([function(e,t,n){var r,o;!function(i){"use strict";var u={};u.VERSION="1.3.0";var a,c={},f=function(e,t){return function() ...

The API endpoint for this option is this URL:

https://api.sourcepoint.com/script/detection?delivery=bundle/