---
title: Експорт на EPCIS събитията на паспорт
description: Експорт на пълната история на събитията на един паспорт като валиден GS1 EPCIS 2.0 EPCISDocument (JSON-LD). Влиза директно в EPCIS tooling.
canonical: "https://www.tracepass.eu/bg/docs/passport-epcis-export"
locale: bg
source: "https://www.tracepass.eu/bg/docs/passport-epcis-export"
---

# Експорт на EPCIS събитията на паспорт

> Експорт на пълната история на събитията на един паспорт като валиден GS1 EPCIS 2.0 EPCISDocument (JSON-LD). Влиза директно в EPCIS tooling.

```http
GET /api/v1/passports/{id}/epcis
```

Експортира пълната история на събитията на един паспорт — събития от веригата на доставки, обслужване, собственост и заснети събития — като един валиден според стандарта GS1 EPCIS 2.0 `EPCISDocument` в JSON-LD. Документът носи GS1 `@context`, `type: "EPCISDocument"`, `schemaVersion: "2.0"` и `epcisBody.eventList` с всяко събитие, което TracePass пази за паспорта. Digital Link URI на паспорта е EPC-то на всяко събитие, така че експортът се вписва директно във всяко EPCIS-съвместимо хранилище или одиторски инструментариум.

Алтернативна адресация: `GET /api/v1/passports/by-serial/{serial}/epcis` връща същия EPCISDocument за паспорт, адресиран по серийния си номер вместо по ID — удобно, когато вашите системи работят със серийния номер на GS1, а не с TracePass ObjectId. Брои се като едно четене на паспорт.

EPCIS експортът е достъпен от плановете Starter нагоре: на план без него endpoint-ът връща `403 {"error":"epcis_export_not_available"}`. Непознато id на паспорт връща `404`.

## 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 | ObjectId | yes | ID на паспорта. Използвайте `GET /api/v1/passports/by-serial/{serial}/epcis`, за да адресирате паспорта по серийния му номер на GS1. |

## Examples

```bash
# By passport ID
curl -sS https://app.tracepass.eu/api/v1/passports/6650b2c3d4e5f6a7b8c9d0e1/epcis \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx"

# By GS1 serial number
curl -sS https://app.tracepass.eu/api/v1/passports/by-serial/BP-48V-100-000001/epcis \
  -H "Authorization: Bearer tp_REDACTED_xxxxxxxxxxxx"
```

```typescript
const res = await fetch(
  `https://app.tracepass.eu/api/v1/passports/${passportId}/epcis`,
  { headers: { Authorization: `Bearer ${process.env.TRACEPASS_API_KEY}` } },
);
if (res.status === 404) return null;
const epcisDocument = await res.json(); // EPCISDocument, schemaVersion 2.0
console.log(epcisDocument.epcisBody.eventList.length, "events");
```

```python
import os, requests

res = requests.get(
    f"https://app.tracepass.eu/api/v1/passports/{passport_id}/epcis",
    headers={"Authorization": f"Bearer {os.environ['TRACEPASS_API_KEY']}"},
)
res.raise_for_status()
epcis_document = res.json()  # EPCISDocument, schemaVersion 2.0
print(len(epcis_document["epcisBody"]["eventList"]), "events")
```

## Responses

### 200 — OK

```json
{
  "@context": "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld",
  "type": "EPCISDocument",
  "schemaVersion": "2.0",
  "creationDate": "2026-05-09T12:00:00.000Z",
  "epcisBody": {
    "eventList": [
      {
        "type": "ObjectEvent",
        "eventID": "ni:///sha-256;9f86d0...?ver=CBV2.0",
        "eventTime": "2026-05-09T11:58:00.000Z",
        "eventTimeZoneOffset": "+02:00",
        "epcList": ["https://id.tracepass.eu/p/01/04012345000016/21/BP-48V-100-000001"],
        "action": "OBSERVE",
        "bizStep": "shipping",
        "bizLocation": { "id": "https://id.tracepass.eu/loc/acme-batteries-de" }
      }
    ]
  }
}
```

### 401 — Липсва API ключ

```json
{ "error": "Missing or invalid API key" }
```

### 403 — Не е в плана

```json
{ "error": "epcis_export_not_available" }
```

### 404 — Не е намерен

```json
{ "error": "Passport not found" }
```

## Related

- [Заявяване на EPCIS събития](https://www.tracepass.eu/bg/docs/query-events.md)
- [Масов JSON-LD експорт за тенант](https://www.tracepass.eu/bg/docs/tenant-export.md)
