# Replace a certificate template

`PUT https://api.cademi.com.br/api/v3/products/{product_id}/certificate-template`

Operation ID: `certificates.template.update` · API v3

Replaces the product's certificate template. Fields omitted from the request body are reset to their default values.

The certificate criteria, QR code position, and font must use one of the supported values.

Send the `ETag` returned by the retrieve operation in the `If-Match` header to avoid overwriting a newer version. Templates of replicated products are read-only.

Required permissions: `certificates.update`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `criteria` | object | yes | Condition under which the certificate becomes available to the user. |
| `defaults` | object | yes | Font and color used for fields that do not specify their own. |
| `enabled` | boolean | yes | Whether the product issues certificates. |
| `fields` | array of object | yes | User custom fields printed on the certificate, in display order. |
| `layout` | object | yes |  |
| `object` | string, one of `certificate_template` | yes |  |
| `product_id` | string | yes | Public ID of the product, prefixed with prd_. |
| `revision` | string | yes |  |
| `single_issue` | boolean | yes | Whether each user can receive at most one certificate for the product. |
| `texts` | object | yes |  |

## Responses

### 200

Returns the updated certificate template.

Body: `data`: CertificateTemplate.

Fields of CertificateTemplate:

| Field | Type | Required | Description |
|---|---|---|---|
| `criteria` | object | yes | Condition under which the certificate becomes available to the user. |
| `defaults` | object | yes | Font and color used for fields that do not specify their own. |
| `enabled` | boolean | yes | Whether the product issues certificates. |
| `fields` | array of object | yes | User custom fields printed on the certificate, in display order. |
| `layout` | object | yes |  |
| `object` | string, one of `certificate_template` | yes |  |
| `product_id` | string | yes | Public ID of the product, prefixed with prd_. |
| `revision` | string | yes |  |
| `single_issue` | boolean | yes | Whether each user can receive at most one certificate for the product. |
| `texts` | object | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The product was not found or is not accessible with the current credentials.

Body: Error.

### 412

The template has changed since the supplied revision was retrieved.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
