Create Your First Template

Learn how to define a template with properties, actions, and faces.

What You'll Build

In this tutorial you'll create a template, the blueprint that defines the structure, properties, and behaviour of tokenized objects on the Dual network. By the end you'll have a working template you can mint objects from.

Step 1, Authenticate

First, obtain a JWT token by logging in with your wallet credentials. You'll use this token in every subsequent request.

bash
curl -X POST https://api-testnet.dual.network/wallets/login \\
-H "Content-Type: application/json" \\
-d '{
"email": "dev@example.com",
"password": "your-password"
}'

The response includes a token field, save it as an environment variable:

bash
export DUAL_TOKEN="eyJhbGciOiJIUzI1NiIs..."

Step 2, Create the Template

Templates define the schema for your tokenized objects. Each template belongs to an organization and specifies properties, actions, and visual faces.

bash
curl -X POST https://api-testnet.dual.network/templates \\
-H "Authorization: Bearer $DUAL_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"template": {
"name": "my-org::loyalty-card::v1",
"description": "A digital loyalty card template",
"public": false,
"cloneable": false,
"properties": {
"points": 0,
"tier": "silver",
"holder_name": ""
}
}
}'

The template name follows the convention org::name::version. Properties define the default data fields that every object minted from this template will inherit.

Step 3, Verify Your Template

Confirm the template was created by listing your organization's templates:

bash
curl https://api-testnet.dual.network/templates \\
-H "Authorization: Bearer $DUAL_TOKEN"

You should see your new template in the response array with all the properties you defined.

Step 4, Add a Face

Faces are the visual layer of your template. They can be images, 3D models, or web views. Let's attach a simple image face:

bash
curl -X POST https://api-testnet.dual.network/faces \\
-H "Authorization: Bearer $DUAL_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{
"face": {
"template": "my-org::loyalty-card::v1",
"display_type": "ResourceFace",
"meta": {
"image": "https://your-cdn.com/loyalty-card.png"
},
"is_default": true
}
}'

What's Next?

Your template is ready. In the next tutorial, Mint & Transfer Objects, you'll create object instances from this template and transfer them between wallets.

Tip: You can update a template's properties at any time using PATCH /templates/{id}, but be aware that changes won't retroactively update objects already minted from it.