{"id":18369191,"url":"https://github.com/ideal-postcodes/core-node","last_synced_at":"2025-10-10T23:43:08.707Z","repository":{"id":35021948,"uuid":"190223851","full_name":"ideal-postcodes/core-node","owner":"ideal-postcodes","description":"Node.js client for api.ideal-postcodes.co.uk","archived":false,"fork":false,"pushed_at":"2023-03-04T03:53:07.000Z","size":1958,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T23:35:19.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ideal-postcodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-04T15:01:16.000Z","updated_at":"2022-01-10T13:14:59.000Z","dependencies_parsed_at":"2024-11-05T23:30:44.861Z","dependency_job_id":"8db46834-26f3-469d-9278-cf587210b082","html_url":"https://github.com/ideal-postcodes/core-node","commit_stats":{"total_commits":567,"total_committers":9,"mean_commits":63.0,"dds":"0.29805996472663143","last_synced_commit":"014dfe11ad9bd3ac8faaea9c66aae99b2d7f6d65"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideal-postcodes%2Fcore-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideal-postcodes%2Fcore-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideal-postcodes%2Fcore-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ideal-postcodes%2Fcore-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ideal-postcodes","download_url":"https://codeload.github.com/ideal-postcodes/core-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281423,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:28:42.127Z","updated_at":"2025-10-10T23:43:03.645Z","avatar_url":"https://github.com/ideal-postcodes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://img.ideal-postcodes.co.uk/Ideal%20Postcodes%20Node%20Logo@3x.png\" alt=\"Ideal Postcodes Node.js\"\u003e\n\u003c/h1\u003e\n\n\u003e Node.js client for api.ideal-postcodes.co.uk\n\n[![codecov](https://codecov.io/gh/ideal-postcodes/core-node/branch/master/graph/badge.svg)](https://codecov.io/gh/ideal-postcodes/core-node)\n[![Dependency Status](https://david-dm.org/ideal-postcodes/core-node.svg)](https://david-dm.org/ideal-postcodes/core-node)\n[![npm version](https://badge.fury.io/js/%40ideal-postcodes%2Fcore-node.svg)](https://www.npmjs.com/package/@ideal-postcodes/core-node)\n[![install size](https://packagephobia.now.sh/badge?p=@ideal-postcodes/core-node)](https://packagephobia.now.sh/result?p=@ideal-postcodes/core-node)\n[![Release](https://github.com/ideal-postcodes/core-node/workflows/Release/badge.svg)](https://github.com/ideal-postcodes/core-node/actions)\n![CI](https://github.com/ideal-postcodes/core-node/workflows/CI/badge.svg)\n\n`@ideal-postcodes/core-node` is the Node.js client for api.ideal-postcodes.co.uk\n\nOur JavaScript client implements a common interface defined at [@ideal-postcodes/core-interface](https://github.com/ideal-postcodes/core-interface).\n\nHigh level client documentation can be found at [core-interface](https://github.com/ideal-postcodes/core-interface/blob/master/README.md).\n\nIn depth client documentation can be found at [core-interface.ideal-postcodes.dev](https://core-interface.ideal-postcodes.dev).\n\n`@ideal-postcodes/core-node` is tested against [all maintained, stable releases](https://nodejs.org/en/about/releases/).\n\n## Links\n\n- [Configuration \u0026 Usage](#configuration--usage)\n- [Quickstart](#quickstart)\n- [Client Documentation](https://github.com/ideal-postcodes/core-interface/blob/master/README.md)\n- [In Depth Client Documentation](https://core-interface.ideal-postcodes.dev/#documentation)\n- [npm Module](https://www.npmjs.com/package/@ideal-postcodes/core-node)\n- [GitHub Repository](https://github.com/ideal-postcodes/core-node)\n\n## Other JavaScript Clients\n\n- [Browser Client Repository](https://github.com/ideal-postcodes/core-browser)\n- [Bundled Browser Client Repository](https://github.com/ideal-postcodes/core-browser-bundled)\n- [Axios-backed Client Repository](https://github.com/ideal-postcodes/core-axios)\n\n## Documentation\n\n### Configuration \u0026 Usage\n\n- [Install](#install)\n- [Instantiate](#instantiate) and [Use](#use) client\n- [Catch Errors](#catch-errors)\n- [Configure Agent](#configure-http-agent)\n  - [Proxy HTTP Requests](#proxy-requests)\n\n#### Install\n\n```bash\nnpm install @ideal-postcodes/core-node\n```\n\n#### Instantiate\n\n```javascript\nconst { Client } = require(\"@ideal-postcodes/core-node\");\n\n// or, if applicable,\nimport { Client } from \"@ideal-postcodes/core-node\"\n\nconst client = new Client({ api_key: \"iddqd\" });\n```\n\n[Configuration options](https://core-interface.ideal-postcodes.dev/interfaces/client.config)\n\n#### Use\n\n```javascript\nimport { lookupPostcode } from \"@ideal-postcodes/core-node\";\n\nconst addresses = await lookupPostcode({ client, postcode: \"SW1A2AA\" });\n```\n\n#### Catch Errors\n\n```javascript\nimport { lookupAddress, errors } from \"@ideal-postcodes/core-node\";\n\ntry {\n  await lookupAddress({ client, query: \"10 downing street\" });\n} catch (error) {\n  if (error instanceof errors.IdpcRequestFailedError) {\n    // IdpcRequestFailedError indicates a 402 response code\n    // Possibly the key balance has been depleted\n  }\n}\n```\n\n#### Configure HTTP Agent\n\n`core-node` uses [got](https://github.com/sindresorhus/got) as its underlying HTTP client. The Ideal Postcodes API client can also be optionally configured with a [got](https://github.com/sindresorhus/got) options object which is fed to [got](https://github.com/sindresorhus/got) on every request.\n\nBe aware this options object will overwrite any existing [got](https://github.com/sindresorhus/got) HTTP request parameters.\n\n```javascript\nconst client = new Client({ api_key: \"iddqd\" }, {\n  cache: new Map, // Instantiate a cache: https://github.com/sindresorhus/got#cache-1\n  hooks: {        // Hook into HTTP responses: https://github.com/sindresorhus/got#hooksafterresponse\n    afterResponse: response =\u003e {\n      modify(response);\n      log(response);\n      return response;\n    }\n  },\n});\n```\n\n##### Proxy HTTP Requests\n\nYou can [proxy requests](https://github.com/sindresorhus/got#proxies) by configuring the underlying [got](https://github.com/sindresorhus/got) HTTP client.\n\n```javascript\nconst tunnel = require(\"tunnel\");\n\nconst client = new Client(config, {\n  agent: tunnel.httpOverHttp({\n    proxy: {\n      host: \"localhost\"\n    }\n  })\n});\n```\n\n---\n\n### Quickstart\n\nThe client exposes a number of simple methods to get at the most common tasks when interacting with the API. Below is a (incomplete) list of commonly used methods.\n\n- [Lookup a Postcode](#lookup-a-postcode)\n- [Search for an Address](#search-for-an-address)\n- [Search for an Address by UDPRN](#search-for-an-address-by-udprn)\n\nFor a complete list of client methods, including low level resource methods, please see the [core-interface documentation](https://core-interface.ideal-postcodes.dev/#documentation)\n\n#### Lookup a Postcode\n\nReturn addresses associated with a given `postcode`\n\n```javascript\nimport { lookupPostcode } from \"@ideal-postcodes/core-node\";\n\nconst postcode = \"id11qd\";\n\nconst addresses = await lookupPostcode({ client, postcode });\n```\n\n[Method options](https://core-interface.ideal-postcodes.dev/interfaces/helper_methods.lookuppostcodeoptions)\n\n#### Search for an Address\n\nReturn addresses associated with a given `query`\n\n```javascript\nimport { lookupAddress } from \"@ideal-postcodes/core-node\";\n\nconst query = \"10 downing street sw1a\";\n\nconst addresses = await lookupAddress({ client, query });\n```\n\n[Method options](https://core-interface.ideal-postcodes.dev/interfaces/helper_methods.lookupaddressoptions)\n\n#### Search for an Address by UDPRN\n\nReturn address for a given `udprn`\n\nInvalid UDPRN will return `null`\n\n```javascript\nimport { lookupUdprn } from \"@ideal-postcodes/core-node\";\n\nconst udprn = 23747771;\n\nconst address = await lookupUdprn({ client, udprn });\n```\n\n[Method options](https://core-interface.ideal-postcodes.dev/interfaces/helper_methods.lookupudprnoptions)\n\n## Test\n\n```bash\nnpm test\n```\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fideal-postcodes%2Fcore-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fideal-postcodes%2Fcore-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fideal-postcodes%2Fcore-node/lists"}