# Templates

The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.

This section covers all template-related endpoints:

***

### 1. Get All Templates

#### Endpoint

`GET /api/templates`

#### Description

Fetches all templates available to your account (or sub-account if provided).

#### Headers

* **`x-api-key`** *(required)* – Your API key from the Akowe dashboard.
* **`x-subaccount-email`** *(optional)* – Filters results to templates created by the specified sub-account.

#### Example Request

```bash
curl --location '{{baseurl}}/api/templates' \
--header &#x27;x-api-key: <your_api_key>&#x27;

```

#### Example Response

```json
{
  "success": true,
  "message": "",
  "data": [
    {
      "id": "290e4c3b-1da4-4f7e-811d-30dde4f8858d",
      "name": "Demo Template",
      "imageUrl": "https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg",
      "fields": [
        {
          "id": "997a7a31-a5eb-4b6a-bb01-f2b60c848171",
          "type": "name",
          "text": "Display Name",
          "fontSize": 16,
          "fontFamily": "Arial",
          "color": "#000000",
          "isBold": false,
          "isItalic": false,
          "alignment": "center",
          "x": 50,
          "y": 40
        }
      ],
      "dimensions": {
        "width": 2560,
        "height": 1920
      },
      "subAccountEmail": "johndoe@email.com",
      "createdAt": "2025-09-24T18:23:43.621Z"
    }
  ]
}

```

***

### 2. Create Template

#### Endpoint

`POST /api/templates`

#### Description

Creates a new certificate template with a background image, dimensions, and defined fields.

#### Headers

* **`x-api-key`** *(required)*
* **`x-subaccount-email`** *(optional but recommended)* – Links the template to a specific sub-account.
* **`Content-Type`**: `application/json`

#### Request Body

| Field        | Type   | Required | Description                                       |
| ------------ | ------ | -------- | ------------------------------------------------- |
| `name`       | string | ✅ Yes    | The template name.                                |
| `imageUrl`   | string | ✅ Yes    | Base64 string or image URL for the background.    |
| `dimensions` | object | ✅ Yes    | Width and height of the template.                 |
| `fields`     | array  | ✅ Yes    | List of field definitions (e.g., name, date, QR). |

#### Example Request

```bash
curl --location '{{baseurl}}/api/templates' \
--header &#x27;x-api-key: <your_api_key>&#x27; \
--header 'x-subaccount-email: johndoe@email.com' \
--header 'Content-Type: application/json' \
--data '{
  "name": "Demo",
  "imageUrl": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z",
  "dimensions": {
    "width": 2560,
    "height": 1920
  },
  "fields": [
    {
      "type": "name",
      "text": "Display Name",
      "x": 50,
      "y": 40,
      "fontSize": 16,
      "fontFamily": "Arial",
      "color": "#000000",
      "isBold": false,
      "isItalic": false,
      "alignment": "center"
    }
  ]
}'

```

#### Example Response

```json
{
  "success": true,
  "message": "Template created successfully",
  "data": {
    "id": "290e4c3b-1da4-4f7e-811d-30dde4f8858d",
    "name": "Demo",
    "imageUrl": "https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg",
    "dimensions": {
      "width": 2560,
      "height": 1920
    },
    "fields": [
      {
        "id": "8fa5eacf-34e3-4115-82c8-356edc9ccd6f",
        "type": "name",
        "text": "Display Name",
        "x": 50,
        "y": 40
      }
    ]
  }
}

```

***

### 3. Edit Template

#### Endpoint

`PUT /api/templates/{templateId}`

#### Description

Updates an existing template’s details and fields.

#### Headers

* **`x-api-key`** *(required)*
* **`Content-Type`**: `application/json`

#### Example Request

```bash
curl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \
--header &#x27;x-api-key: <your_api_key>&#x27; \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Demo Edited",
  "imageUrl": "https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg",
  "fields": [...]
}'

```

#### Example Response

```json
{
  "success": true,
  "message": "Template updated successfully"
}

```

***

### 4. Get Template by ID

#### Endpoint

`GET /api/templates/{templateId}`

#### Description

Fetches the details of a specific template.

#### Headers

* **`x-api-key`** *(required)*

#### Example Response

```json
{
  "success": true,
  "data": {
    "id": "290e4c3b-1da4-4f7e-811d-30dde4f8858d",
    "name": "Demo Edited",
    "imageUrl": "https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg",
    "fields": [...],
    "dimensions": {
      "width": 2560,
      "height": 1920
    }
  }
}

```

***

### 5. Delete Template

#### Endpoint

`DELETE /api/templates/{templateId}`

#### Description

Deletes a specific template permanently.

#### Headers

* **`x-api-key`** *(required)*

#### Example Response

```json
{
  "success": true,
  "message": "Template deleted successfully"
}

```

## GET /templates

> Get Templates

````json
{"openapi":"3.0.0","info":{"title":"Akowe Issuance API Endpoints","version":"1.0.0"},"tags":[{"name":"Templates","description":"The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.\n\nThis section covers all template-related endpoints:\n\n---\n\n## 1\\. Get All Templates\n\n### Endpoint\n\n`GET /api/templates`\n\n### Description\n\nFetches all templates available to your account (or sub-account if provided).\n\n### Headers\n\n- **`x-api-key`** _(required)_ – Your API key from the Akowe dashboard.\n    \n- **`x-subaccount-email`** _(optional)_ – Filters results to templates created by the specified sub-account.\n    \n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27;\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"\",\n  \"data\": [\n    {\n      \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n      \"name\": \"Demo Template\",\n      \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n      \"fields\": [\n        {\n          \"id\": \"997a7a31-a5eb-4b6a-bb01-f2b60c848171\",\n          \"type\": \"name\",\n          \"text\": \"Display Name\",\n          \"fontSize\": 16,\n          \"fontFamily\": \"Arial\",\n          \"color\": \"#000000\",\n          \"isBold\": false,\n          \"isItalic\": false,\n          \"alignment\": \"center\",\n          \"x\": 50,\n          \"y\": 40\n        }\n      ],\n      \"dimensions\": {\n        \"width\": 2560,\n        \"height\": 1920\n      },\n      \"subAccountEmail\": \"johndoe@email.com\",\n      \"createdAt\": \"2025-09-24T18:23:43.621Z\"\n    }\n  ]\n}\n\n ```\n\n---\n\n## 2\\. Create Template\n\n### Endpoint\n\n`POST /api/templates`\n\n### Description\n\nCreates a new certificate template with a background image, dimensions, and defined fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`x-subaccount-email`** _(optional but recommended)_ – Links the template to a specific sub-account.\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Request Body\n\n| Field | Type | Required | Description |\n| --- | --- | --- | --- |\n| `name` | string | ✅ Yes | The template name. |\n| `imageUrl` | string | ✅ Yes | Base64 string or image URL for the background. |\n| `dimensions` | object | ✅ Yes | Width and height of the template. |\n| `fields` | array | ✅ Yes | List of field definitions (e.g., name, date, QR). |\n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'x-subaccount-email: johndoe@email.com' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"name\": \"Demo\",\n  \"imageUrl\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z\",\n  \"dimensions\": {\n    \"width\": 2560,\n    \"height\": 1920\n  },\n  \"fields\": [\n    {\n      \"type\": \"name\",\n      \"text\": \"Display Name\",\n      \"x\": 50,\n      \"y\": 40,\n      \"fontSize\": 16,\n      \"fontFamily\": \"Arial\",\n      \"color\": \"#000000\",\n      \"isBold\": false,\n      \"isItalic\": false,\n      \"alignment\": \"center\"\n    }\n  ]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template created successfully\",\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    },\n    \"fields\": [\n      {\n        \"id\": \"8fa5eacf-34e3-4115-82c8-356edc9ccd6f\",\n        \"type\": \"name\",\n        \"text\": \"Display Name\",\n        \"x\": 50,\n        \"y\": 40\n      }\n    ]\n  }\n}\n\n ```\n\n---\n\n## 3\\. Edit Template\n\n### Endpoint\n\n`PUT /api/templates/{templateId}`\n\n### Description\n\nUpdates an existing template’s details and fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Example Request\n\n``` bash\ncurl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  \"name\": \"Demo Edited\",\n  \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n  \"fields\": [...]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template updated successfully\"\n}\n\n ```\n\n---\n\n## 4\\. Get Template by ID\n\n### Endpoint\n\n`GET /api/templates/{templateId}`\n\n### Description\n\nFetches the details of a specific template.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo Edited\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"fields\": [...],\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    }\n  }\n}\n\n ```\n\n---\n\n## 5\\. Delete Template\n\n### Endpoint\n\n`DELETE /api/templates/{templateId}`\n\n### Description\n\nDeletes a specific template permanently.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template deleted successfully\"\n}\n\n ```"}],"servers":[{"url":"http://{{baseurl}}"}],"paths":{"/templates":{"get":{"tags":["Templates"],"summary":"Get Templates","parameters":[{"name":"x-api-key","in":"header","schema":{"type":"string"}},{"name":"x-subaccount-email","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}}}}}}}
````

## POST /templates

> Create Template

````json
{"openapi":"3.0.0","info":{"title":"Akowe Issuance API Endpoints","version":"1.0.0"},"tags":[{"name":"Templates","description":"The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.\n\nThis section covers all template-related endpoints:\n\n---\n\n## 1\\. Get All Templates\n\n### Endpoint\n\n`GET /api/templates`\n\n### Description\n\nFetches all templates available to your account (or sub-account if provided).\n\n### Headers\n\n- **`x-api-key`** _(required)_ – Your API key from the Akowe dashboard.\n    \n- **`x-subaccount-email`** _(optional)_ – Filters results to templates created by the specified sub-account.\n    \n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27;\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"\",\n  \"data\": [\n    {\n      \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n      \"name\": \"Demo Template\",\n      \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n      \"fields\": [\n        {\n          \"id\": \"997a7a31-a5eb-4b6a-bb01-f2b60c848171\",\n          \"type\": \"name\",\n          \"text\": \"Display Name\",\n          \"fontSize\": 16,\n          \"fontFamily\": \"Arial\",\n          \"color\": \"#000000\",\n          \"isBold\": false,\n          \"isItalic\": false,\n          \"alignment\": \"center\",\n          \"x\": 50,\n          \"y\": 40\n        }\n      ],\n      \"dimensions\": {\n        \"width\": 2560,\n        \"height\": 1920\n      },\n      \"subAccountEmail\": \"johndoe@email.com\",\n      \"createdAt\": \"2025-09-24T18:23:43.621Z\"\n    }\n  ]\n}\n\n ```\n\n---\n\n## 2\\. Create Template\n\n### Endpoint\n\n`POST /api/templates`\n\n### Description\n\nCreates a new certificate template with a background image, dimensions, and defined fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`x-subaccount-email`** _(optional but recommended)_ – Links the template to a specific sub-account.\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Request Body\n\n| Field | Type | Required | Description |\n| --- | --- | --- | --- |\n| `name` | string | ✅ Yes | The template name. |\n| `imageUrl` | string | ✅ Yes | Base64 string or image URL for the background. |\n| `dimensions` | object | ✅ Yes | Width and height of the template. |\n| `fields` | array | ✅ Yes | List of field definitions (e.g., name, date, QR). |\n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'x-subaccount-email: johndoe@email.com' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"name\": \"Demo\",\n  \"imageUrl\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z\",\n  \"dimensions\": {\n    \"width\": 2560,\n    \"height\": 1920\n  },\n  \"fields\": [\n    {\n      \"type\": \"name\",\n      \"text\": \"Display Name\",\n      \"x\": 50,\n      \"y\": 40,\n      \"fontSize\": 16,\n      \"fontFamily\": \"Arial\",\n      \"color\": \"#000000\",\n      \"isBold\": false,\n      \"isItalic\": false,\n      \"alignment\": \"center\"\n    }\n  ]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template created successfully\",\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    },\n    \"fields\": [\n      {\n        \"id\": \"8fa5eacf-34e3-4115-82c8-356edc9ccd6f\",\n        \"type\": \"name\",\n        \"text\": \"Display Name\",\n        \"x\": 50,\n        \"y\": 40\n      }\n    ]\n  }\n}\n\n ```\n\n---\n\n## 3\\. Edit Template\n\n### Endpoint\n\n`PUT /api/templates/{templateId}`\n\n### Description\n\nUpdates an existing template’s details and fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Example Request\n\n``` bash\ncurl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  \"name\": \"Demo Edited\",\n  \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n  \"fields\": [...]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template updated successfully\"\n}\n\n ```\n\n---\n\n## 4\\. Get Template by ID\n\n### Endpoint\n\n`GET /api/templates/{templateId}`\n\n### Description\n\nFetches the details of a specific template.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo Edited\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"fields\": [...],\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    }\n  }\n}\n\n ```\n\n---\n\n## 5\\. Delete Template\n\n### Endpoint\n\n`DELETE /api/templates/{templateId}`\n\n### Description\n\nDeletes a specific template permanently.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template deleted successfully\"\n}\n\n ```"}],"servers":[{"url":"http://{{baseurl}}"}],"paths":{"/templates":{"post":{"tags":["Templates"],"summary":"Create Template","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"parameters":[{"name":"x-api-key","in":"header","schema":{"type":"string"}},{"name":"x-subaccount-email","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}}}}}}}
````

## GET /templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d

> Get Template

````json
{"openapi":"3.0.0","info":{"title":"Akowe Issuance API Endpoints","version":"1.0.0"},"tags":[{"name":"Templates","description":"The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.\n\nThis section covers all template-related endpoints:\n\n---\n\n## 1\\. Get All Templates\n\n### Endpoint\n\n`GET /api/templates`\n\n### Description\n\nFetches all templates available to your account (or sub-account if provided).\n\n### Headers\n\n- **`x-api-key`** _(required)_ – Your API key from the Akowe dashboard.\n    \n- **`x-subaccount-email`** _(optional)_ – Filters results to templates created by the specified sub-account.\n    \n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27;\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"\",\n  \"data\": [\n    {\n      \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n      \"name\": \"Demo Template\",\n      \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n      \"fields\": [\n        {\n          \"id\": \"997a7a31-a5eb-4b6a-bb01-f2b60c848171\",\n          \"type\": \"name\",\n          \"text\": \"Display Name\",\n          \"fontSize\": 16,\n          \"fontFamily\": \"Arial\",\n          \"color\": \"#000000\",\n          \"isBold\": false,\n          \"isItalic\": false,\n          \"alignment\": \"center\",\n          \"x\": 50,\n          \"y\": 40\n        }\n      ],\n      \"dimensions\": {\n        \"width\": 2560,\n        \"height\": 1920\n      },\n      \"subAccountEmail\": \"johndoe@email.com\",\n      \"createdAt\": \"2025-09-24T18:23:43.621Z\"\n    }\n  ]\n}\n\n ```\n\n---\n\n## 2\\. Create Template\n\n### Endpoint\n\n`POST /api/templates`\n\n### Description\n\nCreates a new certificate template with a background image, dimensions, and defined fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`x-subaccount-email`** _(optional but recommended)_ – Links the template to a specific sub-account.\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Request Body\n\n| Field | Type | Required | Description |\n| --- | --- | --- | --- |\n| `name` | string | ✅ Yes | The template name. |\n| `imageUrl` | string | ✅ Yes | Base64 string or image URL for the background. |\n| `dimensions` | object | ✅ Yes | Width and height of the template. |\n| `fields` | array | ✅ Yes | List of field definitions (e.g., name, date, QR). |\n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'x-subaccount-email: johndoe@email.com' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"name\": \"Demo\",\n  \"imageUrl\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z\",\n  \"dimensions\": {\n    \"width\": 2560,\n    \"height\": 1920\n  },\n  \"fields\": [\n    {\n      \"type\": \"name\",\n      \"text\": \"Display Name\",\n      \"x\": 50,\n      \"y\": 40,\n      \"fontSize\": 16,\n      \"fontFamily\": \"Arial\",\n      \"color\": \"#000000\",\n      \"isBold\": false,\n      \"isItalic\": false,\n      \"alignment\": \"center\"\n    }\n  ]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template created successfully\",\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    },\n    \"fields\": [\n      {\n        \"id\": \"8fa5eacf-34e3-4115-82c8-356edc9ccd6f\",\n        \"type\": \"name\",\n        \"text\": \"Display Name\",\n        \"x\": 50,\n        \"y\": 40\n      }\n    ]\n  }\n}\n\n ```\n\n---\n\n## 3\\. Edit Template\n\n### Endpoint\n\n`PUT /api/templates/{templateId}`\n\n### Description\n\nUpdates an existing template’s details and fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Example Request\n\n``` bash\ncurl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  \"name\": \"Demo Edited\",\n  \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n  \"fields\": [...]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template updated successfully\"\n}\n\n ```\n\n---\n\n## 4\\. Get Template by ID\n\n### Endpoint\n\n`GET /api/templates/{templateId}`\n\n### Description\n\nFetches the details of a specific template.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo Edited\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"fields\": [...],\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    }\n  }\n}\n\n ```\n\n---\n\n## 5\\. Delete Template\n\n### Endpoint\n\n`DELETE /api/templates/{templateId}`\n\n### Description\n\nDeletes a specific template permanently.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template deleted successfully\"\n}\n\n ```"}],"servers":[{"url":"http://{{baseurl}}"}],"paths":{"/templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d":{"get":{"tags":["Templates"],"summary":"Get Template","parameters":[{"name":"x-api-key","in":"header","schema":{"type":"string"}},{"name":"x-subaccount-email","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}}}}}}}
````

## PUT /templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d

> Edit Template

````json
{"openapi":"3.0.0","info":{"title":"Akowe Issuance API Endpoints","version":"1.0.0"},"tags":[{"name":"Templates","description":"The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.\n\nThis section covers all template-related endpoints:\n\n---\n\n## 1\\. Get All Templates\n\n### Endpoint\n\n`GET /api/templates`\n\n### Description\n\nFetches all templates available to your account (or sub-account if provided).\n\n### Headers\n\n- **`x-api-key`** _(required)_ – Your API key from the Akowe dashboard.\n    \n- **`x-subaccount-email`** _(optional)_ – Filters results to templates created by the specified sub-account.\n    \n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27;\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"\",\n  \"data\": [\n    {\n      \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n      \"name\": \"Demo Template\",\n      \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n      \"fields\": [\n        {\n          \"id\": \"997a7a31-a5eb-4b6a-bb01-f2b60c848171\",\n          \"type\": \"name\",\n          \"text\": \"Display Name\",\n          \"fontSize\": 16,\n          \"fontFamily\": \"Arial\",\n          \"color\": \"#000000\",\n          \"isBold\": false,\n          \"isItalic\": false,\n          \"alignment\": \"center\",\n          \"x\": 50,\n          \"y\": 40\n        }\n      ],\n      \"dimensions\": {\n        \"width\": 2560,\n        \"height\": 1920\n      },\n      \"subAccountEmail\": \"johndoe@email.com\",\n      \"createdAt\": \"2025-09-24T18:23:43.621Z\"\n    }\n  ]\n}\n\n ```\n\n---\n\n## 2\\. Create Template\n\n### Endpoint\n\n`POST /api/templates`\n\n### Description\n\nCreates a new certificate template with a background image, dimensions, and defined fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`x-subaccount-email`** _(optional but recommended)_ – Links the template to a specific sub-account.\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Request Body\n\n| Field | Type | Required | Description |\n| --- | --- | --- | --- |\n| `name` | string | ✅ Yes | The template name. |\n| `imageUrl` | string | ✅ Yes | Base64 string or image URL for the background. |\n| `dimensions` | object | ✅ Yes | Width and height of the template. |\n| `fields` | array | ✅ Yes | List of field definitions (e.g., name, date, QR). |\n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'x-subaccount-email: johndoe@email.com' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"name\": \"Demo\",\n  \"imageUrl\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z\",\n  \"dimensions\": {\n    \"width\": 2560,\n    \"height\": 1920\n  },\n  \"fields\": [\n    {\n      \"type\": \"name\",\n      \"text\": \"Display Name\",\n      \"x\": 50,\n      \"y\": 40,\n      \"fontSize\": 16,\n      \"fontFamily\": \"Arial\",\n      \"color\": \"#000000\",\n      \"isBold\": false,\n      \"isItalic\": false,\n      \"alignment\": \"center\"\n    }\n  ]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template created successfully\",\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    },\n    \"fields\": [\n      {\n        \"id\": \"8fa5eacf-34e3-4115-82c8-356edc9ccd6f\",\n        \"type\": \"name\",\n        \"text\": \"Display Name\",\n        \"x\": 50,\n        \"y\": 40\n      }\n    ]\n  }\n}\n\n ```\n\n---\n\n## 3\\. Edit Template\n\n### Endpoint\n\n`PUT /api/templates/{templateId}`\n\n### Description\n\nUpdates an existing template’s details and fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Example Request\n\n``` bash\ncurl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  \"name\": \"Demo Edited\",\n  \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n  \"fields\": [...]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template updated successfully\"\n}\n\n ```\n\n---\n\n## 4\\. Get Template by ID\n\n### Endpoint\n\n`GET /api/templates/{templateId}`\n\n### Description\n\nFetches the details of a specific template.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo Edited\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"fields\": [...],\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    }\n  }\n}\n\n ```\n\n---\n\n## 5\\. Delete Template\n\n### Endpoint\n\n`DELETE /api/templates/{templateId}`\n\n### Description\n\nDeletes a specific template permanently.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template deleted successfully\"\n}\n\n ```"}],"servers":[{"url":"http://{{baseurl}}"}],"paths":{"/templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d":{"put":{"tags":["Templates"],"summary":"Edit Template","requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"parameters":[{"name":"x-api-key","in":"header","schema":{"type":"string"}},{"name":"x-subaccount-email","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}}}}}}}
````

## DELETE /templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d

> Delete Template

````json
{"openapi":"3.0.0","info":{"title":"Akowe Issuance API Endpoints","version":"1.0.0"},"tags":[{"name":"Templates","description":"The **Templates API** allows you to create, manage, and delete certificate templates. Templates define the visual layout of a certificate, including background images and dynamic fields such as recipient name, issue date, and QR codes.\n\nThis section covers all template-related endpoints:\n\n---\n\n## 1\\. Get All Templates\n\n### Endpoint\n\n`GET /api/templates`\n\n### Description\n\nFetches all templates available to your account (or sub-account if provided).\n\n### Headers\n\n- **`x-api-key`** _(required)_ – Your API key from the Akowe dashboard.\n    \n- **`x-subaccount-email`** _(optional)_ – Filters results to templates created by the specified sub-account.\n    \n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27;\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"\",\n  \"data\": [\n    {\n      \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n      \"name\": \"Demo Template\",\n      \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n      \"fields\": [\n        {\n          \"id\": \"997a7a31-a5eb-4b6a-bb01-f2b60c848171\",\n          \"type\": \"name\",\n          \"text\": \"Display Name\",\n          \"fontSize\": 16,\n          \"fontFamily\": \"Arial\",\n          \"color\": \"#000000\",\n          \"isBold\": false,\n          \"isItalic\": false,\n          \"alignment\": \"center\",\n          \"x\": 50,\n          \"y\": 40\n        }\n      ],\n      \"dimensions\": {\n        \"width\": 2560,\n        \"height\": 1920\n      },\n      \"subAccountEmail\": \"johndoe@email.com\",\n      \"createdAt\": \"2025-09-24T18:23:43.621Z\"\n    }\n  ]\n}\n\n ```\n\n---\n\n## 2\\. Create Template\n\n### Endpoint\n\n`POST /api/templates`\n\n### Description\n\nCreates a new certificate template with a background image, dimensions, and defined fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`x-subaccount-email`** _(optional but recommended)_ – Links the template to a specific sub-account.\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Request Body\n\n| Field | Type | Required | Description |\n| --- | --- | --- | --- |\n| `name` | string | ✅ Yes | The template name. |\n| `imageUrl` | string | ✅ Yes | Base64 string or image URL for the background. |\n| `dimensions` | object | ✅ Yes | Width and height of the template. |\n| `fields` | array | ✅ Yes | List of field definitions (e.g., name, date, QR). |\n\n### Example Request\n\n``` bash\ncurl --location '{{baseurl}}/api/templates' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'x-subaccount-email: johndoe@email.com' \\\n--header 'Content-Type: application/json' \\\n--data '{\n  \"name\": \"Demo\",\n  \"imageUrl\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQU//Z\",\n  \"dimensions\": {\n    \"width\": 2560,\n    \"height\": 1920\n  },\n  \"fields\": [\n    {\n      \"type\": \"name\",\n      \"text\": \"Display Name\",\n      \"x\": 50,\n      \"y\": 40,\n      \"fontSize\": 16,\n      \"fontFamily\": \"Arial\",\n      \"color\": \"#000000\",\n      \"isBold\": false,\n      \"isItalic\": false,\n      \"alignment\": \"center\"\n    }\n  ]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template created successfully\",\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    },\n    \"fields\": [\n      {\n        \"id\": \"8fa5eacf-34e3-4115-82c8-356edc9ccd6f\",\n        \"type\": \"name\",\n        \"text\": \"Display Name\",\n        \"x\": 50,\n        \"y\": 40\n      }\n    ]\n  }\n}\n\n ```\n\n---\n\n## 3\\. Edit Template\n\n### Endpoint\n\n`PUT /api/templates/{templateId}`\n\n### Description\n\nUpdates an existing template’s details and fields.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n- **`Content-Type`**: `application/json`\n    \n\n### Example Request\n\n``` bash\ncurl --location --request PUT '{{baseurl}}/api/templates/{templateId}' \\\n--header &#x27;x-api-key: <your_api_key>&#x27; \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n  \"name\": \"Demo Edited\",\n  \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n  \"fields\": [...]\n}'\n\n ```\n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template updated successfully\"\n}\n\n ```\n\n---\n\n## 4\\. Get Template by ID\n\n### Endpoint\n\n`GET /api/templates/{templateId}`\n\n### Description\n\nFetches the details of a specific template.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": \"290e4c3b-1da4-4f7e-811d-30dde4f8858d\",\n    \"name\": \"Demo Edited\",\n    \"imageUrl\": \"https://academicrecords.s3.eu-west-2.amazonaws.com/issuance/template.jpeg\",\n    \"fields\": [...],\n    \"dimensions\": {\n      \"width\": 2560,\n      \"height\": 1920\n    }\n  }\n}\n\n ```\n\n---\n\n## 5\\. Delete Template\n\n### Endpoint\n\n`DELETE /api/templates/{templateId}`\n\n### Description\n\nDeletes a specific template permanently.\n\n### Headers\n\n- **`x-api-key`** _(required)_\n    \n\n### Example Response\n\n``` json\n{\n  \"success\": true,\n  \"message\": \"Template deleted successfully\"\n}\n\n ```"}],"servers":[{"url":"http://{{baseurl}}"}],"paths":{"/templates/290e4c3b-1da4-4f7e-811d-30dde4f8858d":{"delete":{"tags":["Templates"],"summary":"Delete Template","parameters":[{"name":"x-api-key","in":"header","schema":{"type":"string"}},{"name":"x-subaccount-email","in":"header","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{}}}}}}}}
````
