A credential offer is one wallet handoff. It references a credential definition and includes the claims for the credential you want to issue.
Every offer must reference a definition that already exists for the project behind your secret key. If neither the supplied credentialDefinitionId nor vct resolves, the API returns 404 credential_definition_not_found. See troubleshooting and the idempotent ensure helper in Issue with Next.js.

Create an offer by definition ID

POST /v1/openid4vc/issuance/offer
const offer = await authbound.openId4Vc.issuance.createOffer({
  credentialDefinitionId: "pension_credential_v1",
  claims: {
    Person: {
      given_name: "Sergio",
      family_name: "Jack",
    },
    Pension: {
      startDate: "2025-01-01",
    },
  },
  issuanceMode: "InTime",
  idempotencyKey: "pension:user_123:2025",
});

Create an offer by VCT

Use vct when you want Authbound to resolve the configured definition. POST /v1/openid4vc/issuance/offer
await authbound.openId4Vc.issuance.createOffer({
  vct: "urn:vc:authbound:pension:1.0",
  claims: {
    Pension: {
      startDate: "2025-01-01",
    },
  },
});

Protect an offer with a PIN

Anyone who scans an offer’s QR code or opens its link can collect the credential. For a credential with personal data, add a PIN so that only the person you meant it for can:
import { randomInt } from "node:crypto";

const pin = randomInt(0, 1_000_000).toString().padStart(6, "0");

const offer = await authbound.openId4Vc.issuance.createOffer({
  credentialDefinitionId: "pension_credential_v1",
  claims: { /* ... */ },
  txCode: pin,
});
The wallet asks for the PIN before it collects the credential. Show the PIN to the user through a different channel from the QR code, such as your signed-in page, an email or a text message. Someone who only sees the QR code, for example over the user’s shoulder or in a screenshot, can’t use it.
  • Use digits only. Wallets show a numeric keypad for the PIN.
  • Generate a new random PIN for every offer.
Every offer also has these protections, with or without a PIN:
  • It can be collected once. A second attempt fails.
  • It expires. Check expiresAt on the offer.
  • The credential is tied to the wallet that collected it, so a copy of it doesn’t work from another wallet.
  • The offer itself contains no personal data. The claims are only sent to the wallet that collects it.

Return the wallet URI

return Response.json({
  issuanceId: offer.id,
  offerUri: offer.offerUri,
  offerQrUri: offer.offerQrUri,
  expiresAt: offer.expiresAt,
});

Issuance status

offer_created, ready_to_issue, and token_issued are intermediate states. credential_issued means the issuer completed issuance. canceled, expired, and failed end the attempt without successful issuance. These server states alone do not prove a later wallet presentation succeeded. Revocation is separate: inspect credentialStatus and revokedAt. Revoking an issued credential does not change its issuance status from credential_issued.

Check status

GET /v1/openid4vc/issuance/{issuanceId}
const latest = await authbound.openId4Vc.issuance.get(offer.id);

switch (latest.status) {
  case "credential_issued":
    await markCredentialIssued(latest.id);
    break;
  case "canceled":
  case "expired":
  case "failed":
    await markCredentialNotIssued(latest.id);
    break;
}

Cancel an offer

POST /v1/openid4vc/issuance/{issuanceId}/cancel
if (offer.status === "offer_created") {
  await authbound.openId4Vc.issuance.cancel(offer.id);
}

Metadata field rule

Offer metadata only accepts string values (Record<string, string>). Stringify numbers, booleans, or nested objects before sending:
metadata: {
  userId: "user_123",
  tier: "gold",
  amountCents: String(amountCents),
  isTrial: String(isTrial),
}
Sending non-string values returns 400 validation_error. Definition metadata accepts arbitrary JSON values, so this rule is offer-specific.

List issuance sessions

const page = await authbound.openId4Vc.issuance.list({ limit: 25 });
Use page.data for history and reconciliation. New wallet handoff data comes from createOffer.