> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baselayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview what a mint would disclose

> Takes the mint body and returns the exact leaves a mint with the same body would disclose, one entry per credential the mint would produce. A business preview also returns the operator authorization the credential always carries. Runs the mint's validation and refusals; signs, stores and allocates nothing.



## OpenAPI

````yaml /api-reference/openapi.json post /issuance/credentials/preview
openapi: 3.1.0
info:
  title: baselayer-api-service
  version: 0.1.0
servers:
  - url: https://api.baselayer.com/
security: []
paths:
  /issuance/credentials/preview:
    post:
      tags:
        - Credentials
      summary: Preview what a mint would disclose
      description: >-
        Takes the mint body and returns the exact leaves a mint with the same
        body would disclose, one entry per credential the mint would produce. A
        business preview also returns the operator authorization the credential
        always carries. Runs the mint's validation and refusals; signs, stores
        and allocates nothing.
      operationId: issuance_credentials_preview
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1.CredentialPreviewRequest'
          application/vnd.baselayer.v1+json:
            schema:
              $ref: '#/components/schemas/v1.CredentialPreviewRequest'
        required: true
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1.CredentialPreviewResponse'
            application/vnd.baselayer.v1+json:
              schema:
                $ref: '#/components/schemas/v1.CredentialPreviewResponse'
        '404':
          description: >-
            A reference is unknown or was issued to another organization — the
            cases are indistinguishable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
                title: ResourceNotFound
                description: Could not locate the resource for the given URI.
                examples:
                  - type: resource_not_found
                    code: 1
                    message: Could not locate the resource for the given URI.
                    metadata: {}
        '409':
          description: >-
            The mint would be refused: the person has no accepted identity
            record, or (business) the business verification is undated or past
            its limit (`credential_snapshot_not_current`, `metadata.reason`
            `no_identity_record` or `business_verification_out_of_date`), or the
            operator link is not verified or the business or its actor lacks
            keys the credential requires (`business_credential_missing_keys`,
            whose `metadata.missing_keys` lists the keys it lacks).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            The body failed validation, the audience cannot be canonicalized, or
            a path is outside the vault schema or one the person's record cannot
            back (`credential_field_not_backed`, whose
            `metadata.unbacked_fields` lists each path as `{role, field,
            reason}`, `reason` being `not_proved` or `not_on_file`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - APIKeyHeader: []
components:
  schemas:
    v1.CredentialPreviewRequest:
      description: >-
        Body for ``POST /issuance/credentials/preview``: the mint body,
        previewed.
      discriminator:
        mapping:
          business: '#/components/schemas/v1.BusinessCredentialPreviewRequest'
          individual: '#/components/schemas/v1.IndividualCredentialPreviewRequest'
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/v1.IndividualCredentialPreviewRequest'
        - $ref: '#/components/schemas/v1.BusinessCredentialPreviewRequest'
      title: CredentialPreviewRequest
    v1.CredentialPreviewResponse:
      description: >-
        Body of ``POST /issuance/credentials/preview``: what a mint with the
        same body

        would disclose, without signing, storing or allocating anything. It

        refuses as the mint would, so a requested path with nothing to back it

        is refused here too.
      properties:
        environment:
          $ref: '#/components/schemas/v1.ApplicationType'
          description: >-
            The application lane the mint would run in: `production` for a live
            application, `sandbox` for a test one. A self-mint has no test
            application, so it is always `production`. The lane does not name
            the deployment: read that from the token's `iss`, in the
            issuer-signed JWT payload (the segment before the first `~`).
        ttl_capped:
          description: >-
            Whether supporting evidence expiry would shorten the requested
            validity.
          title: Ttl Capped
          type: boolean
        credentials:
          description: The credentials a mint would produce, subject first.
          items:
            $ref: '#/components/schemas/v1.CredentialPreviewEntry'
          title: Credentials
          type: array
      required:
        - environment
        - ttl_capped
        - credentials
      title: CredentialPreviewResponse (v1)
      type: object
    Error:
      properties:
        type:
          type: string
          title: Type
          description: >-
            Stable snake_case name of the error. Branch on this, never on
            `message`.
        code:
          type: integer
          title: Code
          description: Integer catalog code of the error.
        message:
          type: string
          title: Message
          description: For a person reading a log; not stable and not localized.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Context documented per `type`.
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: The `X-Request-ID` of the failed request.
      type: object
      required:
        - type
        - code
        - message
      title: Error
      description: The one body of every error a KYA route answers.
    v1.BusinessCredentialPreviewRequest:
      additionalProperties: false
      description: |-
        The business mint body, so one body previews and then mints.
        ``agent_key`` is optional and unused.
      properties:
        format:
          $ref: '#/components/schemas/v1.CredentialWireFormat'
          default: dc+sd-jwt
          description: >-
            Credential wire format. `dc+sd-jwt` (media type
            `application/dc+sd-jwt`, draft-ietf-oauth-sd-jwt-vc-19 §2.1) is the
            only format issued.
        ttl_seconds:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          default: null
          description: >-
            Maximum credential validity in seconds, capped at supporting
            evidence expiry. Omitted or null uses the server default (3600
            seconds). Must not exceed the configured maximum (86400 seconds by
            default).
          title: Ttl Seconds
        audience:
          description: >-
            The counterparty the credential is scoped to: a bare domain
            (`login.example.com`), or an https authorization-server identifier
            (`https://login.example.com`) kept whole, which derives a different
            pairwise subject than the bare host. Paths, queries, fragments and
            non-default ports are refused.
          maxLength: 512
          minLength: 1
          title: Audience
          type: string
        disclosed_fields:
          description: >-
            The dotted disclosure paths the subject credential should carry,
            e.g. `email`, or `hashes.email` for its recognition hash alone. A
            path the person's record cannot back is refused. A business mint
            lists business paths here and the actor credential's paths, e.g.
            `given_name`, in `actor_disclosed_fields`. Neither this nor
            `preset`: a pairwise-only credential.
          items:
            type: string
          maxItems: 64
          title: Disclosed Fields
          type: array
        preset:
          anyOf:
            - $ref: '#/components/schemas/v1.CredentialPreset'
            - type: 'null'
          default: null
          description: >-
            Disclose a use case's fields instead of listing `disclosed_fields`;
            never both. `GET /issuance/credentials/presets` lists each preset's
            paths, and every one must be backed, as a listed path must. B2B
            presets need a business mint.
        agent_key:
          anyOf:
            - $ref: '#/components/schemas/v1.CredentialAgentKey'
            - type: 'null'
          default: null
          description: Accepted so a mint body previews unchanged; a preview binds no key.
        individual_ref:
          description: >-
            Pairwise reference to the verified individual, as issued to the
            calling organization at verification completion.
          maxLength: 255
          minLength: 1
          title: Individual Ref
          type: string
        type:
          const: business
          description: >-
            `business`: a person acting as the operator of the business
            `business_ref` names.
          title: Type
          type: string
        business_ref:
          description: >-
            Pairwise reference to the verified business whose identity the
            individual assumes, as issued to the calling organization.
          maxLength: 255
          minLength: 1
          title: Business Ref
          type: string
        actor_disclosed_fields:
          description: >-
            The dotted paths the separate actor credential should carry,
            unprefixed, e.g. `given_name` or `hashes.email` — the individual
            vocabulary `/vct/kya/individual/v1` lists. A path the person's
            record cannot back is refused. Never with `preset`.
          items:
            type: string
          maxItems: 64
          title: Actor Disclosed Fields
          type: array
      required:
        - audience
        - individual_ref
        - type
        - business_ref
      title: BusinessCredentialPreviewRequest (v1)
      type: object
    v1.IndividualCredentialPreviewRequest:
      additionalProperties: false
      description: |-
        The individual mint body, so one body previews and then mints.
        ``agent_key`` is optional and unused.
      properties:
        format:
          $ref: '#/components/schemas/v1.CredentialWireFormat'
          default: dc+sd-jwt
          description: >-
            Credential wire format. `dc+sd-jwt` (media type
            `application/dc+sd-jwt`, draft-ietf-oauth-sd-jwt-vc-19 §2.1) is the
            only format issued.
        ttl_seconds:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          default: null
          description: >-
            Maximum credential validity in seconds, capped at supporting
            evidence expiry. Omitted or null uses the server default (3600
            seconds). Must not exceed the configured maximum (86400 seconds by
            default).
          title: Ttl Seconds
        audience:
          description: >-
            The counterparty the credential is scoped to: a bare domain
            (`login.example.com`), or an https authorization-server identifier
            (`https://login.example.com`) kept whole, which derives a different
            pairwise subject than the bare host. Paths, queries, fragments and
            non-default ports are refused.
          maxLength: 512
          minLength: 1
          title: Audience
          type: string
        disclosed_fields:
          description: >-
            The dotted disclosure paths the subject credential should carry,
            e.g. `email`, or `hashes.email` for its recognition hash alone. A
            path the person's record cannot back is refused. A business mint
            lists business paths here and the actor credential's paths, e.g.
            `given_name`, in `actor_disclosed_fields`. Neither this nor
            `preset`: a pairwise-only credential.
          items:
            type: string
          maxItems: 64
          title: Disclosed Fields
          type: array
        preset:
          anyOf:
            - $ref: '#/components/schemas/v1.CredentialPreset'
            - type: 'null'
          default: null
          description: >-
            Disclose a use case's fields instead of listing `disclosed_fields`;
            never both. `GET /issuance/credentials/presets` lists each preset's
            paths, and every one must be backed, as a listed path must. B2B
            presets need a business mint.
        agent_key:
          anyOf:
            - $ref: '#/components/schemas/v1.CredentialAgentKey'
            - type: 'null'
          default: null
          description: Accepted so a mint body previews unchanged; a preview binds no key.
        individual_ref:
          description: >-
            Pairwise reference to the verified individual, as issued to the
            calling organization at verification completion.
          maxLength: 255
          minLength: 1
          title: Individual Ref
          type: string
        type:
          const: individual
          description: '`individual`: the person as themselves.'
          title: Type
          type: string
      required:
        - audience
        - individual_ref
        - type
      title: IndividualCredentialPreviewRequest (v1)
      type: object
    v1.ApplicationType:
      description: >-
        Sandbox or production: the type of an application, and the environment

        of each person and identifier it collects. A sandbox value never matches
        a

        production one, and every sandbox application shares the one
        environment.
      enum:
        - sandbox
        - production
      title: ApplicationType
      type: string
    v1.CredentialPreviewEntry:
      description: What one credential of a mint with the same body would carry.
      properties:
        role:
          $ref: '#/components/schemas/v1.CredentialRole'
          description: Whether this is the subject's or the actor's.
        disclosed:
          description: The leaves the credential would carry, in path order.
          items:
            $ref: '#/components/schemas/v1.CredentialPreviewDisclosure'
          title: Disclosed
          type: array
        expires_at:
          description: When a mint now would expire.
          format: date-time
          title: Expires At
          type: string
        active_keys:
          $ref: '#/components/schemas/v1.RecordedActiveKeys'
          description: >-
            Each verification check that would pass (e.g. `phone_possession` for
            an individual, `tax_id_match` for a business), from the
            token-exchange profile's key vocabulary, with its `basis`
            (`verified` or `attested`) and `time` (the UTC day, a NumericDate).
        authorization:
          anyOf:
            - $ref: '#/components/schemas/v1.CredentialPreviewAuthorization'
            - type: 'null'
          default: null
          description: >-
            A business credential's subject entry only: the operator
            authorization it always carries.
      required:
        - role
        - disclosed
        - expires_at
        - active_keys
      title: CredentialPreviewEntry (v1)
      type: object
    v1.CredentialWireFormat:
      description: |-
        The credential formats issued. The value is the SD-JWT VC media-type
        subtype, a standard code kept verbatim. Validation accepts the stored
        ``SD_JWT_VC`` member, never that string.
      enum:
        - dc+sd-jwt
      title: CredentialWireFormat
      type: string
    v1.CredentialPreset:
      description: |-
        A named use case a mint can disclose by instead of listing paths.

        The paths each preset shares live in
        ``osiris.identity.credential_presets``; this is the stored vocabulary
        (``issued_credentials.preset``). Retiring a preset is deleting its
        member: every read of a stored record types the key as text.
      enum:
        - consumer_ecommerce
        - age_gated
        - consumer_regulated
        - b2b_ecommerce
        - b2b_regulated
      title: CredentialPreset
      type: string
    v1.CredentialAgentKey:
      additionalProperties: false
      description: |-
        The presenting agent's public key, bound into the credential's
        ``cnf`` claim (RFC 7800).

        The customer is the retriever, but the credential is presentable only
        by the agent holding the matching private key. v1 pins the signature
        suite: Ed25519 OKP keys only. ``x`` must encode a well-formed Ed25519
        public key, so malformed key material is rejected as a payload
        validation error, never a mint-time surprise.
      properties:
        kty:
          const: OKP
          default: OKP
          description: JWK key type; v1 accepts OKP only.
          title: Kty
          type: string
        crv:
          const: Ed25519
          default: Ed25519
          description: JWK curve; v1 accepts Ed25519 only.
          title: Crv
          type: string
        x:
          description: Base64url-encoded Ed25519 public key bytes.
          minLength: 1
          title: X
          type: string
        kid:
          anyOf:
            - maxLength: 255
              type: string
            - type: 'null'
          default: null
          description: Optional key identifier.
          title: Kid
      required:
        - x
      title: CredentialAgentKey (v1)
      type: object
    v1.CredentialRole:
      description: |-
        What a credential in a mint or preview response is for: the subject
        it names, or the individual who acts for a business subject.
      enum:
        - subject
        - actor
      title: CredentialRole
      type: string
    v1.CredentialPreviewDisclosure:
      description: One leaf a mint with the same body would disclose.
      properties:
        path:
          description: The wire-form disclosure path.
          title: Path
          type: string
        value:
          $ref: '#/components/schemas/v1.JsonValue'
          description: >-
            The exact value the credential would carry; for a recognition hash,
            the hash.
        hashed:
          description: Whether the leaf is a recognition hash.
          title: Hashed
          type: boolean
      required:
        - path
        - value
        - hashed
      title: CredentialPreviewDisclosure (v1)
      type: object
    v1.RecordedActiveKeys:
      additionalProperties:
        $ref: '#/components/schemas/v1.KeyEvidence'
      description: >-
        A credential's keys as signed, on its record and in API answers: the

        record's credential type names the vocabulary, so the names stay
        strings.

        Read-only, like the model.
      maxProperties: 9
      title: RecordedActiveKeys
      type: object
    v1.CredentialPreviewAuthorization:
      description: |-
        The always-disclosed operator authorization a business credential
        carries in its ``actor`` block.
      properties:
        status:
          $ref: '#/components/schemas/v1.ActorAuthorizationStatus'
          description: The operator link's status at mint.
        method:
          $ref: '#/components/schemas/v1.ActorAuthorizationMethod'
          description: >-
            Why the link is verified: the evidence recipe passed, or a reviewer
            decided it.
        confirmed_at:
          description: When the link was last confirmed.
          format: date-time
          title: Confirmed At
          type: string
      required:
        - status
        - method
        - confirmed_at
      title: CredentialPreviewAuthorization (v1)
      type: object
    v1.JsonValue: {}
    v1.KeyEvidence:
      additionalProperties: false
      description: >-
        One key's basis and the UTC day it was established.


        Direct construction, ``KeyEvidence(...)``, raises ``TypeError``. Build

        evidence through the named constructors ``from_proof``, ``from_record``

        and ``proven_at``. ``model_validate`` is for parsing stored JSON that
        one

        of them serialized, never for building new evidence. The day is ours,

        never a customer's own timestamp, so sites cannot correlate on a value a

        customer chose.
      properties:
        basis:
          $ref: '#/components/schemas/v1.KeyBasis'
        time:
          title: Time
          type: integer
      required:
        - basis
        - time
      title: KeyEvidence
      type: object
    v1.ActorAuthorizationStatus:
      description: |-
        The acting person's operator link status (spec wire form). Only a
        Verified link mints, so it is the only member.
      enum:
        - verified
      title: ActorAuthorizationStatus
      type: string
    v1.ActorAuthorizationMethod:
      description: |-
        Why the operator link is Verified: the evidence recipe passed, or a
        reviewer at the organization decided it by hand.
      enum:
        - evidence
        - reviewer
      title: ActorAuthorizationMethod
      type: string
    v1.KeyBasis:
      description: >-
        Who established a key: Baselayer ran the check, or a customer vouched
        for it.
      enum:
        - verified
        - attested
      title: KeyBasis
      type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.