Aan de slag
Aan de slag
Vijf verzoeken, van een leeg account tot een gepubliceerd paspoort met een openbare link erop.
1.Een API-sleutel aanmaken
Sleutels worden in de instellingen aangemaakt. Een sleutel wordt één keer getoond, op het moment van aanmaken; daarna blijft alleen de identificatie zichtbaar.
Geef alleen de scopes die de koppeling werkelijk nodig heeft. Een sleutel die paspoorten wel mag lezen maar niet publiceren, zet nooit per ongeluk een catalogus online.
API-sleutels openen in de instellingenshellexport PASSPORTCRAFT_API_KEY=pc_sk_test_…2.De sleutel controleren
De eerste aanroep die de moeite waard is. Hij bevestigt dat de sleutel werkt, meldt of het om een productie- of testsleutel gaat, en somt de organisaties op waarvoor hij mag handelen, met de organisatie-id die elk volgend verzoek nodig heeft.
Volledige referentie van dit endpointVerzoekcurl "https://passportcraft.com/api/v1/whoami" \ -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY"Antwoord{ "object": "credential", "key_id": "K3n9Qw2P", "livemode": true, "owner_organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "expires_at": null, "last_used_at": "2026-08-02T07:41:03.220Z", "organizations": [ { "organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "scopes": [ "passports:read", "passports:write", "units:read", "units:write" ], "granted_at": "2026-07-14T11:02:19.004Z" } ] }3.Een paspoort maken
Een paspoort ontstaat als concept. Alleen de categorie is verplicht; het document wordt daarna veld voor veld gevuld, precies zoals in de editor.
Volledige referentie van dit endpointVerzoekcurl "https://passportcraft.com/api/v1/organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports" \ -X POST \ -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "category": "textile", "external_id": "SKU-4471-BLK", "data": { "product_name": "Merino Crew Neck", "product_description": "Mid-weight knitted crew neck in 100% merino wool.", "manufacturer_name": "Atelier Kestrel SAS", "manufacturer_address": "14 rue des Tanneurs, 59100 Roubaix", "manufacturer_country": "FR" } }'Antwoord{ "object": "passport", "id": "2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "name": "organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "category": "textile", "status": "draft", "gtin": null, "serial_number": null, "external_id": "SKU-4471-BLK", "version": 1, "livemode": true, "registry_id": null, "created_at": "2026-08-01T09:12:44.918Z", "updated_at": "2026-08-01T09:12:44.918Z", "published_at": null, "trashed_at": null, "data": { "product_name": "Merino Crew Neck", "product_description": "Mid-weight knitted crew neck in 100% merino wool.", "manufacturer_name": "Atelier Kestrel SAS", "manufacturer_address": "14 rue des Tanneurs, 59100 Roubaix", "manufacturer_country": "FR", "material_composition": [ { "fiber": "Merino wool", "percentage": 100 } ], "substances_of_concern": [ { "name": "None declared", "present": false } ] } }4.Controleren voor het publiceren
De controle schrijft niets weg. Ze meldt wat een publicatie zou blokkeren en wat slechts een advies is, zodat een koppeling het weet vóór de aanroep waar het om gaat.
Volledige referentie van dit endpointVerzoekcurl "https://passportcraft.com/api/v1/organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/validate" \ -X POST \ -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "data": { "material_composition": null } }'Antwoord{ "object": "validation", "id": "2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "name": "organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/validation", "organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "passport_id": "2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "category": "textile", "schema_version": "1.0.0-draft", "dry_run": true, "valid": false, "publishable": false, "error_count": 2, "warning_count": 0, "checked_at": "2026-08-02T08:26:11.409Z", "issues": [ { "object": "validation_issue", "field": "material_composition", "source": { "pointer": "/data/material_composition" }, "rule": "required", "severity": "error", "message": "Material Composition is required", "message_key": "required", "message_params": { "field": "Material Composition" }, "writable_via_api": true }, { "object": "validation_issue", "field": "gtin", "source": { "pointer": "/data/gtin" }, "rule": "required", "severity": "error", "message": "A GTIN is required before this passport can be published.", "writable_via_api": true } ] }5.Publiceren
Met publiceren wordt het paspoort leesbaar voor iedereen die het scant. De aanroep wordt geweigerd als een verplicht veld ontbreekt, als de GTIN ontbreekt of als het abonnement geen publicatieplaats meer vrij heeft.
Volledige referentie van dit endpointVerzoekcurl "https://passportcraft.com/api/v1/organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/publish" \ -X POST \ -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY" \ -H "Idempotency-Key: $(uuidgen)"Antwoord{ "object": "passport", "id": "2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "name": "organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "category": "textile", "status": "published", "gtin": "03453120000011", "serial_number": null, "external_id": "SKU-4471-BLK", "version": 4, "livemode": true, "registry_id": null, "created_at": "2026-08-01T09:12:44.918Z", "updated_at": "2026-08-01T14:03:22.501Z", "published_at": "2026-08-01T14:03:22.501Z", "trashed_at": null, "data": { "product_name": "Merino Crew Neck", "product_description": "Mid-weight knitted crew neck in 100% merino wool.", "manufacturer_name": "Atelier Kestrel SAS", "manufacturer_address": "14 rue des Tanneurs, 59100 Roubaix", "manufacturer_country": "FR", "material_composition": [ { "fiber": "Merino wool", "percentage": 100 } ], "substances_of_concern": [ { "name": "None declared", "present": false } ], "gtin": "03453120000011" }, "warnings": [ { "code": "environmental_claim_detected", "message": "This passport contains environmental claim language (carbon neutral). From 27 September 2026, Directive (EU) 2024/825 requires the trader placing the product on the market to hold substantiation for such claims. Publishing succeeded; confirm the substantiation exists.", "doc_url": "https://passportcraft.com/docs/api/errors#environmental_claim_detected" } ] }6.De openbare link ophalen
Geeft de openbare pagina terug, de GS1 Digital Link en precies het doel dat een gedrukte QR-code codeert: de waarde die naar de etikettendrukker gaat.
Volledige referentie van dit endpointVerzoekcurl "https://passportcraft.com/api/v1/organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/links" \ -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY"Antwoord{ "object": "passport_links", "id": "2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "name": "organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/links", "organization_id": "8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2", "passport": "organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "status": "published", "livemode": true, "gtin": "03453120000011", "serial_number": null, "public_url": "https://passportcraft.com/passport/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41", "qr_target": "https://passportcraft.com/01/03453120000011", "gs1_digital_link": { "uri": "https://passportcraft.com/01/03453120000011", "gtin14": "03453120000011", "serial": null, "linkset_url": "https://passportcraft.com/01/03453120000011?linkType=linkset", "unavailable_reason": null }, "resolves_publicly": true, "not_resolvable_reason": null }
Hoe verder
- Afspraken — nieuwe pogingen, paginering en voorwaardelijke schrijfacties.
- Fouten — de code waarop wordt vertakt wanneer een aanroep wordt geweigerd.
- Compatibiliteit — wat zonder aankondiging mag veranderen en wat niet.