# Look up a number with Node.js You can quickly see how the Number Lookup API works by looking up a number using the API. In this guide you will learn how to: Learn how to: 1. [Set up](#set-up-your-nodejs-application) your Node.js application 2. [Look up](#look-up-your-phone-number) your phone number ## What you need to know before you start Before you can get started, you need the following already set up: * Set all Number Lookup API [configuration settings](/docs/number-lookup-api-v2/getting-started). * [Node.js](https://nodejs.org/en/) and a familiarity with how to create a new app. ## Set up your Node.js application First we'll create a Node project using npm. To create the project, do the following steps: 1. Create a folder called `number-lookup`. 2. Navigate into the folder you created and run the following command. ```shell npm init ``` This command creates the package.json file. You will be prompted to provide values for the fields. For this tutorial, you can simply accept the default values and press enter at each stage. 1. Add the fetch package with npm to generate the necessary dependencies. ```shell npm install 'cross-fetch' ``` ## Create your file Create a new file named **index.js** in the project and paste the provided "index.js" code into the file. Note: This tutorial uses basic authentication for testing purposes. We recommend using OAuth for authentication in a production environment. You can follow the steps in this guide, but use the code samples from [here](/docs/number-lookup-api-v2/api-reference/authentication/oauth) to use OAuth authentication instead. index.js // Use this code to look up a number. // Find your application key and secret at dashboard.sinch.com/number-lookup/apps const ACCESS_KEY = "YOUR_access_key"; const ACCESS_SECRET = "YOUR_access_secret"; const PROJECT_ID = "YOUR_project_id"; const NUMBER = "YOUR_phone_number"; const basicAuthentication = ACCESS_KEY + ":" + ACCESS_SECRET; const fetch = require('cross-fetch'); const lookup = { number: NUMBER }; fetch("https://lookup.api.sinch.com/v2/projects" + PROJECT_ID + "/lookups", { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic ' + Buffer.from(basicAuthentication).toString('base64') }, body: JSON.stringify(lookup) }).then(res => res.json()).then(json => console.log(json)); ## Fill in your parameters Assign your values to the following parameters: | Parameter | Your value | | --- | --- | | `ACCESS_KEY` | The access key found on your Sinch [Build dashboard](https://dashboard.sinch.com/settings/access-keys). | | `ACCESS_SECRET` | The access secret found on your Sinch [Build dashboard](https://dashboard.sinch.com/settings/access-keys). | | `PROJECT_ID` | Your project ID found on your Sinch [Build dashboard](https://dashboard.sinch.com/settings/access-keys). | | `NUMBER` | The phone number that you want to look up in [E.164](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537) format. | Save the file. ## Look up your phone number Now you can execute the code and look up your phone number. Run the following command: ```shell node index.js ``` You should receive a response in your console with details about the phone number you specified. Troubleshooting tip If after running your app you receive a 5000 error response, you may have forgotten to save your file after adding your authentication values. This is an easy mistake to make! Try saving the file and running the app again. ## Additional resources - [API specification](/docs/number-lookup-api-v2/api-reference/)