---
search:
  tags:
    - Tenants
    - POST
seo:
  description: >-
    Puts lunas back as they were at a moment in the past: one luna, every luna…
    Reference for the POST /_luna/tenants/{tenant}/restore endpoint in the Luna
    API.
sidebar:
  label: Restore lunas to an earlier moment
  badge: POST
title: Restore lunas to an earlier moment
type: openapi-operation
---
Puts lunas back as they were at a moment in the past: one luna, every luna of a type or every luna of the tenant. One request restores one page of lunas. Send the `cursor` it returns to restore the next page, until the cursor is null.

`POST /_luna/tenants/{tenant}/restore`

**Request body** (`application/json`, required)

- `at` (integer<int64> | null) — The moment to restore to, in milliseconds since the Unix epoch. Give this or \`lsn\`.
- `lsn` (integer<int64> | null) — A position in one luna's history to restore to. Needs \`type\` and \`key\`.
- `type` (string | null) — Only lunas of this type. Every type when left out.
- `key` (object | null) — Only the luna with this key, such as \`{"id": "a"}\`. Needs \`type\`.
- `limit` (integer<int32> | null) — How many lunas to restore in this request. 64 when left out, 1000 at most.
- `cursor` (object | null) — The \`cursor\` of the last page, to restore the next one.

Request body example:

```json
{
  "at": null,
  "lsn": null,
  "type": null,
  "key": {},
  "limit": null,
  "cursor": {}
}
```

**Responses**

- `200` — What this page restored.
- `default` — The request failed. The status says how and \`error.message\` says why.

Response example, 200:

```json
{
  "restored": 0,
  "skipped": 0,
  "failed": [
    {
      "key": {},
      "error": "string"
    }
  ],
  "cursor": {}
}
```
