---
search:
  tags:
    - database-services
    - POST
seo:
  description: >-
    Empties the data… Reference for the POST
    /api/v1/database-services/{id}/servers/{server_id}/rebuild-replica endpoint
    in the TimescaleDB Enterprise API.
  noindex: true
sidebar:
  label: Rebuild a replica
  badge: POST
title: Rebuild a replica
type: openapi-operation
---
Empties the data directory of a replica and clones the data again from the leader with Patroni. The server keeps its packages, its TLS files, its etcd member and its mesh address. The leader cannot be rebuilt: switch over first. Every other member must be healthy.

`POST /api/v1/database-services/{id}/servers/{server_id}/rebuild-replica`

**Responses**

- `202` — Accepted
- `default` — Error

Response example, 202:

```json
{
  "server_id": "string",
  "workflow_id": "string"
}
```
