curl --request POST \
--url https://api.baselayer.com/issuance/credentials/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"audience": "<string>",
"individual_ref": "<string>",
"type": "individual",
"format": "dc+sd-jwt",
"ttl_seconds": 1,
"disclosed_fields": [
"<string>"
],
"agent_key": {
"x": "<string>",
"kty": "OKP",
"crv": "Ed25519",
"kid": "<string>"
}
}
'import requests
url = "https://api.baselayer.com/issuance/credentials/preview"
payload = {
"audience": "<string>",
"individual_ref": "<string>",
"type": "individual",
"format": "dc+sd-jwt",
"ttl_seconds": 1,
"disclosed_fields": ["<string>"],
"agent_key": {
"x": "<string>",
"kty": "OKP",
"crv": "Ed25519",
"kid": "<string>"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audience: '<string>',
individual_ref: '<string>',
type: 'individual',
format: 'dc+sd-jwt',
ttl_seconds: 1,
disclosed_fields: ['<string>'],
agent_key: {x: '<string>', kty: 'OKP', crv: 'Ed25519', kid: '<string>'}
})
};
fetch('https://api.baselayer.com/issuance/credentials/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.baselayer.com/issuance/credentials/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'audience' => '<string>',
'individual_ref' => '<string>',
'type' => 'individual',
'format' => 'dc+sd-jwt',
'ttl_seconds' => 1,
'disclosed_fields' => [
'<string>'
],
'agent_key' => [
'x' => '<string>',
'kty' => 'OKP',
'crv' => 'Ed25519',
'kid' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/issuance/credentials/preview"
payload := strings.NewReader("{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.baselayer.com/issuance/credentials/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/issuance/credentials/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"environment": "sandbox",
"ttl_capped": true,
"credentials": [
{
"role": "subject",
"disclosed": [
{
"path": "<string>",
"value": "<unknown>",
"hashed": true
}
],
"expires_at": "2023-11-07T05:31:56Z",
"active_keys": {},
"authorization": {
"status": "verified",
"method": "evidence",
"confirmed_at": "2023-11-07T05:31:56Z"
}
}
]
}{
"type": "resource_not_found",
"code": 1,
"message": "Could not locate the resource for the given URI.",
"metadata": {}
}{
"type": "<string>",
"code": 123,
"message": "<string>",
"metadata": {},
"request_id": "<string>"
}{
"type": "<string>",
"code": 123,
"message": "<string>",
"metadata": {},
"request_id": "<string>"
}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.
curl --request POST \
--url https://api.baselayer.com/issuance/credentials/preview \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"audience": "<string>",
"individual_ref": "<string>",
"type": "individual",
"format": "dc+sd-jwt",
"ttl_seconds": 1,
"disclosed_fields": [
"<string>"
],
"agent_key": {
"x": "<string>",
"kty": "OKP",
"crv": "Ed25519",
"kid": "<string>"
}
}
'import requests
url = "https://api.baselayer.com/issuance/credentials/preview"
payload = {
"audience": "<string>",
"individual_ref": "<string>",
"type": "individual",
"format": "dc+sd-jwt",
"ttl_seconds": 1,
"disclosed_fields": ["<string>"],
"agent_key": {
"x": "<string>",
"kty": "OKP",
"crv": "Ed25519",
"kid": "<string>"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
audience: '<string>',
individual_ref: '<string>',
type: 'individual',
format: 'dc+sd-jwt',
ttl_seconds: 1,
disclosed_fields: ['<string>'],
agent_key: {x: '<string>', kty: 'OKP', crv: 'Ed25519', kid: '<string>'}
})
};
fetch('https://api.baselayer.com/issuance/credentials/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.baselayer.com/issuance/credentials/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'audience' => '<string>',
'individual_ref' => '<string>',
'type' => 'individual',
'format' => 'dc+sd-jwt',
'ttl_seconds' => 1,
'disclosed_fields' => [
'<string>'
],
'agent_key' => [
'x' => '<string>',
'kty' => 'OKP',
'crv' => 'Ed25519',
'kid' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.baselayer.com/issuance/credentials/preview"
payload := strings.NewReader("{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.baselayer.com/issuance/credentials/preview")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.baselayer.com/issuance/credentials/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"audience\": \"<string>\",\n \"individual_ref\": \"<string>\",\n \"type\": \"individual\",\n \"format\": \"dc+sd-jwt\",\n \"ttl_seconds\": 1,\n \"disclosed_fields\": [\n \"<string>\"\n ],\n \"agent_key\": {\n \"x\": \"<string>\",\n \"kty\": \"OKP\",\n \"crv\": \"Ed25519\",\n \"kid\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"environment": "sandbox",
"ttl_capped": true,
"credentials": [
{
"role": "subject",
"disclosed": [
{
"path": "<string>",
"value": "<unknown>",
"hashed": true
}
],
"expires_at": "2023-11-07T05:31:56Z",
"active_keys": {},
"authorization": {
"status": "verified",
"method": "evidence",
"confirmed_at": "2023-11-07T05:31:56Z"
}
}
]
}{
"type": "resource_not_found",
"code": 1,
"message": "Could not locate the resource for the given URI.",
"metadata": {}
}{
"type": "<string>",
"code": 123,
"message": "<string>",
"metadata": {},
"request_id": "<string>"
}{
"type": "<string>",
"code": 123,
"message": "<string>",
"metadata": {},
"request_id": "<string>"
}Body
- IndividualCredentialPreviewRequest (v1)
- BusinessCredentialPreviewRequest (v1)
The individual mint body, so one body previews and then mints.
agent_key is optional and unused.
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.
1 - 512The 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.
64Disclose 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.
consumer_ecommerce, age_gated, consumer_regulated, b2b_ecommerce, b2b_regulated Response
Response
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.
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 ~).
sandbox, production