Einführung
Die rastr API bietet programmatischen Zugriff auf deutsche Geokodierungs- und Demografiedaten. Verwende sie, um Adressen in Koordinaten umzuwandeln, Bevölkerungsstatistiken von Destatis abzurufen und API-Schlüssel für deine Anwendungen zu verwalten.
API-Endpunkte
4
Geokodierung mit integrierten Demografiedaten
Regionale Abdeckung
Germany
Nur Deutschland
Protokoll
REST
JSON über HTTPS
Authentifizierung
Alle API-Endpunkte erfordern eine Authentifizierung. Du kannst dich entweder mit einem Bearer-JWT-Token (über Login erhalten) oder mit einem API-Schlüssel authentifizieren, der im X-Api-Key-Header übergeben wird. API-Schlüssel werden für den programmatischen Zugriff und serverseitige Integrationen empfohlen.
API-Schlüssel-Authentifizierung
Füge deinen API-Schlüssel in den X-Api-Key-Header jeder Anfrage ein. Du kannst API-Schlüssel in deinem Dashboard erstellen und verwalten.
cURL-Beispiel
curl -X GET "https://api.locationreport.com/geocode/location/52.524705,13.3932623" \
-H "X-Api-Key: your_api_key_here"JavaScript-Beispiel
const response = await fetch(
"https://api.locationreport.com/geocode/location/52.524705,13.3932623",
{
headers: {
"X-Api-Key": "your_api_key_here",
},
}
);
const data = await response.json();Halte deine API-Schlüssel sicher. Gib diese niemals in clientseitigem Code oder öffentlichen Repositorys preis. Rotiere Schlüssel regelmäßig, wenn du vermutest, dass sie kompromittiert wurden.
Geokodierung
/geocode/address/{address}Accepts a text address in the path and returns coordinates with formatted address. Returns best match only. DE region only. Optional 'year' and 'quarter' query params select a specific dataset period. When 'fields=census' is set, the response includes a 'fields.census' object with population, age bands, marital status, average household size, and the resolved grid cell's corner coordinates, sourced from Destatis. 'dataSource' is 'census' or 'estimated' and 'effectiveQuarter' is 0-4 (both null when no dataset version resolves for the requested period). 'granularity' is a string: unknown, rooftop, rangeInterpolated, geometricCenter, approximate.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| address | string | path | Required | Full address text (e.g. "71 Oranienburger Straße, 10117 Berlin") |
| fields | string | query | Optional | Comma-separated list of enrichment fields (e.g. "census") |
| year | integer | query | Optional | Dataset year to query (default: latest available). |
| quarter | integer | query | Optional | Dataset quarter: 0 for the annual/census snapshot, 1-4 for a specific quarter (default: latest available for the given year). |
| language | string | query | Optional | Language of the returned address text: "de" or "en". Defaults to "de". |
Response
{
"results": [
{
"location": {
"latitude": 52.524705,
"longitude": 13.3932623
},
"granularity": "rooftop",
"formattedAddress": "Oranienburger Str. 71, 10117 Berlin, Germany",
"addressComponents": [
{
"types": [
"street_number"
],
"longText": "71",
"shortText": "71",
"languageCode": "de"
},
{
"types": [
"route"
],
"longText": "Oranienburger Straße",
"shortText": "Oranienburger Str.",
"languageCode": "de"
},
{
"types": [
"postal_code"
],
"longText": "10117",
"shortText": "10117",
"languageCode": "de"
},
{
"types": [
"locality"
],
"longText": "Berlin",
"shortText": "Berlin",
"languageCode": "de"
},
{
"types": [
"country"
],
"longText": "Germany",
"shortText": "DE",
"languageCode": "de"
}
],
"types": [
"street_address"
],
"fields": {
"census": {
"population": 3421,
"datasetYear": 2022,
"dataSource": "census",
"effectiveQuarter": 0,
"ageUnder10": 210,
"age10To19": 260,
"age20To29": 480,
"age30To39": 610,
"age40To49": 540,
"age50To59": 470,
"age60To69": 390,
"age70To79": 300,
"age80AndOver": 161,
"single": 1850,
"married": 1120,
"widowed": 240,
"divorced": 211,
"averageHouseholdSize": 1.8,
"cellBounds": {
"southWest": {
"latitude": 52.5241,
"longitude": 13.3925
},
"southEast": {
"latitude": 52.5241,
"longitude": 13.3941
},
"northEast": {
"latitude": 52.5253,
"longitude": 13.3941
},
"northWest": {
"latitude": 52.5253,
"longitude": 13.3925
}
}
}
}
}
]
}cURL Example
curl -X GET "https://api.locationreport.com/geocode/address/71%20Oranienburger%20Stra%C3%9Fe%2C%2010117%20Berlin?fields=census" \
-H "X-Api-Key: your_api_key"/geocode/addressAccepts a text address or structured fields in the query and returns coordinates. Returns best match only. DE region only. Optional 'year' and 'quarter' query params select a specific dataset period. When 'fields=census' is set, the response includes a 'fields.census' object with population, age bands, marital status, average household size, and the resolved grid cell's corner coordinates, sourced from Destatis. 'dataSource' is 'census' or 'estimated' and 'effectiveQuarter' is 0-4 (both null when no dataset version resolves for the requested period). 'granularity' is a string: unknown, rooftop, rangeInterpolated, geometricCenter, approximate.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| street | string | query | Optional | Street name |
| houseNumber | string | query | Optional | House / building number |
| postalCode | string | query | Optional | Postal code (PLZ) |
| city | string | query | Optional | City name |
| country | string | query | Optional | Country name or code (default: DE) |
| fields | string | query | Optional | Comma-separated enrichment fields (e.g. "census") |
| year | integer | query | Optional | Dataset year to query (default: latest available). |
| quarter | integer | query | Optional | Dataset quarter: 0 for the annual/census snapshot, 1-4 for a specific quarter (default: latest available for the given year). |
| language | string | query | Optional | Language of the returned address text: "de" or "en". Defaults to "de". |
Response
{
"results": [
{
"location": {
"latitude": 52.524705,
"longitude": 13.3932623
},
"granularity": "rooftop",
"formattedAddress": "Oranienburger Str. 71, 10117 Berlin, Germany",
"addressComponents": [],
"types": [
"street_address"
],
"fields": {
"census": {
"population": 3421,
"datasetYear": 2022,
"dataSource": "census",
"effectiveQuarter": 0,
"ageUnder10": 210,
"age10To19": 260,
"age20To29": 480,
"age30To39": 610,
"age40To49": 540,
"age50To59": 470,
"age60To69": 390,
"age70To79": 300,
"age80AndOver": 161,
"single": 1850,
"married": 1120,
"widowed": 240,
"divorced": 211,
"averageHouseholdSize": 1.8,
"cellBounds": {
"southWest": {
"latitude": 52.5241,
"longitude": 13.3925
},
"southEast": {
"latitude": 52.5241,
"longitude": 13.3941
},
"northEast": {
"latitude": 52.5253,
"longitude": 13.3941
},
"northWest": {
"latitude": 52.5253,
"longitude": 13.3925
}
}
}
}
}
]
}cURL Example
curl -X GET "https://api.locationreport.com/geocode/address?street=Oranienburger%20Stra%C3%9Fe&houseNumber=71&postalCode=10117&city=Berlin&fields=census" \
-H "X-Api-Key: your_api_key"/geocode/location/{latitude},{longitude}Accepts latitude/longitude in the path and returns formatted address with structured breakdown. DE region only. Optional 'year' and 'quarter' query params select a specific dataset period. When 'fields=census' is set, the response includes a 'fields.census' object with population, age bands, marital status, average household size, and the resolved grid cell's corner coordinates, sourced from Destatis. 'dataSource' is 'census' or 'estimated' and 'effectiveQuarter' is 0-4 (both null when no dataset version resolves for the requested period). 'granularity' is a string: unknown, rooftop, rangeInterpolated, geometricCenter, approximate.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| latitude | number | path | Required | WGS84 latitude (e.g. 52.524705) |
| longitude | number | path | Required | WGS84 longitude (e.g. 13.3932623) |
| fields | string | query | Optional | Comma-separated enrichment fields (e.g. "census") |
| year | integer | query | Optional | Dataset year to query (default: latest available). |
| quarter | integer | query | Optional | Dataset quarter: 0 for the annual/census snapshot, 1-4 for a specific quarter (default: latest available for the given year). |
| language | string | query | Optional | Language of the returned address text: "de" or "en". Defaults to "de". |
Response
{
"results": [
{
"location": {
"latitude": 52.524705,
"longitude": 13.3932623
},
"granularity": "rooftop",
"formattedAddress": "Oranienburger Str. 71, 10117 Berlin, Germany",
"addressComponents": [],
"types": [
"street_address"
],
"fields": {
"census": {
"population": 3421,
"datasetYear": 2022,
"dataSource": "census",
"effectiveQuarter": 0,
"ageUnder10": 210,
"age10To19": 260,
"age20To29": 480,
"age30To39": 610,
"age40To49": 540,
"age50To59": 470,
"age60To69": 390,
"age70To79": 300,
"age80AndOver": 161,
"single": 1850,
"married": 1120,
"widowed": 240,
"divorced": 211,
"averageHouseholdSize": 1.8,
"cellBounds": {
"southWest": {
"latitude": 52.5241,
"longitude": 13.3925
},
"southEast": {
"latitude": 52.5241,
"longitude": 13.3941
},
"northEast": {
"latitude": 52.5253,
"longitude": 13.3941
},
"northWest": {
"latitude": 52.5253,
"longitude": 13.3925
}
}
}
}
}
]
}cURL Example
curl -X GET "https://api.locationreport.com/geocode/location/52.524705,13.3932623?fields=census" \
-H "X-Api-Key: your_api_key"/geocode/locationAccepts latitude/longitude as query parameters and returns formatted address with structured breakdown. DE region only. Optional 'year' and 'quarter' query params select a specific dataset period. When 'fields=census' is set, the response includes a 'fields.census' object with population, age bands, marital status, average household size, and the resolved grid cell's corner coordinates, sourced from Destatis. 'dataSource' is 'census' or 'estimated' and 'effectiveQuarter' is 0-4 (both null when no dataset version resolves for the requested period). 'granularity' is a string: unknown, rooftop, rangeInterpolated, geometricCenter, approximate.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| latitude | number | query | Required | WGS84 latitude |
| longitude | number | query | Required | WGS84 longitude |
| fields | string | query | Optional | Comma-separated enrichment fields (e.g. "census") |
| year | integer | query | Optional | Dataset year to query (default: latest available). |
| quarter | integer | query | Optional | Dataset quarter: 0 for the annual/census snapshot, 1-4 for a specific quarter (default: latest available for the given year). |
| language | string | query | Optional | Language of the returned address text: "de" or "en". Defaults to "de". |
Response
{
"results": [
{
"location": {
"latitude": 52.524705,
"longitude": 13.3932623
},
"granularity": "rooftop",
"formattedAddress": "Oranienburger Str. 71, 10117 Berlin, Germany",
"addressComponents": [],
"types": [
"street_address"
],
"fields": {
"census": {
"population": 3421,
"datasetYear": 2022,
"dataSource": "census",
"effectiveQuarter": 0,
"ageUnder10": 210,
"age10To19": 260,
"age20To29": 480,
"age30To39": 610,
"age40To49": 540,
"age50To59": 470,
"age60To69": 390,
"age70To79": 300,
"age80AndOver": 161,
"single": 1850,
"married": 1120,
"widowed": 240,
"divorced": 211,
"averageHouseholdSize": 1.8,
"cellBounds": {
"southWest": {
"latitude": 52.5241,
"longitude": 13.3925
},
"southEast": {
"latitude": 52.5241,
"longitude": 13.3941
},
"northEast": {
"latitude": 52.5253,
"longitude": 13.3941
},
"northWest": {
"latitude": 52.5253,
"longitude": 13.3925
}
}
}
}
}
]
}cURL Example
curl -X GET "https://api.locationreport.com/geocode/location?latitude=52.524705&longitude=13.3932623&fields=census" \
-H "X-Api-Key: your_api_key"Migration von der Google Maps Geocoding API
Wenn du derzeit die Google Maps Geocoding API verwendest, ist die Migration zur rastr API unkompliziert. Nachfolgend findest du einen direkten Vergleich, der dir hilft, die Unterschiede zu verstehen und deine Migration zu planen.
| Dimension | Google Maps Geocoding API | rastr API |
|---|---|---|
| Endpunkt-Struktur | RESTful-Endpunkt mit Query-Parametern (address=, key=, language=, usw.) | RESTful-Endpunkt mit Pfadparametern (/geocode/address/{address}) und X-Api-Key-Header |
| Authentifizierung | URL-Parameter (key=IHR_API_SCHLÜSSEL) | HTTP-Header (X-Api-Key: IHR_API_SCHLÜSSEL) |
| Antwortformat | Verschachteltes JSON mit geometry.bounds, geometry.location, address_components-Arrays | Flaches JSON mit latitude, longitude, formattedAddress sowie Demografiedaten |
| Preismodell | Nutzungsbasierte Abrechnung (5 $ pro 1.000 Anfragen), Volumenrabatte verfügbar | Prepaid-Guthaben oder Abo-Pläne mit planbaren monatlichen Kosten |
| Ratenbegrenzungen | Variabel nach Tarif (50 QPS Standard, 100+ QPS Premium) | Tarifbasierte Ratenbegrenzungen mit Burst-Toleranz |
| Regionale Abdeckung | Weltweite Abdeckung, ~200 Länder | Ausschließlich Deutschland mit zensus-genauen Destatis-Daten |
| Demografiedaten | Keine integrierten Demografiedaten — separate API oder Datenquelle erforderlich | Integrierte Bevölkerungs-, Altersverteilungs- und Haushaltsdaten aus Destatis Zensus 2022 und Schätzungen bis 2026 |
Code-Migrationsbeispiel
Das folgende Beispiel zeigt, wie du eine einfache Forward-Geokodierungsanfrage von Google Maps zu rastr migrierst. Die Hauptunterschiede liegen in der URL-Struktur, dem Authentifizierungs-Header und dem flacheren Antwortformat.
const API_KEY = "YOUR_GOOGLE_API_KEY";
const address = "Oranienburger Straße 71, Berlin";
const response = await fetch(
`https://maps.googleapis.com/maps/api/geocode/json?` +
`address=${encodeURIComponent(address)}&key=${API_KEY}`
);
const data = await response.json();
// Extract coordinates from nested response
const lat = data.results[0].geometry.location.lat;
const lng = data.results[0].geometry.location.lng;const API_KEY = "YOUR_LR_API_KEY";
const address = "Oranienburger Straße 71, Berlin";
const response = await fetch(
`https://api.locationreport.com/geocode/address/` +
`${encodeURIComponent(address)}`,
{
headers: { "X-Api-Key": API_KEY }
}
);
const data = await response.json();
// Flat response with coordinates + demographics
const { latitude, longitude } = data;Wesentliche Unterschiede
- ✓Authentifizierung über HTTP-Header statt URL-Parameter — dein API-Schlüssel wird niemals in Server-Logs oder Browserverlauf sichtbar.
- ✓Flache Antwortstruktur — kein Navigieren durch verschachtelte geometry.location-Objekte nötig.
- ✓Demografische Daten - Bevölkerungsstatistiken, Altersverteilung und Haushaltsdaten - können bei jeder Geokodierungsanfrage hinzugefügt werden.
- ✓Deutschland-optimierte Ergebnisse — höhere Genauigkeit für deutsche Adressen mit Destatis-Datenanreicherung, die nirgendwo anders verfügbar ist.
Fehlt ein Endpunkt oder Feld, das hier nicht steht?
Sag uns, was fehlt — wir lesen jede Anfrage.