# `album.getPublic`

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

**Get a published album's visitor header**

Returns only visitor metadata. Token-addressed link-only albums omit their album UUID and canonical URL.

## Parameters

Passed by name in the `params` object.

| Name | Type | Required | Description |
|---|---|---|---|
| `alias` | string | no | Album alias (public albums only) |
| `id` | string | no | Album UUID (public albums only) |
| `token` | string | no | Share-link token |

## Result

Returns `Album`:

| Field | Type | Description |
|---|---|---|
| `allow_download *` | boolean |  |
| `canonical_url` | string |  |
| `cover` | `Image` |  |
| `cover_focus *` | string |  |
| `dates` | `Dates` |  |
| `description *` | string |  |
| `feed_url` | string |  |
| `id` | string |  |
| `mode *` | string |  |
| `photo_count *` | integer |  |
| `report *` | `Report` |  |
| `title *` | string |  |

## Errors

| Code | Message | When |
|---|---|---|
| `2001` | `not_found` | No such resource owned by the caller. |
| `2002` | `validation_failed` | Malformed request; see error.data. |
| `4002` | `rate_limited` | Too many requests; wait before retrying. |

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

## Example

Request:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "album.getPublic",
  "params": {
    "token": "abcdefghijklmnopqrstuv"
  }
}
```

Response:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "mode": "unlisted",
    "title": "Trip",
    "description": "",
    "photo_count": 1,
    "cover": {
      "id": "018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d",
      "index": 1,
      "title": "Mountain pass",
      "description": "",
      "alt": "Mountain pass",
      "width": 640,
      "height": 480,
      "renders": [
        {
          "url": "https://img.example.com/r/018f3a7d-2b8c-7f1a-a4d5-6e7f8a9b0c1d/medium.webp?v=1",
          "format": "webp",
          "width": 640,
          "height": 480
        }
      ]
    },
    "cover_focus": "center",
    "allow_download": false,
    "report": {
      "enabled": false,
      "contact_email": "abuse@example.com",
      "policy_url": "https://app.example.com/abuse-policy"
    }
  }
}
```

**curl**

```bash
curl -s https://peinture.gumeniuk.com/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"album.getPublic","params":{"token":"abcdefghijklmnopqrstuv"}}'
```

**JavaScript**

```js
const res = await fetch("https://peinture.gumeniuk.com/rpc", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0", id: 1, method: "album.getPublic", params: {"token":"abcdefghijklmnopqrstuv"},
  }),
});
const { result, error } = await res.json();
```

**Go**

```go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"album.getPublic","params":{"token":"abcdefghijklmnopqrstuv"}}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
```

