# How to rename a field in a model and all its content retroactively

**URL:** <https://forum.builder.io/t/how-to-rename-a-field-in-a-model-and-all-its-content-retroactively/408>\
**Category:** Technical Questions\
**Tags:** visual-editor\
**Created:** [January 20, 2021, 12:33am UTC](https://forum.builder.io/t/how-to-rename-a-field-in-a-model-and-all-its-content-retroactively/408 "2021-01-20T00:33:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aziz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/aziz/32/2551_2.png) [@aziz](https://forum.builder.io/u/aziz)\
**Post date:** [January 20, 2021, 12:33am UTC](https://forum.builder.io/t/how-to-rename-a-field-in-a-model-and-all-its-content-retroactively/408/1 "2021-01-20T00:33:27Z")

</div>

Re-naming a field for content that’s already been published requires two main updates:

#### on the model level:

Update the field name in the [model configuration editor](https://builder.io/models) will ensure all newly created content has the field.

#### on the content level:

Now we want to apply the new field name retroactively to all content that’s already been published, in two steps using your favorite scripting language:  
1- Read all content on a model using our [content API](https://www.builder.io/c/docs/query-api)  
2 - Use our [write API](https://www.builder.io/c/docs/write-api) to update the content entry, you’ll need to generate a private key to be used here,

So in node it’d be something like this

```auto
// read all result might need to paginate if list > 100
const allContentOnAmodel = await fetch(`https//builder.io/api/v2/content/${modelName}`)
  .then(res => res.json());

allContentOnAmodel.results.map(entry => {
  entry[newFieldName] = entry[oldFieldName];
  delete entry[oldFieldName];
  await fetch(`https://builder.io/api/v2/write/${modelName}`, {
   method: 'POST',
   headers: {
     Authorization: `bearer ${privateKey}`,
    },
    body: JSON.strinigify(entry),
  })
})

```
