# Database CRUD APIs Auto-Generation

### Video

{% embed url="<https://www.youtube.com/watch?v=TsFOK-7hXBg>" %}

Users can auto-generate CRUD API endpoints for any database using the Data Source Browser. CRUD APIs are meant for Create-Retrieve-Update-Delete operations on the database table records.

1. Click on *View* in the main menu bar and select *Data Source Browser* from the drop-down menu.

![](/files/z7TUgZAmqF15mvn6XH4p)

This will open the Data Source Browser.

![](/files/H17TEmL8FrFbUcbVTvjp)

2. Add a new database server by selecting the *Add Database Server* option.

![](/files/wwcc79Cy2egcXbNJ1Kg1)

This will open a configuration window to define a database connection. A database server can be configured from any of the listed providers.

![](/files/tHK9RmyKf87mng88HOGm)

3. Add all the essential details to configure the database server connection and click *OK*.

![](/files/ue6bQjBKsIuCFLfynSWZ)

Now, the Data Source Browser will be populated with all the databases from the connected server.

![](/files/DnnnkQBx9XxBHKI2XlSe)

4. Right-click on any database and select *Generate CRUD flows* from the context menu.

{% hint style="info" %}
**Note:** It is necessary for a project to be open when CRUD API flows are generated, since they are added under a CRUD folder created in the project.
{% endhint %}

![](/files/IjtpziwT4Dl45cnsgtu8)

This will open a new window.

Here, you can select the tables and the respective CRUD operations to generate API flows.

![](/files/Dt80IuZkys9KiWZ9LFgc)

For our use case, we will be selecting the *Orders* table. The following operations are available for each table:

1. *Find all records* – A Get method that fetches all the records
2. *Get record by ID* – A Get method along with a path parameter for a key that fetches the records based on the key.
3. *Create a new record* – Selecting this creates a new record.
4. *Update a record by ID* – Selecting this option lets the user update a record by ID
5. *Delete a record by ID* – Selecting this option lets the user delete a record by ID.

![](/files/6rAr2F3KH18IPvYLx8iZ)

The user can even select configurations inside each endpoint, whether they want to enable sort or filter, or whether their execution type is Synchronous or Asynchronous.

5. Once done, click *Generate* and the CRUD flows will be generated.

![](/files/D43RrdGj8fkjvW7ZB0Iu)

You can then view the API endpoints in the Project Explorer.

![](/files/eYzbEgxRPuXjdQ3phNEV)

6. Now, you can directly group and deploy with a single click,

![](/files/atpJawaRH3bhtGbKw9Oj)

or open any of the API flows to see pre-configured API flows or make any changes.

![](/files/fiv8T0xJqibeRUFuaa4S)

This concludes the working of the Database APIs CRUD auto-generation in Astera.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/api-flow/api-publishing/develop/database-crud-apis-auto-generation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
