API Documentation

Clean and validate UK data programmatically

Authentication

All API requests must include your API key in the Authorization header:

Authorization: Bearer your_api_key

Endpoints

Clean Data

Clean and validate UK data including phone numbers, NI numbers, postcodes, and sort codes.

POST /api/clean.php

Request Body

{
    "data": [
        {
            "phone": "07700900123",
            "postcode": "SW1A1AA",
            "ni_number": "AB123456C"
        }
    ],
    "fields": ["phone", "postcode", "ni_number"],
    "phone_format": "international" // optional, defaults to "international"
}

Response

{
    "status": "success",
    "data": {
        "results": [
            {
                "phone": {
                    "original": "07700900123",
                    "cleaned": "+44 7700 900 123",
                    "valid": true,
                    "error": null
                },
                "postcode": {
                    "original": "SW1A1AA",
                    "cleaned": "SW1A 1AA",
                    "valid": true,
                    "error": null
                },
                "ni_number": {
                    "original": "AB123456C",
                    "cleaned": "AB 123456 C",
                    "valid": true,
                    "error": null
                }
            }
        ],
        "summary": {
            "total_fields": 3,
            "valid_fields": 3,
            "cleaned_fields": 3,
            "errors": 0,
            "success_rate": 100
        }
    }
}

Error Response

{
    "status": "error",
    "message": "Error message here"
}

Rate Limits

Rate limits depend on your subscription plan:

Example Usage

cURL

curl -X POST \
  'https://your-domain.com/api/clean.php' \
  -H 'Authorization: Bearer your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{
    "data": [
        {
            "phone": "07700900123",
            "postcode": "SW1A1AA"
        }
    ],
    "fields": ["phone", "postcode"]
}'

JavaScript

fetch('https://your-domain.com/api/clean.php', {
    method: 'POST',
    headers: {
        'Authorization': 'Bearer your_api_key',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        data: [
            {
                phone: '07700900123',
                postcode: 'SW1A1AA'
            }
        ],
        fields: ['phone', 'postcode']
    })
})
.then(response => response.json())
.then(data => console.log(data));

PHP

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => 'https://your-domain.com/api/clean.php',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer your_api_key',
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'data' => [
            [
                'phone' => '07700900123',
                'postcode' => 'SW1A1AA'
            ]
        ],
        'fields' => ['phone', 'postcode']
    ])
]);

$response = curl_exec($ch);
$data = json_decode($response, true);

curl_close($ch);