Skip to content
Documentation
pozyskajpacjentaDocs

API referenceMedia

List media

GET/api/v1/media

Since
1.2.0
Auth
Bearer key
operationId
listMedia

The clinic's media library, newest first, up to 200 items.

Request

Send the clinic's key in Authorization: Bearer (see API keys).

No parameters and no body.

curl "https://app.pozyskajpacjenta.pl/api/v1/media" \
  -H "Authorization: Bearer $PP_API_KEY"
import { PozyskajPacjentaClient } from "@pozyskajpacjenta/sdk";

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

const { items } = await client.listMedia();
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/media',
    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

200The media library.

  • itemsMediaItem[]required

    The files.

    Fields of each item (12)
    • idstringrequired

      Media id.

    • r2Keystringrequireddeprecated

      Internal storage key. Deprecated: do not use it or build addresses from it; use url.

    • urlstringrequired

      Path of the file, e.g. /api/media-file/…

    • filenamestringrequired

      Original file name.

    • contentTypestring

      MIME type, e.g. image/webp. Listed by GET /media.

    • sizeinteger

      Size in bytes. Listed by GET /media.

    • altstring | null

      Alternative text; null when empty.

    • widthinteger | nullsince 1.4.0

      Width in px; null when it could not be read from the file.

    • heightinteger | nullsince 1.4.0

      Height in px; null when it could not be read.

    • aiGeneratedbooleansince 1.4.0

      The image was generated by AI.

    • captionstring | nullsince 1.4.0

      Caption; null when empty.

    • createdAtstring (date-time)since 1.9.1

      Upload time, ISO 8601. Sent by GET /media (since 1.2.0), not by POST /media.

The media library

{
  "items": [
    {
      "id": "G4DBcqheiu_BMwt3Y_c_L",
      "r2Key": "KdYaXquTXB/Hp7X9uzN-gabinet-zabiegowy.webp",
      "filename": "gabinet-zabiegowy.webp",
      "contentType": "image/webp",
      "size": 27044,
      "alt": "Gabinet zabiegowy z fotelem stomatologicznym",
      "width": 960,
      "height": 600,
      "aiGenerated": false,
      "caption": "Gabinet zabiegowy, parter",
      "createdAt": "2026-09-30T14:25:12.000Z",
      "url": "/api/media-file/KdYaXquTXB/Hp7X9uzN-gabinet-zabiegowy.webp"
    }
  ]
}

Errors

StatusWhen
401No Authorization header
401Unknown or rotated key
429Over 120 requests in this minute

Branch on the status and code, never on the Polish error text. All statuses in Errors.

401 · No Authorization header
{
  "error": "missing Authorization: Bearer <klucz z panelu Ustawienia>"
}
401 · Unknown or rotated key
{
  "error": "invalid key"
}
429 · Over 120 requests in this minute
{
  "error": "przekroczono limit 120 zapytań/min"
}

Rate limit

  • 120 requests per minute per key, shared by every endpoint.
  • Every response to a valid key carries RateLimit-Remaining and RateLimit-Reset; see Rate limits.

SDK method

client.listMedia(): Promise<{ items: MediaItem[] }>

The TypeScript tab above uses it. Install and errors: TypeScript SDK.