{"id":28036,"library":"pelias-api","title":"Pelias API Server","description":"Pelias API is the HTTP API server for the Pelias geocoding project (v7.7.0). It processes user requests (search, reverse geocode, autocomplete, etc.) and returns GeoJSON results by querying Elasticsearch and other Pelias microservices. Released on npm with monthly-ish releases, it requires Node.js >=12 and on Docker uses Node 20. Key differentiators: open-source using only open data (OpenStreetMap, OpenAddresses, Who's on First), fully modular design with separate services for interpolation, place parsing, and point-in-polygon. Supports cluster mode, deduplication, and configurable search parameters. Currently active.","status":"active","version":"7.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/pelias/api","tags":["javascript","pelias","elasticsearch","webview"],"install":[{"cmd":"npm install pelias-api","lang":"bash","label":"npm"},{"cmd":"yarn add pelias-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add pelias-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CommonJS; no ESM export. Do not use import syntax.","wrong":"import PeliasApi from 'pelias-api';","symbol":"PeliasApi","correct":"const PeliasApi = require('pelias-api');"},{"note":"Destructuring is the common pattern; the package exports an object with 'routes', 'server', etc.","wrong":"const routes = require('pelias-api').routes;","symbol":"routes","correct":"const { routes } = require('pelias-api');"},{"note":"CommonJS only; the 'server' property is a function returning an Express app. Use require.","wrong":"import { server } from 'pelias-api';","symbol":"server","correct":"const { server } = require('pelias-api');"}],"quickstart":{"code":"const { server } = require('pelias-api');\nconst app = server({\n  api: {\n    defaultParameters: {\n      focus: { point: { lat: 40.7128, lon: -74.006 } }\n    }\n  },\n  elasticsearch: {\n    hosts: ['http://localhost:9200'],\n    apiVersion: '7.0'\n  }\n});\napp.listen(3100, () => {\n  console.log('Pelias API server running on port 3100');\n});","lang":"javascript","description":"Initializes a Pelias API server with Elasticsearch configuration and optional default focus point."},"warnings":[{"fix":"Update to Node.js 20 or use pelias/api Docker image tag >=7.0.0.","message":"Node.js 20 baseimage upgrade required. The Docker baseimage uses Node.js 20.19.4. Node 12 or 14 images will break.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Remove JSONP usage or implement your own JSONP wrapper. Consider using CORS instead.","message":"JSONP middleware removed in v7.7.0. JSONP support is no longer available.","severity":"breaking","affected_versions":">=7.7.0"},{"fix":"Upgrade Elasticsearch to 7.x. In pelias-config set elasticsearch.apiVersion to '7.0'.","message":"Elasticsearch 6.x support is deprecated. The API targets Elasticsearch 7.x and may not work with ES 6.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Adjust deduplication logic or override if needed. Periods are stripped before comparison.","message":"Deduplication uses name comparison ignoring periods. This can cause false positive deduplication for names with periods (e.g. 'St.' matches 'St').","severity":"gotcha","affected_versions":">=7.6.0"},{"fix":"Set PELIAS_CLUSTER environment variable or use config to enable cluster mode. Test thoroughly.","message":"Cluster mode enabled with 'cluster' feature. When enabled, multiple worker processes share the same port. Ensure your application is idempotent and stateless.","severity":"gotcha","affected_versions":">=7.3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Kill the existing process (lsof -ti:3100 | xargs kill -9) or change the port in config.","cause":"Port 3100 is already in use by another process or another Pelias instance.","error":"Error: listen EADDRINUSE :::3100"},{"fix":"Add 'api': {} to your pelias.json or ensure PELIAS_CONFIG points to a valid config.","cause":"The configuration file is missing the top-level 'api' key required by the server.","error":"Error: configuration error: No 'api' section found in pelias.json"},{"fix":"Start Elasticsearch service (e.g., systemctl start elasticsearch) or update hosts in config.","cause":"Elasticsearch is not running or not reachable on localhost:9200.","error":"Error: connect ECONNREFUSED 127.0.0.1:9200"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}