## Page public URL

`GET /v1/pages/:id/public-url`

Returns the full URL where visitors open the page on the Bitrix24 site.

Requires the `landing` scope. A read-only key can call this method.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Page ID. List: [`GET /v1/pages`](/docs/entities/pages/list) |
| `scope` (query) | string | no | Site type: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup site, `MAINPAGE` — main page. Omit the parameter for pages of other sites |

## Examples

### curl — personal key

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/pages/7/public-url" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/pages/7/public-url" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/7/public-url", {
  method: "GET",
  headers: {"X-Api-Key": "YOUR_API_KEY"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

### JavaScript — OAuth application

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/7/public-url", {
  method: "GET",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN"},
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | object | Page address |
| `data.url` | string | Full page address on the site |
| `data.published` | boolean | Whether the page is published |

## Response example

```json
{
  "success": true,
  "data": {
    "url": "https://example.bitrix24.site/change/test/",
    "published": true
  }
}
```

## Error response example

404 — no page with this `id`:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Page not found."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | `Page not found.` — no page with this `id` |
| 404 | `ENTITY_NOT_FOUND` | `Page or folder not found.` — Bitrix24 did not find the page when the address was requested |
| 400 | `INVALID_PAGE_ID` | `id must be a positive safe integer.` — `id` is not a positive integer |
| 400 | `INVALID_SCOPE` | `scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted.` — `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 did not return a page URL.` — Bitrix24 did not return the page address |
| 422 | `BITRIX_NO_EFFECT` | `Bitrix24 returned an invalid page URL.` — Bitrix24 returned an incomplete address, an address that is not `http` or `https`, or an address with a login and password |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request. The error text comes from Bitrix24 |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user on whose behalf the key was issued has no permission to read the page |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not provided |
| 401 | `INVALID_API_KEY` | The key in `X-Api-Key` is not found or has been revoked |
| 409 | `PORTAL_ADDRESS_CHANGED` | The on-premise Bitrix24 moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook |
| 429 | `RATE_LIMITED` | The Bitrix24 request limit is exceeded. Retry the request in 1-2 seconds |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 did not respond or responded with a server error |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond within the allotted time |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **The address is returned for an unpublished page too.** Having an address does not mean a site visitor will see the page: check the `published` field.

## See also

- [Find a page by address](/docs/entities/pages/resolve)
- [Page preview](/docs/entities/pages/preview)
- [Get a page](/docs/entities/pages/get)
- [Pages](/docs/entities/pages)
