Spatial Intelligence API
Integrate spatial intelligence into your applications with our NLP-powered API.
Overview
The Spatial Intelligence API extracts named entities (people, organizations, locations) from text and returns enriched GeoJSON with geocoded coordinates.
| Feature | Description |
|---|---|
| NER | Entity Extraction - People, orgs, locations |
| GEO | Geocoding - Coordinates & GeoJSON |
| AI | ML Models - spaCy + BERT |
Base URL
| Environment | URL |
|---|---|
| Production | https://spatial.kkrl.co.uk |
| Development | https://dev.spatial.kkrl.co.uk |
Authentication
All API requests require an API key passed in the X-API-Key header.
curl -X POST https://dev.spatial.kkrl.co.uk/flow/enrich \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items": [{"id": "req-001", "text": "Meeting in London"}]}'
Obtaining an API Key
Register at https://dev.spatial.kkrl.co.uk/register to obtain an API key. Keys are tied to a subscription tier that determines your rate limits and quotas.
Endpoints
Health Check
Check if the API is operational. No authentication required.
GET /flow/health
Response:
{
"status": "healthy",
"service": "nifi-flow",
"timestamp": "2026-01-04T12:00:00Z"
}
Entity Enrichment
Extract named entities from text and return enriched GeoJSON with geocoded locations.
POST /flow/enrich
Content-Type: application/json
X-API-Key: YOUR_API_KEY
Request Body:
{
"items": [
{"id": "req-001", "text": "Meeting with John Smith at Google in London."}
],
"options": {
"model": "hybrid"
}
}
| Field | Type | Required | Description |
|---|---|---|---|
items | array | Yes | Array of text items to analyze |
items[].id | string | Yes | Unique identifier for the item |
items[].text | string | Yes | Text content to analyze |
items[].metadata | object | No | Optional metadata for the item |
options | object | No | Optional processing settings |
options.model | string | No | NER model: hybrid (default), bert, spacy, legal, finance |
options.utm_precision | int | No | UTM coordinate precision (0-6, default: 2) |
options.military_mode | string | No | Military matching: standard (default), aggressive |
Response (GeoJSON):
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-0.1276, 51.5074]
},
"properties": {
"name": "London",
"entity_type": "LOC",
"confidence": 0.97
}
}
],
"metadata": {
"entities": [
{"text": "John Smith", "label": "PER"},
{"text": "Google", "label": "ORG"},
{"text": "London", "label": "LOC"}
]
}
}
Entity Types
| Type | Description | Examples |
|---|---|---|
| PER | Person names | John Smith, Dr. Jane Doe |
| ORG | Organizations | Google, United Nations |
| LOC | Locations | London, Mount Everest |
| GPE | Geopolitical entities | United Kingdom, Texas |
| MISC | Miscellaneous | Project Apollo, COVID-19 |
Rate Limits
Rate limits are enforced per API key based on your subscription tier.
| Tier | Rate Limit | Daily Quota | Monthly Price |
|---|---|---|---|
| Starter | 10 req/sec | 10,000 | £49 |
| Professional | 50 req/sec | 100,000 | £199 |
| Enterprise | 100 req/sec | Unlimited | Custom |
Rate Limit Headers
All responses include rate limit information:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9500
X-RateLimit-Reset: 1704369600
Code Examples
Python
import requests
response = requests.post(
"https://dev.spatial.kkrl.co.uk/flow/enrich",
headers={
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"items": [{"id": "req-001", "text": "Meeting in London with John Smith"}],
"options": {"model": "hybrid"}
}
)
data = response.json()
# GeoJSON response with entities in metadata
for entity in data["metadata"]["entities"]:
print(f"{entity['label']}: {entity['text']}")
JavaScript
const response = await fetch('https://dev.spatial.kkrl.co.uk/flow/enrich', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [{ id: 'req-001', text: 'Meeting in London with John Smith' }],
options: { model: 'hybrid' }
})
});
const data = await response.json();
// GeoJSON response with entities in metadata
data.metadata.entities.forEach(e => console.log(`${e.label}: ${e.text}`));
cURL
curl -X POST https://dev.spatial.kkrl.co.uk/flow/enrich \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items": [{"id": "req-001", "text": "Meeting in London with John Smith"}]}' | jq .
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid input |
| 401 | Unauthorized - Missing API key |
| 403 | Forbidden - Invalid API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
Error Response Format
{
"error": "Rate limit exceeded",
"retry_after": 60
}
Support
- Email: support@kkrl.co.uk
- Website: https://kkrl.co.uk