---
title: Рендиране на QR на страницата на модела
description: "Рендиране на QR кода на страницата на модела на продукт (/01/{gtin}) като SVG или PNG: кодът за онлайн обява или за търговец. Черен на прозрачен фон."
canonical: "https://www.tracepass.eu/bg/docs/get-product-model-qr"
locale: bg
source: "https://www.tracepass.eu/bg/docs/get-product-model-qr"
---

# Рендиране на QR на страницата на модела

> Рендиране на QR кода на страницата на модела на продукт (/01/{gtin}) като SVG или PNG: кодът за онлайн обява или за търговец. Черен на прозрачен фон.

```http
GET /api/v1/products/{id}/links/model-qr
```

Рендира QR кода на страницата на модела на продукта, чистия GS1 адрес `/01/{gtin}`, посочен в `GET /api/v1/products/{id}/links`. Страницата на модела показва само публичните стойности, еднакви във всеки публикуван екземпляр, затова кодът е подходящ за онлайн обява или за търговец; всеки екземпляр запазва собствения си паспорт. Черен на прозрачен фон. Брои се като едно v1 четене.

Връща 404 `model_not_found`, когато продуктът няма публикуван GS1 паспорт с този GTIN (т.е. няма страница на модела), 400 `invalid_gtin`, когато `gtin` не е 14 цифри, и 400 `gtin_required`, когато публикуваните паспорти на продукта носят повече от един GTIN, а `gtin` липсва.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Authorization` | header | string | yes | `Bearer <token>` — или `tp_` API ключ (Developer → API Keys; най-просто, за server-to-server), или OAuth 2.0 access token (Developer → OAuth Apps; за приложения, авторизирани от потребител, scoped и отзоваеми). Страницата Authentication съдържа пълния OAuth поток и списъка със scopes. |
| `id` | path | string (24 hex chars) | yes | ID на продукта. |
| `format` | query | string | no | `svg` (по подразбиране) или `png`. |
| `gtin` | query | string (14 digits) | no | Нужен само когато публикуваните паспорти на продукта носят повече от един GTIN. |

## Examples

```bash
# SVG (default)
curl -sS https://app.tracepass.eu/api/v1/products/6650a1b2c3d4e5f6a7b8c9d0/links/model-qr \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx" -o model-qr.svg

# PNG for one GTIN
curl -sS "https://app.tracepass.eu/api/v1/products/6650a1b2c3d4e5f6a7b8c9d0/links/model-qr?format=png&gtin=09506000134352" \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx" -o model-qr.png
```

```typescript
const url = new URL(
  `https://app.tracepass.eu/api/v1/products/${id}/links/model-qr`,
);
url.searchParams.set("format", "png");

const res = await fetch(url, {
  headers: { Authorization: `Bearer ${process.env.TRACEPASS_API_KEY}` },
});
if (!res.ok) throw new Error(`Model QR failed: ${res.status}`);
const pngBytes = new Uint8Array(await res.arrayBuffer());
```

```python
import os, requests
res = requests.get(
    f"https://app.tracepass.eu/api/v1/products/{product_id}/links/model-qr",
    headers={"Authorization": f"Bearer {os.environ['TRACEPASS_API_KEY']}"},
    params={"format": "png"},
)
res.raise_for_status()
open("model-qr.png", "wb").write(res.content)
```

## Responses

### 200 — SVG

```json
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29">
  <!-- QR modules encoding https://id.tracepass.eu/01/<gtin> -->
</svg>
```

### 400 — Нужен е GTIN

```json
{ "error": "gtin_required", "message": "This product has published passports under more than one GTIN; pass ?gtin=.", "gtins": ["09506000134352", "09506000134369"] }
```

### 404 — Няма страница на модела

```json
{ "error": "model_not_found", "message": "This product has no model page for that GTIN." }
```

## Related

- [Пакет връзки за търговци](https://www.tracepass.eu/bg/docs/get-product-links.md)
- [Рендиране на QR на паспорт](https://www.tracepass.eu/bg/docs/passport-qr.md)
