{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/certifier-io/json-schema/certifier-io-credential-schema.json",
  "title": "Credential",
  "x-generated": "2026-11-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/certifier-io-openapi.json#/components/schemas/Credential",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique credential's identifier"
    },
    "publicId": {
      "type": "string",
      "format": "uuid",
      "description": "The external unique credential's identifier (used in the digital wallet to generate a URL, e.g. https://credsverse.com/credentials/{publicId})"
    },
    "groupId": {
      "type": "string",
      "description": "The unique identifier of the group (credential template)."
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "scheduled",
        "issued",
        "expired"
      ],
      "description": "The status of the credential"
    },
    "recipient": {
      "$ref": "#/$defs/Recipient"
    },
    "issueDate": {
      "type": [
        "string",
        "null"
      ],
      "description": "The issuer-claimed issue date. It can be null on a draft until a date is chosen or the credential is issued (YYYY-MM-DD)."
    },
    "expiryDate": {
      "type": [
        "string",
        "null"
      ],
      "description": "The issuer-claimed expiration date. It can be null when the credential never expires or a draft has not resolved its template period (YYYY-MM-DD)."
    },
    "attributes": {
      "type": "object",
      "additionalProperties": {
        "nullable": true
      },
      "description": "The key-value object of the credential's attributes. Currently this can only be the recipient.name, configured on a per-credential basis"
    },
    "customAttributes": {
      "type": "object",
      "additionalProperties": {
        "nullable": true
      },
      "description": "The key-value object of your custom attributes, where key is your attribute's tag and value is the text value you want to store"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time when this credential was created. Formatted as an ISO 8601 date and time string"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time when this credential was updated. Formatted as an ISO 8601 date and time string"
    }
  },
  "required": [
    "id",
    "publicId",
    "groupId",
    "status",
    "recipient",
    "issueDate",
    "expiryDate",
    "attributes",
    "customAttributes",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "Recipient": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "The credential recipient's unique identifier"
        },
        "name": {
          "type": "string",
          "description": "The name of the credential's recipient"
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "The email of the credential's recipient"
        }
      },
      "required": [
        "id",
        "name",
        "email"
      ],
      "description": "The recipient object (if an email was provided)"
    }
  }
}