Dokumentacja

Publiczne API

Zautomatyzuj swoje Cyfrowe Paszporty Produktów: twórz i aktualizuj produkty, publikuj paszporty, czytaj szablony i importuj katalogi przez proste REST API. Uwierzytelnianie kluczem API.

Wymagany plan

API jest dostępne w każdym planie, także w Free — plany różnią się dziennym limitem, a nie dostępem. Każde żądanie ponownie sprawdza Twoje aktualne uprawnienia.

Adres bazowy

Wszystkie punkty końcowe są dostępne pod prefiksem /v1 w Twojej domenie CyfroPass.

https://<your-domain>/v1

Uwierzytelnianie

Utwórz klucz jako właściciel w Ustawienia → Klucze API. Wyślij go jako token bearer lub w nagłówku X-API-Key. Surowy klucz jest pokazywany tylko raz.

Authorization: Bearer cp_live_…
X-API-Key: cp_live_…

Limity zapytań

Egzekwowanie to dzienny limit (UTC), podzielony na zapisy/dzień (POST/PATCH/PUT/DELETE) i odczyty paszportów/dzień (GET). Free: 100 zapisów + 100 odczytów/dzień; Starter: 1000 zapisów/dzień, odczyty bez limitu; Business i Scale: bez limitu. Po osiągnięciu limitu otrzymasz 429 z komunikatem o dziennym limicie; okno resetuje się o 00:00 UTC. Wysyłaj nagłówek Idempotency-Key przy zapisach, aby bezpiecznie ponawiać — pierwsza odpowiedź jest odtwarzana przez 24 godziny.

Format błędu

Każdy błąd używa jednolitej koperty JSON ze stabilnym, maszynowo czytelnym kodem.

{
  "error": {
    "code": "not_found",
    "message": "not found"
  }
}

Referencja

Punkty końcowe

Products

Manage the product catalogue (SKUs) and the documents attached to each product.

GET /products List products (paginated, filterable).
POST /products Create a product from a template version.
GET /products/{id} Fetch one product.
PATCH /products/{id} Update mutable fields; data is merged.
DELETE /products/{id} Delete a draft product. (409 if published)
GET /products/{id}/documents List a product's documents.
POST /products/{id}/documents Upload a document (multipart, ≤ 25 MiB).
GET /products/{id}/documents/{docID} Download a document.
DELETE /products/{id}/documents/{docID} Delete a document.
curl https://app.passflow.example/v1/products \
  -H "Authorization: Bearer cp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Passports

Publish, re-publish and archive passports, and read their immutable version history. Passport routes are keyed by product id.

GET /passports/products/{productID} Current passport (with snapshot).
POST /passports/products/{productID}/publish Publish or re-publish. (422 on validation failure)
POST /passports/products/{productID}/archive Archive the current passport.
GET /passports/products/{productID}/versions Version history (metadata).
GET /passports/products/{productID}/versions/{version} One version's snapshot.
curl -X POST \
  https://app.passflow.example/v1/passports/products/PRODUCT_ID/publish \
  -H "Authorization: Bearer cp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Templates

Read the platform-provided, versioned product-group templates and validate product data against them. Templates are read-only over the API.

GET /templates List templates and their versions.
GET /templates/field-types The generic field-type registry.
GET /templates/{id} List versions of one template.
GET /templates/{id}/{version} Full template document (sections, fields).
POST /templates/{id}/{version}/validate Validate data against a version.
GET /templates/{id}/diff Diff two versions (from, to).
curl https://app.passflow.example/v1/templates/textile/2026-draft-1 \
  -H "Authorization: Bearer cp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Import

Bulk-import products from a CSV file or a connected Shopify / WooCommerce / PrestaShop store. Every fetch becomes an import job with the same map → validate → execute lifecycle.

POST /import/upload Upload a CSV (multipart, ≤ 10 MB).
POST /import/sources/test Test a store connector.
POST /import/sources/fetch Fetch a store catalogue into a job.
POST /import/{job}/mapping-suggest Suggest a column → field mapping.
POST /import/{job}/validate Validate mapped rows (no products created).
POST /import/{job}/execute Create products from valid rows. (idempotent)
GET /import/{job} Get import job status.
curl -X POST https://app.passflow.example/v1/import/upload \
  -H "Authorization: Bearer cp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "file=@products.csv"

Pełna, maszynowo czytelna specyfikacja jest dostępna jako openapi.yaml.