# Get started updating a subproject using Node.js Occassionally, you may need to update the details of a subproject using the Subproject API. This guide will walk you through how to update all details of your previously created subproject. Note Before you can get started, you need the following already set up: - All Subproject API [configuration settings](/docs/subproject/getting-started/). - [Node.js](https://nodejs.org/en/) and a familiarity with how to create a new app. Steps: 1. [Set up](#set-up-your-node.js-application) your Node.js application. 2. [Update](#update-your-subproject) your subproject. ## Set up your Node.js application 1. Once you setup your free Sinch account, create a new node app with npm. ```shell npm init ``` 2. Accept the defaults for the application. 3. Add the fetch package with npm to generate the necessary dependencies. ```shell npm install node-fetch ``` 4. Create a new file named `index.mjs` in the project and paste the provided code into the file. index.mjs import fetch from 'node-fetch'; const subprojectId = 'YOUR_subprojectId'; // The subproject ID you want to update const displayName = 'Updated Display Name'; // New display name for the subproject const labels = { 'region': 'US-West', 'department': 'Engineering' }; const keyId = 'YOUR_Key_ID'; // Your Key ID from Sinch Build Dashboard const keySecret = 'YOUR_Key_Secret'; // Your Key Secret from Sinch Build Dashboard const updateData = { displayName: displayName, labels: labels }; async function updateSubproject() { try { const response = await fetch( `https://subproject.api.sinch.com/v1alpha1/subprojects/${subprojectId}`, { method: 'PATCH', headers: { 'Authorization': `Basic ${Buffer.from(`${keyId}:${keySecret}`).toString('base64')}`, 'Content-Type': 'application/json' }, body: JSON.stringify(updateData) } ); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('Subproject updated successfully:', data); return data; } catch (error) { console.error('Error updating subproject:', error); throw error; } } // Execute the function updateSubproject(); ## Update your subproject Now, we'll customize and run the code that will update your subproject. ### Fill in your parameters 1. Assign your values to the following parameters: | Parameter | Your value | | --- | --- | | `YOUR_subprojectId` | The subproject ID that you would like to update. | | `displayName` | The display name of the subproject is replaced by providing a new one. | | `labels` | Update any label key:value pairs. You can assign new values to current keys or add entirely new pairs. | | `YOUR_Key_ID` | Your Key ID from [Sinch Build Dashboard](https://dashboard.sinch.com/settings/access-keys) under **Settings**, then **Access Keys**. | | `YOUR_Key_Secret` | Your Key Secret from [Sinch Build Dashboard](https://dashboard.sinch.com/settings/access-keys) under **Settings**, then **Access Keys**. | 2. Save the file. 3. Execute the code and update your subproject. Run the following command: ```shell node index.mjs ``` ## Next steps Check out our full [API reference](/docs/subproject/api-reference) for more subproject options.