Templates

Templates are used for presenting verifiable credentials to the user in a a pretty, readable and informative way. They can be used on the persisted credentials web view in Truvera workspace or for downloading credentials as PDF document. We have a Designer function in the Truvera Workspace for creating Design templates.

We also have a library https://github.com/docknetwork/prettyvc that can be used to create templates and has samples of templates for users that want more customisation for their designs or use the same principal for their wallet credential display.

Create a template

post
Authorizations
Body
htmlstringRequired

The HTML content of the template

cssstringRequired

The CSS content of the template

namestringRequired

The name of the template

Responses
200
template has been created
application/json
post
POST /templates HTTP/1.1
Host: api-testnet.truvera.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 42

{
  "html": "text",
  "css": "text",
  "name": "text"
}
{
  "id": "text",
  "html": "text",
  "css": "text",
  "name": "text",
  "metadata": {}
}

List all templates

get
Authorizations
Query parameters
offsetinteger · int32Optional

How many items to offset by for pagination

Default: 0
limitinteger · int32 · min: 1 · max: 64Optional

How many items to return at one time (max 64)

Default: 64
Responses
200
A paged array of templates
application/json
get
GET /templates HTTP/1.1
Host: api-testnet.truvera.io
Authorization: Bearer JWT
Accept: */*
[
  {
    "id": "text",
    "html": "text",
    "css": "text",
    "name": "text",
    "metadata": {}
  }
]

Info for a specific template by DID

get
Authorizations
Path parameters
idstring · uuidRequired

The template ID

Responses
200
Expected response to a valid request
application/json
get
GET /templates/{id} HTTP/1.1
Host: api-testnet.truvera.io
Authorization: Bearer JWT
Accept: */*
{
  "id": "text",
  "html": "text",
  "css": "text",
  "name": "text",
  "metadata": {}
}

Update a template

patch
Authorizations
Path parameters
idstringRequired

A template ID

Body
htmlstringRequired

The HTML content of the template

cssstringRequired

The CSS content of the template

namestringRequired

The name of the template

Responses
200
Template has been updated
application/json
patch
PATCH /templates/{id} HTTP/1.1
Host: api-testnet.truvera.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 42

{
  "html": "text",
  "css": "text",
  "name": "text"
}
{
  "id": "text",
  "html": "text",
  "css": "text",
  "name": "text",
  "metadata": {}
}

Deletes a single template based on ID provided

delete
Authorizations
Path parameters
idstringRequired

A template ID

Responses
200
Template deleted
delete
DELETE /templates/{id} HTTP/1.1
Host: api-testnet.truvera.io
Authorization: Bearer JWT
Accept: */*

No content

Last updated

Was this helpful?