Create a new credential preset.
curl --request POST \
--url https://test.didxtech.com/me-creds/api/presets/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentialFormat": "sd-jwt",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateDescription": "A basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": true,
"alwaysDisclosed": false
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": true,
"alwaysDisclosed": false
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": true,
"alwaysDisclosed": true
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": true,
"alwaysDisclosed": false
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": false,
"alwaysDisclosed": false,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": true,
"alwaysDisclosed": false
},
"country": {
"type": "string",
"name": "Country",
"required": true,
"alwaysDisclosed": true
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": false,
"alwaysDisclosed": false,
"items": {
"type": "string"
}
}
}
}
'import requests
url = "https://test.didxtech.com/me-creds/api/presets/credentials"
payload = {
"credentialFormat": "sd-jwt",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateDescription": "A basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": True,
"alwaysDisclosed": False
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": True,
"alwaysDisclosed": False
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": True,
"alwaysDisclosed": True
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": True,
"alwaysDisclosed": False
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": False,
"alwaysDisclosed": False,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": True,
"alwaysDisclosed": False
},
"country": {
"type": "string",
"name": "Country",
"required": True,
"alwaysDisclosed": True
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": False,
"alwaysDisclosed": False,
"items": { "type": "string" }
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentialFormat: 'sd-jwt',
code: 'basic-identity',
templateName: 'Basic Identity Credential',
templateDescription: 'A basic identity credential template',
templateAttributes: {
firstName: {
type: 'string',
name: 'First Name',
description: 'The first name of the person',
required: true,
alwaysDisclosed: false
},
lastName: {
type: 'string',
name: 'Last Name',
description: 'The last name of the person',
required: true,
alwaysDisclosed: false
},
verified: {
type: 'boolean',
name: 'Verified',
description: 'Whether the identity has been verified',
required: true,
alwaysDisclosed: true
},
dateOfBirth: {
type: 'date',
name: 'Date of Birth',
description: 'Date of birth of the person',
required: true,
alwaysDisclosed: false
},
address: {
type: 'object',
name: 'Address',
description: 'Residential address',
required: false,
alwaysDisclosed: false,
properties: {
streetName: {type: 'string', name: 'Street Name', required: true, alwaysDisclosed: false},
country: {type: 'string', name: 'Country', required: true, alwaysDisclosed: true}
}
},
nationalities: {
type: 'array',
name: 'Nationalities',
description: 'List of Alpha-2 country codes representing nationalities',
required: false,
alwaysDisclosed: false,
items: {type: 'string'}
}
}
})
};
fetch('https://test.didxtech.com/me-creds/api/presets/credentials', 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://test.didxtech.com/me-creds/api/presets/credentials",
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([
'credentialFormat' => 'sd-jwt',
'code' => 'basic-identity',
'templateName' => 'Basic Identity Credential',
'templateDescription' => 'A basic identity credential template',
'templateAttributes' => [
'firstName' => [
'type' => 'string',
'name' => 'First Name',
'description' => 'The first name of the person',
'required' => true,
'alwaysDisclosed' => false
],
'lastName' => [
'type' => 'string',
'name' => 'Last Name',
'description' => 'The last name of the person',
'required' => true,
'alwaysDisclosed' => false
],
'verified' => [
'type' => 'boolean',
'name' => 'Verified',
'description' => 'Whether the identity has been verified',
'required' => true,
'alwaysDisclosed' => true
],
'dateOfBirth' => [
'type' => 'date',
'name' => 'Date of Birth',
'description' => 'Date of birth of the person',
'required' => true,
'alwaysDisclosed' => false
],
'address' => [
'type' => 'object',
'name' => 'Address',
'description' => 'Residential address',
'required' => false,
'alwaysDisclosed' => false,
'properties' => [
'streetName' => [
'type' => 'string',
'name' => 'Street Name',
'required' => true,
'alwaysDisclosed' => false
],
'country' => [
'type' => 'string',
'name' => 'Country',
'required' => true,
'alwaysDisclosed' => true
]
]
],
'nationalities' => [
'type' => 'array',
'name' => 'Nationalities',
'description' => 'List of Alpha-2 country codes representing nationalities',
'required' => false,
'alwaysDisclosed' => false,
'items' => [
'type' => 'string'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://test.didxtech.com/me-creds/api/presets/credentials"
payload := strings.NewReader("{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://test.didxtech.com/me-creds/api/presets/credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test.didxtech.com/me-creds/api/presets/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"credentialFormat": "sd-jwt",
"id": "didx:basic-identity",
"author": "didx",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateType": "https://didx.co.za/vct/didx/basic-identity",
"templateDescription": "XYZ Board of Directors approved basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": true,
"alwaysDisclosed": false
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": true,
"alwaysDisclosed": false
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": true,
"alwaysDisclosed": true
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": true,
"alwaysDisclosed": false
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": false,
"alwaysDisclosed": false,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": true,
"alwaysDisclosed": false
},
"country": {
"type": "string",
"name": "Country",
"required": true,
"alwaysDisclosed": true
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": false,
"alwaysDisclosed": false,
"items": {
"type": "string"
}
}
},
"issuerConfig": {
"signer": "did:web"
},
"namespace": "public",
"createdAt": "2025-02-20T11:27:37.051Z",
"updatedAt": "2025-02-20T11:27:37.051Z"
},
"links": {
"self": "<string>",
"first": "<string>",
"last": "<string>",
"prev": "<string>",
"next": "<string>",
"related": "<string>"
},
"meta": {},
"errors": [
{
"detail": "<string>",
"id": "<string>",
"status": "<string>",
"code": "<string>",
"title": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Credential Presets API
Create a new credential preset
deprecated
POST
/
presets
/
credentials
Create a new credential preset.
curl --request POST \
--url https://test.didxtech.com/me-creds/api/presets/credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"credentialFormat": "sd-jwt",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateDescription": "A basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": true,
"alwaysDisclosed": false
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": true,
"alwaysDisclosed": false
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": true,
"alwaysDisclosed": true
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": true,
"alwaysDisclosed": false
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": false,
"alwaysDisclosed": false,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": true,
"alwaysDisclosed": false
},
"country": {
"type": "string",
"name": "Country",
"required": true,
"alwaysDisclosed": true
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": false,
"alwaysDisclosed": false,
"items": {
"type": "string"
}
}
}
}
'import requests
url = "https://test.didxtech.com/me-creds/api/presets/credentials"
payload = {
"credentialFormat": "sd-jwt",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateDescription": "A basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": True,
"alwaysDisclosed": False
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": True,
"alwaysDisclosed": False
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": True,
"alwaysDisclosed": True
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": True,
"alwaysDisclosed": False
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": False,
"alwaysDisclosed": False,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": True,
"alwaysDisclosed": False
},
"country": {
"type": "string",
"name": "Country",
"required": True,
"alwaysDisclosed": True
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": False,
"alwaysDisclosed": False,
"items": { "type": "string" }
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credentialFormat: 'sd-jwt',
code: 'basic-identity',
templateName: 'Basic Identity Credential',
templateDescription: 'A basic identity credential template',
templateAttributes: {
firstName: {
type: 'string',
name: 'First Name',
description: 'The first name of the person',
required: true,
alwaysDisclosed: false
},
lastName: {
type: 'string',
name: 'Last Name',
description: 'The last name of the person',
required: true,
alwaysDisclosed: false
},
verified: {
type: 'boolean',
name: 'Verified',
description: 'Whether the identity has been verified',
required: true,
alwaysDisclosed: true
},
dateOfBirth: {
type: 'date',
name: 'Date of Birth',
description: 'Date of birth of the person',
required: true,
alwaysDisclosed: false
},
address: {
type: 'object',
name: 'Address',
description: 'Residential address',
required: false,
alwaysDisclosed: false,
properties: {
streetName: {type: 'string', name: 'Street Name', required: true, alwaysDisclosed: false},
country: {type: 'string', name: 'Country', required: true, alwaysDisclosed: true}
}
},
nationalities: {
type: 'array',
name: 'Nationalities',
description: 'List of Alpha-2 country codes representing nationalities',
required: false,
alwaysDisclosed: false,
items: {type: 'string'}
}
}
})
};
fetch('https://test.didxtech.com/me-creds/api/presets/credentials', 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://test.didxtech.com/me-creds/api/presets/credentials",
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([
'credentialFormat' => 'sd-jwt',
'code' => 'basic-identity',
'templateName' => 'Basic Identity Credential',
'templateDescription' => 'A basic identity credential template',
'templateAttributes' => [
'firstName' => [
'type' => 'string',
'name' => 'First Name',
'description' => 'The first name of the person',
'required' => true,
'alwaysDisclosed' => false
],
'lastName' => [
'type' => 'string',
'name' => 'Last Name',
'description' => 'The last name of the person',
'required' => true,
'alwaysDisclosed' => false
],
'verified' => [
'type' => 'boolean',
'name' => 'Verified',
'description' => 'Whether the identity has been verified',
'required' => true,
'alwaysDisclosed' => true
],
'dateOfBirth' => [
'type' => 'date',
'name' => 'Date of Birth',
'description' => 'Date of birth of the person',
'required' => true,
'alwaysDisclosed' => false
],
'address' => [
'type' => 'object',
'name' => 'Address',
'description' => 'Residential address',
'required' => false,
'alwaysDisclosed' => false,
'properties' => [
'streetName' => [
'type' => 'string',
'name' => 'Street Name',
'required' => true,
'alwaysDisclosed' => false
],
'country' => [
'type' => 'string',
'name' => 'Country',
'required' => true,
'alwaysDisclosed' => true
]
]
],
'nationalities' => [
'type' => 'array',
'name' => 'Nationalities',
'description' => 'List of Alpha-2 country codes representing nationalities',
'required' => false,
'alwaysDisclosed' => false,
'items' => [
'type' => 'string'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://test.didxtech.com/me-creds/api/presets/credentials"
payload := strings.NewReader("{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://test.didxtech.com/me-creds/api/presets/credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test.didxtech.com/me-creds/api/presets/credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"credentialFormat\": \"sd-jwt\",\n \"code\": \"basic-identity\",\n \"templateName\": \"Basic Identity Credential\",\n \"templateDescription\": \"A basic identity credential template\",\n \"templateAttributes\": {\n \"firstName\": {\n \"type\": \"string\",\n \"name\": \"First Name\",\n \"description\": \"The first name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"lastName\": {\n \"type\": \"string\",\n \"name\": \"Last Name\",\n \"description\": \"The last name of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"name\": \"Verified\",\n \"description\": \"Whether the identity has been verified\",\n \"required\": true,\n \"alwaysDisclosed\": true\n },\n \"dateOfBirth\": {\n \"type\": \"date\",\n \"name\": \"Date of Birth\",\n \"description\": \"Date of birth of the person\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"address\": {\n \"type\": \"object\",\n \"name\": \"Address\",\n \"description\": \"Residential address\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"properties\": {\n \"streetName\": {\n \"type\": \"string\",\n \"name\": \"Street Name\",\n \"required\": true,\n \"alwaysDisclosed\": false\n },\n \"country\": {\n \"type\": \"string\",\n \"name\": \"Country\",\n \"required\": true,\n \"alwaysDisclosed\": true\n }\n }\n },\n \"nationalities\": {\n \"type\": \"array\",\n \"name\": \"Nationalities\",\n \"description\": \"List of Alpha-2 country codes representing nationalities\",\n \"required\": false,\n \"alwaysDisclosed\": false,\n \"items\": {\n \"type\": \"string\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"credentialFormat": "sd-jwt",
"id": "didx:basic-identity",
"author": "didx",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateType": "https://didx.co.za/vct/didx/basic-identity",
"templateDescription": "XYZ Board of Directors approved basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": true,
"alwaysDisclosed": false
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": true,
"alwaysDisclosed": false
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": true,
"alwaysDisclosed": true
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": true,
"alwaysDisclosed": false
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": false,
"alwaysDisclosed": false,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": true,
"alwaysDisclosed": false
},
"country": {
"type": "string",
"name": "Country",
"required": true,
"alwaysDisclosed": true
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": false,
"alwaysDisclosed": false,
"items": {
"type": "string"
}
}
},
"issuerConfig": {
"signer": "did:web"
},
"namespace": "public",
"createdAt": "2025-02-20T11:27:37.051Z",
"updatedAt": "2025-02-20T11:27:37.051Z"
},
"links": {
"self": "<string>",
"first": "<string>",
"last": "<string>",
"prev": "<string>",
"next": "<string>",
"related": "<string>"
},
"meta": {},
"errors": [
{
"detail": "<string>",
"id": "<string>",
"status": "<string>",
"code": "<string>",
"title": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- Option 1
- Option 2
Available options:
sd-jwt Pattern:
^[a-z0-9-]+$Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
{
"backgroundColor": "#0066CC",
"textColor": "#FFFFFF",
"backgroundImageUrl": "https://example.com/bg.png"
}
Available options:
public, private - Option 1
- Option 2
Show child attributes
Show child attributes
Response
200 - application/json
Created credential preset.
- Option 1
- Option 2
Show child attributes
Show child attributes
Example:
{
"credentialFormat": "sd-jwt",
"id": "didx:basic-identity",
"author": "didx",
"code": "basic-identity",
"templateName": "Basic Identity Credential",
"templateType": "https://didx.co.za/vct/didx/basic-identity",
"templateDescription": "XYZ Board of Directors approved basic identity credential template",
"templateAttributes": {
"firstName": {
"type": "string",
"name": "First Name",
"description": "The first name of the person",
"required": true,
"alwaysDisclosed": false
},
"lastName": {
"type": "string",
"name": "Last Name",
"description": "The last name of the person",
"required": true,
"alwaysDisclosed": false
},
"verified": {
"type": "boolean",
"name": "Verified",
"description": "Whether the identity has been verified",
"required": true,
"alwaysDisclosed": true
},
"dateOfBirth": {
"type": "date",
"name": "Date of Birth",
"description": "Date of birth of the person",
"required": true,
"alwaysDisclosed": false
},
"address": {
"type": "object",
"name": "Address",
"description": "Residential address",
"required": false,
"alwaysDisclosed": false,
"properties": {
"streetName": {
"type": "string",
"name": "Street Name",
"required": true,
"alwaysDisclosed": false
},
"country": {
"type": "string",
"name": "Country",
"required": true,
"alwaysDisclosed": true
}
}
},
"nationalities": {
"type": "array",
"name": "Nationalities",
"description": "List of Alpha-2 country codes representing nationalities",
"required": false,
"alwaysDisclosed": false,
"items": { "type": "string" }
}
},
"issuerConfig": { "signer": "did:web" },
"namespace": "public",
"createdAt": "2025-02-20T11:27:37.051Z",
"updatedAt": "2025-02-20T11:27:37.051Z"
}
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I

