PingOne Platform APIs

Create Credential Type (automated)

POST {{apiPath}}/v1/environments/{{envID}}/credentialTypes

Use the POST {{apiPath}}/v1/environments/{{envID}}/credentialTypes operation to create a new type of credential for issuance. A credential type corresponds to the Card type presented by the compatible wallet app.

In this request, management.mode is AUTOMATED. Such credential types are only issued by its associated credential issuance rule. An expiration object can be used to set the date when the credential will expire.

Prerequisites

Refer to Credential Types for important overview information.

Request Model

Refer to Credential Types data model for full property descriptions.

Property Type Required

cardDesignTemplate (deprecated)

String

Required

cardType

String

Optional

description

String

Optional

expiration

Object

Optional

expiration.after

Object

Required/Optional

expiration.after.duration

Integer

Required

expiration.after.timeUnit

String

Required

expiration.expression

String

Required/Optional

expiration.fieldName

String

Required/Optional

expiration.timestamp

DateTime

Required/Optional

expiration.type

String

Required

issuerName

String

Optional

management.mode

String

Optional

metadata

Object

Required

multiple

Object

Optional

multiple.expression

String

Required

onDelete.revokeIssuedCredentials

Boolean

Optional

openid4VCI

Object

Optional

openid4VCI.enabled

Boolean

Required

openid4VCI.scope

String

Required

title

String

Required

version

String

Optional

metadata object data model

Property Type Required

backgroundImage

String

Optional

bgOpacityPercent

String

Optional

cardColor

String

Optional

description

String

Optional

fields

Object[]

Optional

fields.attribute

String

Required/Optional

fields.fileSupport

String

Optional

fields.id

String

Required

fields.isVisible (deprecated)

Boolean

Required

fields.required

Boolean

Optional

fields.title

String

Required

fields.type

String

Required

fields.values

String[]

Required/Optional

logoImage

String

Optional

name

String

Optional

textColor

String

Optional

version

String

Optional

Headers

Authorization      Bearer {{accessToken}}

Content-Type      application/json

Body

raw ( application/json )

{
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
        "logoImage": "",
        "backgroundImage": "",
        "name": "Alphanumeric Text Example",
        "description": "Alphanumeric Text Attribute",
        "cardColor": "#9997bf",
        "bgOpacityPercent": 20,
        "fields": [
            {
                "id": "Alphanumeric Text -> Account",
                "title": "Account",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Name",
                "title": "Name",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Number",
                "title": "Number",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            }
        ],
        "textColor": "#253746",
        "version": 4
    },
    "expiration": {
        "type": "HARD",
        "after": {
            "duration": 1826,
            "timeUnit": "DAYS"
        }
    },
    "openid4VCI": {
        "enabled": true,
        "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData" : {
        "showTitle" : true,
        "displayFields" : [
            {
                "dataFieldName" : "Account",
                "showFieldName": false
            },
            {
                "dataFieldName" : "Name",
                "showFieldName": false
            }
        ]
    }
}

Example Request

  • cURL

  • C#

  • Go

  • HTTP

  • Java

  • jQuery

  • NodeJS

  • Python

  • PHP

  • Ruby

  • Swift

curl --location --globoff '{{apiPath}}/v1/environments/{{envID}}/credentialTypes' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data '{
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
        "logoImage": "",
        "backgroundImage": "",
        "name": "Alphanumeric Text Example",
        "description": "Alphanumeric Text Attribute",
        "cardColor": "#9997bf",
        "bgOpacityPercent": 20,
        "fields": [
            {
                "id": "Alphanumeric Text -> Account",
                "title": "Account",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Name",
                "title": "Name",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Number",
                "title": "Number",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            }
        ],
        "textColor": "#253746",
        "version": 4
    },
    "expiration": {
        "type": "HARD",
        "after": {
            "duration": 1826,
            "timeUnit": "DAYS"
        }
    },
    "openid4VCI": {
        "enabled": true,
        "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData" : {
        "showTitle" : true,
        "displayFields" : [
            {
                "dataFieldName" : "Account",
                "showFieldName": false
            },
            {
                "dataFieldName" : "Name",
                "showFieldName": false
            }
        ]
    }
}'
var options = new RestClientOptions("{{apiPath}}/v1/environments/{{envID}}/credentialTypes")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@"    ""title"": ""Title""," + "\n" +
@"    ""description"": ""Subtitle""," + "\n" +
@"    ""metadata"": {" + "\n" +
@"        ""logoImage"": """"," + "\n" +
@"        ""backgroundImage"": """"," + "\n" +
@"        ""name"": ""Alphanumeric Text Example""," + "\n" +
@"        ""description"": ""Alphanumeric Text Attribute""," + "\n" +
@"        ""cardColor"": ""#9997bf""," + "\n" +
@"        ""bgOpacityPercent"": 20," + "\n" +
@"        ""fields"": [" + "\n" +
@"            {" + "\n" +
@"                ""id"": ""Alphanumeric Text -> Account""," + "\n" +
@"                ""title"": ""Account""," + "\n" +
@"                ""isVisible"": true," + "\n" +
@"                ""required"" : true," + "\n" +
@"                ""type"": ""Alphanumeric Text""," + "\n" +
@"                ""value"": ""Value""" + "\n" +
@"            }," + "\n" +
@"            {" + "\n" +
@"                ""id"": ""Alphanumeric Text -> Name""," + "\n" +
@"                ""title"": ""Name""," + "\n" +
@"                ""isVisible"": true," + "\n" +
@"                ""required"" : true," + "\n" +
@"                ""type"": ""Alphanumeric Text""," + "\n" +
@"                ""value"": ""Value""" + "\n" +
@"            }," + "\n" +
@"            {" + "\n" +
@"                ""id"": ""Alphanumeric Text -> Number""," + "\n" +
@"                ""title"": ""Number""," + "\n" +
@"                ""isVisible"": true," + "\n" +
@"                ""required"" : true," + "\n" +
@"                ""type"": ""Alphanumeric Text""," + "\n" +
@"                ""value"": ""Value""" + "\n" +
@"            }" + "\n" +
@"        ]," + "\n" +
@"        ""textColor"": ""#253746""," + "\n" +
@"        ""version"": 4" + "\n" +
@"    }," + "\n" +
@"    ""expiration"": {" + "\n" +
@"        ""type"": ""HARD""," + "\n" +
@"        ""after"": {" + "\n" +
@"            ""duration"": 1826," + "\n" +
@"            ""timeUnit"": ""DAYS""" + "\n" +
@"        }" + "\n" +
@"    }," + "\n" +
@"    ""openid4VCI"": {" + "\n" +
@"        ""enabled"": true," + "\n" +
@"        ""scope"": ""p1:provision:credentials""" + "\n" +
@"    }," + "\n" +
@"    ""visualizationTemplateData"" : {" + "\n" +
@"        ""showTitle"" : true," + "\n" +
@"        ""displayFields"" : [" + "\n" +
@"            { " + "\n" +
@"                ""dataFieldName"" : ""Account""," + "\n" +
@"                ""showFieldName"": false" + "\n" +
@"            }," + "\n" +
@"            { " + "\n" +
@"                ""dataFieldName"" : ""Name""," + "\n" +
@"                ""showFieldName"": false" + "\n" +
@"            }" + "\n" +
@"        ]" + "\n" +
@"    }" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "{{apiPath}}/v1/environments/{{envID}}/credentialTypes"
  method := "POST"

  payload := strings.NewReader(`{
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
        "logoImage": "",
        "backgroundImage": "",
        "name": "Alphanumeric Text Example",
        "description": "Alphanumeric Text Attribute",
        "cardColor": "#9997bf",
        "bgOpacityPercent": 20,
        "fields": [
            {
                "id": "Alphanumeric Text -> Account",
                "title": "Account",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Name",
                "title": "Name",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Number",
                "title": "Number",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            }
        ],
        "textColor": "#253746",
        "version": 4
    },
    "expiration": {
        "type": "HARD",
        "after": {
            "duration": 1826,
            "timeUnit": "DAYS"
        }
    },
    "openid4VCI": {
        "enabled": true,
        "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData" : {
        "showTitle" : true,
        "displayFields" : [
            {
                "dataFieldName" : "Account",
                "showFieldName": false
            },
            {
                "dataFieldName" : "Name",
                "showFieldName": false
            }
        ]
    }
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer {{accessToken}}")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
POST /v1/environments/{{envID}}/credentialTypes HTTP/1.1
Host: {{apiPath}}
Content-Type: application/json
Authorization: Bearer {{accessToken}}

{
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
        "logoImage": "",
        "backgroundImage": "",
        "name": "Alphanumeric Text Example",
        "description": "Alphanumeric Text Attribute",
        "cardColor": "#9997bf",
        "bgOpacityPercent": 20,
        "fields": [
            {
                "id": "Alphanumeric Text -> Account",
                "title": "Account",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Name",
                "title": "Name",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            },
            {
                "id": "Alphanumeric Text -> Number",
                "title": "Number",
                "isVisible": true,
                "required" : true,
                "type": "Alphanumeric Text",
                "value": "Value"
            }
        ],
        "textColor": "#253746",
        "version": 4
    },
    "expiration": {
        "type": "HARD",
        "after": {
            "duration": 1826,
            "timeUnit": "DAYS"
        }
    },
    "openid4VCI": {
        "enabled": true,
        "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData" : {
        "showTitle" : true,
        "displayFields" : [
            {
                "dataFieldName" : "Account",
                "showFieldName": false
            },
            {
                "dataFieldName" : "Name",
                "showFieldName": false
            }
        ]
    }
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"title\": \"Title\",\n    \"description\": \"Subtitle\",\n    \"metadata\": {\n        \"logoImage\": \"\",\n        \"backgroundImage\": \"\",\n        \"name\": \"Alphanumeric Text Example\",\n        \"description\": \"Alphanumeric Text Attribute\",\n        \"cardColor\": \"#9997bf\",\n        \"bgOpacityPercent\": 20,\n        \"fields\": [\n            {\n                \"id\": \"Alphanumeric Text -> Account\",\n                \"title\": \"Account\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            },\n            {\n                \"id\": \"Alphanumeric Text -> Name\",\n                \"title\": \"Name\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            },\n            {\n                \"id\": \"Alphanumeric Text -> Number\",\n                \"title\": \"Number\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            }\n        ],\n        \"textColor\": \"#253746\",\n        \"version\": 4\n    },\n    \"expiration\": {\n        \"type\": \"HARD\",\n        \"after\": {\n            \"duration\": 1826,\n            \"timeUnit\": \"DAYS\"\n        }\n    },\n    \"openid4VCI\": {\n        \"enabled\": true,\n        \"scope\": \"p1:provision:credentials\"\n    },\n    \"visualizationTemplateData\" : {\n        \"showTitle\" : true,\n        \"displayFields\" : [\n            { \n                \"dataFieldName\" : \"Account\",\n                \"showFieldName\": false\n            },\n            { \n                \"dataFieldName\" : \"Name\",\n                \"showFieldName\": false\n            }\n        ]\n    }\n}");
Request request = new Request.Builder()
  .url("{{apiPath}}/v1/environments/{{envID}}/credentialTypes")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {{accessToken}}")
  .build();
Response response = client.newCall(request).execute();
var settings = {
  "url": "{{apiPath}}/v1/environments/{{envID}}/credentialTypes",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{accessToken}}"
  },
  "data": JSON.stringify({
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
      "logoImage": "",
      "backgroundImage": "",
      "name": "Alphanumeric Text Example",
      "description": "Alphanumeric Text Attribute",
      "cardColor": "#9997bf",
      "bgOpacityPercent": 20,
      "fields": [
        {
          "id": "Alphanumeric Text -> Account",
          "title": "Account",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        },
        {
          "id": "Alphanumeric Text -> Name",
          "title": "Name",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        },
        {
          "id": "Alphanumeric Text -> Number",
          "title": "Number",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        }
      ],
      "textColor": "#253746",
      "version": 4
    },
    "expiration": {
      "type": "HARD",
      "after": {
        "duration": 1826,
        "timeUnit": "DAYS"
      }
    },
    "openid4VCI": {
      "enabled": true,
      "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData": {
      "showTitle": true,
      "displayFields": [
        {
          "dataFieldName": "Account",
          "showFieldName": false
        },
        {
          "dataFieldName": "Name",
          "showFieldName": false
        }
      ]
    }
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{apiPath}}/v1/environments/{{envID}}/credentialTypes',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer {{accessToken}}'
  },
  body: JSON.stringify({
    "title": "Title",
    "description": "Subtitle",
    "metadata": {
      "logoImage": "",
      "backgroundImage": "",
      "name": "Alphanumeric Text Example",
      "description": "Alphanumeric Text Attribute",
      "cardColor": "#9997bf",
      "bgOpacityPercent": 20,
      "fields": [
        {
          "id": "Alphanumeric Text -> Account",
          "title": "Account",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        },
        {
          "id": "Alphanumeric Text -> Name",
          "title": "Name",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        },
        {
          "id": "Alphanumeric Text -> Number",
          "title": "Number",
          "isVisible": true,
          "required": true,
          "type": "Alphanumeric Text",
          "value": "Value"
        }
      ],
      "textColor": "#253746",
      "version": 4
    },
    "expiration": {
      "type": "HARD",
      "after": {
        "duration": 1826,
        "timeUnit": "DAYS"
      }
    },
    "openid4VCI": {
      "enabled": true,
      "scope": "p1:provision:credentials"
    },
    "visualizationTemplateData": {
      "showTitle": true,
      "displayFields": [
        {
          "dataFieldName": "Account",
          "showFieldName": false
        },
        {
          "dataFieldName": "Name",
          "showFieldName": false
        }
      ]
    }
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
import requests
import json

url = "{{apiPath}}/v1/environments/{{envID}}/credentialTypes"

payload = json.dumps({
  "title": "Title",
  "description": "Subtitle",
  "metadata": {
    "logoImage": "",
    "backgroundImage": "",
    "name": "Alphanumeric Text Example",
    "description": "Alphanumeric Text Attribute",
    "cardColor": "#9997bf",
    "bgOpacityPercent": 20,
    "fields": [
      {
        "id": "Alphanumeric Text -> Account",
        "title": "Account",
        "isVisible": True,
        "required": True,
        "type": "Alphanumeric Text",
        "value": "Value"
      },
      {
        "id": "Alphanumeric Text -> Name",
        "title": "Name",
        "isVisible": True,
        "required": True,
        "type": "Alphanumeric Text",
        "value": "Value"
      },
      {
        "id": "Alphanumeric Text -> Number",
        "title": "Number",
        "isVisible": True,
        "required": True,
        "type": "Alphanumeric Text",
        "value": "Value"
      }
    ],
    "textColor": "#253746",
    "version": 4
  },
  "expiration": {
    "type": "HARD",
    "after": {
      "duration": 1826,
      "timeUnit": "DAYS"
    }
  },
  "openid4VCI": {
    "enabled": True,
    "scope": "p1:provision:credentials"
  },
  "visualizationTemplateData": {
    "showTitle": True,
    "displayFields": [
      {
        "dataFieldName": "Account",
        "showFieldName": False
      },
      {
        "dataFieldName": "Name",
        "showFieldName": False
      }
    ]
  }
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {{accessToken}}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/v1/environments/{{envID}}/credentialTypes');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n    "title": "Title",\n    "description": "Subtitle",\n    "metadata": {\n        "logoImage": "",\n        "backgroundImage": "",\n        "name": "Alphanumeric Text Example",\n        "description": "Alphanumeric Text Attribute",\n        "cardColor": "#9997bf",\n        "bgOpacityPercent": 20,\n        "fields": [\n            {\n                "id": "Alphanumeric Text -> Account",\n                "title": "Account",\n                "isVisible": true,\n                "required" : true,\n                "type": "Alphanumeric Text",\n                "value": "Value"\n            },\n            {\n                "id": "Alphanumeric Text -> Name",\n                "title": "Name",\n                "isVisible": true,\n                "required" : true,\n                "type": "Alphanumeric Text",\n                "value": "Value"\n            },\n            {\n                "id": "Alphanumeric Text -> Number",\n                "title": "Number",\n                "isVisible": true,\n                "required" : true,\n                "type": "Alphanumeric Text",\n                "value": "Value"\n            }\n        ],\n        "textColor": "#253746",\n        "version": 4\n    },\n    "expiration": {\n        "type": "HARD",\n        "after": {\n            "duration": 1826,\n            "timeUnit": "DAYS"\n        }\n    },\n    "openid4VCI": {\n        "enabled": true,\n        "scope": "p1:provision:credentials"\n    },\n    "visualizationTemplateData" : {\n        "showTitle" : true,\n        "displayFields" : [\n            { \n                "dataFieldName" : "Account",\n                "showFieldName": false\n            },\n            { \n                "dataFieldName" : "Name",\n                "showFieldName": false\n            }\n        ]\n    }\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
require "uri"
require "json"
require "net/http"

url = URI("{{apiPath}}/v1/environments/{{envID}}/credentialTypes")

http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
  "title": "Title",
  "description": "Subtitle",
  "metadata": {
    "logoImage": "",
    "backgroundImage": "",
    "name": "Alphanumeric Text Example",
    "description": "Alphanumeric Text Attribute",
    "cardColor": "\#9997bf",
    "bgOpacityPercent": 20,
    "fields": [
      {
        "id": "Alphanumeric Text -> Account",
        "title": "Account",
        "isVisible": true,
        "required": true,
        "type": "Alphanumeric Text",
        "value": "Value"
      },
      {
        "id": "Alphanumeric Text -> Name",
        "title": "Name",
        "isVisible": true,
        "required": true,
        "type": "Alphanumeric Text",
        "value": "Value"
      },
      {
        "id": "Alphanumeric Text -> Number",
        "title": "Number",
        "isVisible": true,
        "required": true,
        "type": "Alphanumeric Text",
        "value": "Value"
      }
    ],
    "textColor": "\#253746",
    "version": 4
  },
  "expiration": {
    "type": "HARD",
    "after": {
      "duration": 1826,
      "timeUnit": "DAYS"
    }
  },
  "openid4VCI": {
    "enabled": true,
    "scope": "p1:provision:credentials"
  },
  "visualizationTemplateData": {
    "showTitle": true,
    "displayFields": [
      {
        "dataFieldName": "Account",
        "showFieldName": false
      },
      {
        "dataFieldName": "Name",
        "showFieldName": false
      }
    ]
  }
})

response = http.request(request)
puts response.read_body
let parameters = "{\n    \"title\": \"Title\",\n    \"description\": \"Subtitle\",\n    \"metadata\": {\n        \"logoImage\": \"\",\n        \"backgroundImage\": \"\",\n        \"name\": \"Alphanumeric Text Example\",\n        \"description\": \"Alphanumeric Text Attribute\",\n        \"cardColor\": \"#9997bf\",\n        \"bgOpacityPercent\": 20,\n        \"fields\": [\n            {\n                \"id\": \"Alphanumeric Text -> Account\",\n                \"title\": \"Account\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            },\n            {\n                \"id\": \"Alphanumeric Text -> Name\",\n                \"title\": \"Name\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            },\n            {\n                \"id\": \"Alphanumeric Text -> Number\",\n                \"title\": \"Number\",\n                \"isVisible\": true,\n                \"required\" : true,\n                \"type\": \"Alphanumeric Text\",\n                \"value\": \"Value\"\n            }\n        ],\n        \"textColor\": \"#253746\",\n        \"version\": 4\n    },\n    \"expiration\": {\n        \"type\": \"HARD\",\n        \"after\": {\n            \"duration\": 1826,\n            \"timeUnit\": \"DAYS\"\n        }\n    },\n    \"openid4VCI\": {\n        \"enabled\": true,\n        \"scope\": \"p1:provision:credentials\"\n    },\n    \"visualizationTemplateData\" : {\n        \"showTitle\" : true,\n        \"displayFields\" : [\n            { \n                \"dataFieldName\" : \"Account\",\n                \"showFieldName\": false\n            },\n            { \n                \"dataFieldName\" : \"Name\",\n                \"showFieldName\": false\n            }\n        ]\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "{{apiPath}}/v1/environments/{{envID}}/credentialTypes")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()

Example Response

201 Created

{
    "_links": {
        "self": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/credentialTypes/6d031a6d-ca39-40a5-bd51-098db3774082"
        },
        "environment": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
        },
        "credentialIssuerProfile": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/credentialIssuerProfile"
        },
        "issuanceRules": {
            "href": "https://api.pingone.com/v1/environments/abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6/credentialTypes/6d031a6d-ca39-40a5-bd51-098db3774082/issuanceRules"
        }
    },
    "id": "6d031a6d-ca39-40a5-bd51-098db3774082",
    "createdAt": "2025-02-28T20:46:59.406852884Z",
    "updatedAt": "2025-02-28T20:46:59.406852884Z",
    "environment": {
        "id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
    },
    "issuer": {
        "id": "824c722c-254a-4b2d-9b50-17e2abdf5f8a"
    },
    "management": {
        "mode": "AUTOMATED"
    },
    "title": "Title",
    "description": "Subtitle",
    "cardType": "Title",
    "uri": "https://api.pingone.com/v1/distributedid/credentialTypes/6d031a6d-ca39-40a5-bd51-098db3774082",
    "version": {
        "number": 1,
        "uri": "https://api.pingone.com/v1/distributedid/credentialTypes/6d031a6d-ca39-40a5-bd51-098db3774082/v1",
        "id": "76fecf21-313a-49d4-b4d5-ec17281bdd20"
    },
    "metadata": {
        "name": "Alphanumeric Text Example",
        "description": "Alphanumeric Text Attribute",
        "textColor": "#253746",
        "cardColor": "#9997bf",
        "backgroundImage": "",
        "logoImage": "",
        "bgOpacityPercent": 20,
        "fields": [
            {
                "id": "Alphanumeric Text -> Account",
                "title": "Account",
                "isVisible": true,
                "type": "Alphanumeric Text",
                "value": "Value",
                "required": true
            },
            {
                "id": "Alphanumeric Text -> Name",
                "title": "Name",
                "isVisible": true,
                "type": "Alphanumeric Text",
                "value": "Value",
                "required": true
            },
            {
                "id": "Alphanumeric Text -> Number",
                "title": "Number",
                "isVisible": true,
                "type": "Alphanumeric Text",
                "value": "Value",
                "required": true
            }
        ],
        "version": 4
    },
    "onDelete": {
        "revokeIssuedCredentials": true
    },
    "expiration": {
        "type": "HARD",
        "after": {
            "duration": 1826,
            "timeUnit": "DAYS"
        }
    },
    "visualizationTemplateData": {
        "showTitle": true,
        "displayFields": [
            {
                "showFieldName": false,
                "dataFieldName": "Account"
            },
            {
                "showFieldName": false,
                "dataFieldName": "Name"
            }
        ]
    },
    "openid4VCI": {
        "enabled": true,
        "scope": "p1:provision:credentials"
    }
}