---
lang: en
title: 'API docs: repository.entitycrudrepository.save'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.entitycrudrepository.save.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; [save](./repository.entitycrudrepository.save.md)

## EntityCrudRepository.save() method

Save an entity. If no id is present, create a new entity

**Signature:**

```typescript
save(entity: DataObject<T>, options?: Options): Promise<T>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  entity | [DataObject](./repository.dataobject.md)<!-- -->&lt;T&gt; | Entity to be saved |
|  options | [Options](./repository.options.md) | _(Optional)_ Options for the operations |

**Returns:**

Promise&lt;T&gt;

A promise that will be resolve if the operation succeeded or will be rejected if the entity was not found.


