---
lang: en
title: 'API docs: repository.entitycrudrepository.replacebyid'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.entitycrudrepository.replacebyid.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [EntityCrudRepository](./repository.entitycrudrepository.md) &gt; [replaceById](./repository.entitycrudrepository.replacebyid.md)

## EntityCrudRepository.replaceById() method

Replace an entity by id

<b>Signature:</b>

```typescript
replaceById(id: ID, data: DataObject<T>, options?: Options): Promise<void>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  id | ID | Value for the entity id |
|  data | [DataObject](./repository.dataobject.md)<!-- -->&lt;T&gt; | Data attributes to be replaced |
|  options | [Options](./repository.options.md) | Options for the operations |

<b>Returns:</b>

Promise&lt;void&gt;

A promise that will be resolve if the operation succeeded or will be rejected if the entity was not found.


