Developer Guide

Age Verification API - integrate real-time UK age and identity verification directly into your application or workflow.

Before you start:
  1. Create an Age Verify UK account.
  2. Get your API key from your dashboard.

API endpoint

https://ageverifyuk.com/rest/rest.aspx
Your API key must be kept private and never included in client-side web pages. Use a javascript_key instead (see supplementary documentation). Set api_key to sandbox or test for development mode.

Choose a method

Select a verification method to view its full documentation.

age_verification

Data Matching

Verify a user-provided name and address against trusted sources like the Electoral Roll. Returns a real-time pass/fail result.

View documentation →
age_verification_bulk

Bulk Data Matching

Upload a CSV of names and addresses for batch verification. Process thousands of records asynchronously against our UK dataset.

View documentation →

Data Matching Pricing

Method: age_verification

Introduction

The method allows the validation of any UK person when a surname, forename, postcode and first line of address are all supplied. Your supplied data will be used to find a match within our vast UK dataset.

JSON/XML Output

Our API responds in XML format by default. Simply set the output parameter to 'json' to receive a JSON response (typically used in javascript/ajax solutions).

Example Live URL (outputted as JSON):

https://ageverifyuk.com/rest/rest.aspx?method=age_verification&api_key=[YOUR API KEY]&output=json&surname=[USER_INPUT]&forename=[USER_INPUT]&postcode=[USER_INPUT]&addr1=[USER_INPUT]

Example Development URL (outputted as JSON):

https://ageverifyuk.com/rest/rest.aspx?method=age_verification&api_key=sandbox&output=json&surname=[USER_INPUT]&forename=[USER_INPUT]&postcode=[USER_INPUT]&addr1=[USER_INPUT]

Code Examples & Parameters

The following code example uses an AJAX javascript request with the javascript_key and user supplied name and address to do a single verification. Please view the supplementary documentation for instructions on getting a javascript_key.

A single verification using a javascript_key

Make a request to get_js_key.php in your AJAX call to get a javascript key. Then use that key to call the single verfication method.

AJAX/JavaSript example of single verification (using javascript_key)

			
var surname = $("#surname");
var forename = $("#forename");
var postcode = $("#postcode");
var addr1 = $("#addr1");

$.ajax({
	url: 'get_js_key.php', //get_js_key.php created below
	dataType: 'json',
	success: function (result) {       
			
		if (result.status)
		{       
			$.ajax({
				url: 'https://ageverifyuk.com/rest/rest.aspx',
				dataType: 'json',
				data: {
					'method'   : "age_verification",
					'javascript_key'  : result.javascript_key,
					'domain' : "[YOUR WEBSITE DOMAIN]", //e.g. example.com
					'surname' : surname.val(),
					'forename' : forename.val(),
					'postcode' : postcode.val(),
					'addr1' : addr1.val(),
					'check_under_18' : 'true',
					'output'   : 'json'
				},
				success: function(result){
					if(result.validation_status == "NOT_FOUND") {
						$('#results-output').append('

'+forename.val()+' '+surname.val()+' was not found at the specificed address') }; if(result.validation_status == "FOUND_UNDER_18") { $('#results-output').append('

'+forename.val()+' '+surname.val()+' was found at the specified address, but we cannot confirm they are over 18') }; if(result.validation_status == "FOUND") { $('#results-output').append('

'+forename.val()+' '+surname.val()+' was found at the specified address and is over 18') }; } }); } } });

Example of Returned JSON when invoking 'age_verification'

{"validation_status":"FOUND","match_code_forename":"FULL","match_code_surname":"FULL","match_code_address":"PARTIAL","mode":"sandbox","status":"ok","api_version":"1.0.0.4","transaction_id":"aBcDeF123456"}
	

Note: although we use the most up to date data available it is possible that if a person has recently moved house they may not yet appear in the data. We recommend that an option is provided to allow people to attempt to verify their name at a previous address if we cannot verify them.

Bulk Age Verification of a CSV Pricing

Method: age_verification_bulk

Introduction

The age_verification_bulk method is a multi step asynchronous process that allows you to:

  1. Create a job
  2. Upload your data - a CSV containing a name, address and postcode
  3. Start it processing and,
  4. Download the results once it has completed.

For each stage in the process the first part of the API URL will remain the same but the command parameter must be changed depending on what part of the process you are in.

Example Live URL (bulk check):

https://ageverifyuk.com/rest/rest.aspx?method=age_verification_bulk&api_key=[YOUR API KEY]&command=[create|upload|start|progress|results|finalise]

This method allows for the verification of a list of UK persons, in a CSV containing at least these columns:

  • Forename
  • Surname
  • Address Line 1
  • Postcode

AgeVerifyUK will add a single RESULT column to the supplied CSV indicating the result of the check.

Result Column Values

Result Code Explanation
FOUND_OVER_18 The person has been verified
FOUND_UNDER_18 The person has been found but not verified as 18 or over.
NOT_FOUND The person was not found in our data
INVALID_POSTCODE The supplied postcode was invalid
INVALID_ADDRESS The supplied address was invalid
INSUFFICIENT_DATA There was insufficient information to be able to validate the person

If you receive a NOT_FOUND response you could try a previous address, if you have one available. Our data contains current and previous addresses for UK people.

Steps required


1. Create a new job

Create a job (also known as a transaction) and use the transaction_id returned to proceed with the bulk process.

Example PHP code:

			
function create_job() {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
	. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=create';




	$result = simplexml_load_file($url);


	if($result->transaction_id) { //need this transaction_id for the other commands

		return $result;
	}

	return FALSE;	
	
}
		
		

Example XML Response

<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>			
	<transaction_id>aBcDeF123456</transaction_id>
</age_verification_bulk_res> 

2. Upload a CSV and specify columns

In this part of the process we set the command to 'upload' and use the transaction_id from step 1 above to POST your CSV to the AgeVerifyUK API. You also need to specify the zero based numerical index of what each column contains e.g. forename is in column 0, surname is in column 1 etc.

Example PHP code:

	
function set_columns($data, $forename, $surname, $addr1, $postcode, $type, $headers, $transaction_id, $fullname, $fulladdr) {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
	. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=upload'
	. '&forename_column=' . $forename
	. '&surname_column=' . $surname
	. '&address1_column=' . $addr1
	. '&postcode_column=' . $postcode
	. '&fullname_column=' . $fullname
	. '&fulladdr_column=' . $fulladdr		
	. '&is_first_line_headers=' . $headers 
	. '&transaction_id=' . $transaction_id; //you get this is from create_job() above
	
	
	//we will POST the csv data

	$tch = curl_init();
	curl_setopt($tch, CURLOPT_URL, $url);
	
	// build $mypost using http_build_query
	
	
	$mypost_src = array(
		'csv' => $data
	);
	
	
	$mypost = http_build_query($mypost_src);		
	
	//configure curl to do an HTTP POST
	
	curl_setopt($tch, CURLOPT_POST, true);	        
		curl_setopt($tch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($tch, CURLOPT_SSL_VERIFYPEER, false);
		curl_setopt($tch, CURLOPT_POSTFIELDS, $mypost);

	curl_setopt($tch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));


		$post_res = curl_exec($tch);
		curl_close($tch);
		
	return TRUE;
}	
	

Example XML Response

<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>	
	<transaction_id>aBcDeF123456</transaction_id>
</age_verification_bulk_res> 

3. Start processing the CSV

Next set the command to 'start' to initialise the process.

Example PHP code:

			
function start_job($transaction_id) {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
	. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=start'
	. '&transaction_id=' . $transaction_id;

	$result = simplexml_load_file($url);
	return $result;

}			
			

Example XML Response



<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>	
	<transaction_id>aBcDeF123456</transaction_id>
</age_verification_bulk_res> 

4. Monitor Progress

You can read the progress of the background processing using the command 'progress'.

Example PHP code:

			
function view_jobs_progress($transaction_id) {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
				. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=progress'
	. '&transaction_id='.$transaction_id;

	$result = simplexml_load_file($url);
	return $result;
}	
			

Example XML Response



<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>
	<transaction_id>aBcDeF123456</transaction_id>
	<percentage>100</percentage>
</age_verification_bulk_res> 

5. View Results

Once the process has completed you can view a summary of how many records were verified using the command 'results'. This command is free to use and you will only be charged if you choose to proceed to the next stage, 'finalise', which provides you with a download url.

Example PHP code:

			
function view_job_result($transaction_id) {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
				. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=results'
	. '&transaction_id='.$transaction_id;

	$result = simplexml_load_file($url);
	return $result;
}	
			

Example XML Response



<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>
	<total_records>6</total_records>
	<transaction_id>aBcDeF123456</transaction_id>
	<total_found>3</total_found>
	<start_time>2022-04-26 12:33</start_time>
	<original_file_name>bulk_test.csv</original_file_name>
</age_verification_bulk_res> 

6. Complete process and get a Download URL

Use the command 'finalise' to purchase the processed results and receive a download URL. This command will only charge you once if you call it repeatedly using the same transaction_id.

Example PHP code:

			
function view_job_result($transaction_id) {

	$url = 'https://ageverifyuk.com/rest/rest.aspx'
			. '?api_key=[YOUR_APY_KEY]'
	. '&method=age_verification_bulk'
	. '&command=finalise'
	. '&transaction_id='.$transaction_id;



	$result = simplexml_load_file($url);
	return $result;


}
	
			

Example XML Response



<?xml version="1.0"?>
<age_verification_bulk_res>
	<mode>normal</mode>
	<status>ok</status>	
	<chargeable>true</chargeable>
	<transaction_id>aBcDeF123456</transaction_id>
	<download_url>https://ageverifyuk.com/rest/rest.aspx?method=csv_download&job_id=aBcDeF123456</download_url>
</age_verification_bulk_res> 
✕

Get in touch

Fill in the form and a member of our team will get back to you shortly.

We’ll never share your details with third parties.