# `album.sharing.republish`

<span class="badge">bearer</span>

**Restore the previous publication mode**

Restores private publication memory atomically. For unlisted memory, token new (default) rotates the link and keep preserves it; public memory ignores token. Reactivating expired aliases must fit the owner alias limit.

## Parameters

Passed by name in the `params` object.

| Name | Type | Required | Description |
|---|---|---|---|
| `album_id` | string | yes |  |
| `token` | string (enum) | no |  |

## Result

Returns `sharingDTO`:

| Field | Type | Description |
|---|---|---|
| `album_id *` | string |  |
| `alias_quota *` | `aliasQuotaDTO` |  |
| `aliases *` | `array<aliasDTO>` |  |
| `cover *` | `coverDTO` |  |
| `last_published_mode` | string |  |
| `links *` | `sharingLinksDTO` |  |
| `mode *` | string |  |
| `moderation` | `sharingModerationDTO` |  |
| `policy *` | `sharingPolicyDTO` |  |
| `published_at` | string |  |
| `republish` | `republishDTO` |  |
| `server_publishing *` | boolean |  |
| `state *` | string |  |
| `stats *` | `sharingStatsDTO` |  |

## Errors

| Code | Message | When |
|---|---|---|
| `2001` | `not_found` | No such resource owned by the caller. |
| `1003` | `forbidden` | Not the owner, or outside a token's scope. |
| `2004` | `taken_down` | Moderation prevents this operation on the resource. |
| `2002` | `validation_failed` | Malformed request; see error.data. |

See the [error reference](/docs/errors) for the full catalog, including the authentication codes.

## Example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "album.sharing.republish",
  "params": {
    "album_id": "018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50"
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "album_id": "018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50",
    "mode": "private",
    "state": "private",
    "links": {},
    "aliases": [],
    "alias_quota": {
      "used": 0,
      "limit": 20
    },
    "policy": {
      "show_location": false,
      "show_date": true,
      "show_camera": false,
      "allow_download": false,
      "feed": true,
      "order": "taken_asc",
      "cover_focus": "center"
    },
    "cover": {
      "is_default": true,
      "was_reset": false
    },
    "stats": {
      "visible": 0,
      "total": 0,
      "breakdown": {
        "processing": 0,
        "failed": 0,
        "too_small": 0,
        "taken_down": 0
      },
      "exif": {
        "location": {
          "visible": 0,
          "disabled_on_photo": 0
        },
        "date": {
          "visible": 0,
          "disabled_on_photo": 0
        },
        "camera": {
          "visible": 0,
          "disabled_on_photo": 0
        }
      },
      "captioned": 0,
      "exposing_location": 0
    },
    "server_publishing": true
  }
}
```

**curl**

```bash
curl -s https://peinture.gumeniuk.com/rpc \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"album.sharing.republish","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50"}}'
```

**JavaScript**

```js
const res = await fetch("https://peinture.gumeniuk.com/rpc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${token}`,
  },
  body: JSON.stringify({
    jsonrpc: "2.0", id: 1, method: "album.sharing.republish", params: {"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50"},
  }),
});
const { result, error } = await res.json();
```

**Go**

```go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"album.sharing.republish","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50"}}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)
```

