Skip to content

Getting started

Getting started

Five requests from an empty account to a published passport with a public link on it.

  1. 1.Mint an API key

    Keys are created in Settings. A key is shown once, at the moment it is created; afterwards only its identifier stays visible.

    Grant only the scopes the integration actually needs. A key that can read passports but not publish them cannot take a catalogue live by accident.

    Open API keys in Settings
    shell
    export PASSPORTCRAFT_API_KEY=pc_sk_test_…
  2. 2.Check the credential

    The first call worth making. It confirms the key works, reports whether it is a live or a test credential, and lists the organizations it may act for — the organization id every later request needs.

    Request
    curl "https://passportcraft.com/api/v1/whoami" \
      -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY"
    Response
    {
      "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"
        }
      ]
    }
    Full reference for this endpoint
  3. 3.Create a passport

    A passport is created as a draft. Only the category is required; the document can be filled in field by field afterwards, exactly as it is in the editor.

    Request
    curl "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"
      }
    }'
    Response
    {
      "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": [
          "None above threshold"
        ]
      }
    }
    Full reference for this endpoint
  4. 4.Check it before publishing

    Validation writes nothing. It reports what would block a publish and what is merely advisory, so an integration finds out before the call that matters.

    Request
    curl "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
      }
    }'
    Response
    {
      "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
        }
      ]
    }
    Full reference for this endpoint
  5. 5.Publish it

    Publishing makes the passport readable by anyone who scans it. It is refused if a required field is missing, if the GTIN is absent, or if the plan has no publish slot left.

    Request
    curl "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)"
    Response
    {
      "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": [
          "None above threshold"
        ],
        "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"
        }
      ]
    }
    Full reference for this endpoint
  6. 6.Fetch the public link

    Returns the public page, the GS1 Digital Link, and the exact target a printed QR code encodes — the value to hand to a label printer. It also returns preview_url, an address a member of your organization can open while signed in to PassportCraft. It is filled whenever the passport does not resolve publicly — a test passport never does — and empty once it resolves. On a test key it opens the product page as a shopper would see it, under a bar marking it as a test passport.

    Request
    curl "https://passportcraft.com/api/v1/organizations/8f14e45f-ceea-467a-9a5f-8dc7d9c6a1b2/passports/2c1f9e07-3b4d-4a18-9f6c-5e0a7b8d3c41/links" \
      -H "Authorization: Bearer $PASSPORTCRAFT_API_KEY"
    Response
    {
      "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,
      "preview_url": null
    }
    Full reference for this endpoint

Where to go next

  • Conventionsretries, pagination and conditional writes.
  • Errorsthe code to branch on when a call is refused.
  • Compatibilitywhat may change without warning, and what may not.
Getting started with the PassportCraft API | PassportCraft