# List the site's redirects

`GET https://app.pozyskajpacjenta.pl/api/v1/redirects` · operationId `listRedirects` · since 1.28.0 · tag Content

The old addresses the clinic's site serves now and where each leads: the snapshot the site itself reads. A sub-page whose address changes in the panel leaves one behind, so a frontend of its own needs this list to answer the old address instead of a 404. An empty list when the clinic has no redirects. Responses are private to the key: `Cache-Control: private, max-age=60`, so cache them on your side for up to a minute.

## Request

Authorization: `Bearer <the clinic's key>`.

### cURL

```bash
curl "https://app.pozyskajpacjenta.pl/api/v1/redirects" \
  -H "Authorization: Bearer $PP_API_KEY"
```

### TypeScript

```ts
import { PozyskajPacjentaClient } from "@pozyskajpacjenta/sdk";

const client = new PozyskajPacjentaClient({
  apiKey: process.env.PP_API_KEY ?? "",
  baseUrl: "https://app.pozyskajpacjenta.pl",
});

const { redirects } = await client.listRedirects();
```

### PHP

```php
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/redirects',
    array(
        'headers' => array( 'Authorization' => 'Bearer ' . getenv( 'PP_API_KEY' ) ),
        'timeout' => 10,
    )
);
if ( is_wp_error( $response ) ) {
    error_log( $response->get_error_message() );
    return;
}
$status = wp_remote_retrieve_response_code( $response );
$data   = json_decode( wp_remote_retrieve_body( $response ), true );
```

## Response

### 200: The site's redirects.

- `redirects` (`RedirectRule[]`, required): The old addresses and where they lead.
  - `from` (`string`, required): The old path, with its query when the rule has one.
  - `to` (`string`, required): The path on this site. Chains are already flattened: this is the final address.
  - `status` (`integer`, required): `301` for a permanent move, `302` for a temporary one. One of `301`, `302`.

Example (A sub-page moved to a new address, and an old address of the clinic's site):

```json
{
  "redirects": [
    {
      "from": "/implanty",
      "to": "/implanty-zebow",
      "status": 301
    },
    {
      "from": "/uslugi/implanty",
      "to": "/implanty-zebow",
      "status": 301
    }
  ]
}
```

## Errors

| Status | code | When |
| --- | --- | --- |
| 401 |  | No Authorization header |
| 401 |  | Unknown or rotated key |
| 429 |  | Over 120 requests in this minute |

401 (No Authorization header):

```json
{
  "error": "missing Authorization: Bearer <klucz z panelu Ustawienia>"
}
```

401 (Unknown or rotated key):

```json
{
  "error": "invalid key"
}
```

429 (Over 120 requests in this minute):

```json
{
  "error": "przekroczono limit 120 zapytań/min"
}
```

## Rate limit

- 120 requests per minute per key, shared by every endpoint.

## SDK method

`client.listRedirects(): Promise<{ redirects: RedirectRule[] }>`
