API reference

PDF templates

The layouts documents are printed with: list, export, check, preview, install and remove. 10 operations.

List templates

GET /templates

Lists the PDF templates. A partner application sees only the templates it installed; an API key sees the account's templates.

Authentication: an API key (x-api-key) or an OAuth access token.

Parameters

NameInTypeDescription
kindquerystringKind of templates to list. Invoice templates by default; TRANSPORT_DOCUMENT lists transport document ones.
One of: INVOICE, TRANSPORT_DOCUMENT
fiscalquerybooleanFiscal templates by default; false lists the non-fiscal ones (auxiliary prints).
curl 'https://api.fiz.co/templates' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.list();
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.list()
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->list();

Response 200

List of templates returned successfully

FieldTypeDescription
[].idstringUnique template identifier
[].namestringTemplate name
[].caestring[]CAE codes the template applies to in the account's automatic choice
[].languagestringTemplate language
One of: en, pt
[].kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
[].formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
[].fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
[].contractVersionnumberData contract version the template needs
[].updatedAtstringLast change

Errors

  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Import template

POST /templates

Creates a template from an export. Created by a partner application, the template belongs to that application: only it sees and changes it, and it prints only the documents that application issued, when templateId is given on the PDF download. An application can keep up to 5 templates per company.

Authentication: an API key (x-api-key) or an OAuth access token. Send an Idempotency-Key to retry this call safely.

Request body

FieldTypeDescription
idstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
kindstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
One of: INVOICE, TRANSPORT_DOCUMENT
formatstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
One of: A4, RECEIPT, RECEIPT_58
fiscalbooleanIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
documentTypesstring[]On import of a template without starterId: if it includes CREDIT_NOTE or DEBIT_NOTE, asks that the template print credit and debit notes. Granted only if the template prints the reference to the rectified document. Ignored with starterId and on replace.
updatedAtstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
name requiredstringTemplate name, unique among the templates of the same owner
data requiredobjectThe template (the data field of GET /templates/{id}, or written from the published description). Validated on the server; an unknown field or a missing fiscal rule is refused with 400.
contractVersion requirednumberData contract version the template was made for (contractVersion from the export). A template that needs a higher version than the one given is refused.
caestring[]CAE codes the template applies to in the account's automatic choice
languagestringTemplate language. Defaults to pt.
One of: en, pt
starterIdstringStarter (starterId from the export). Sets the kind, the paper and whether the template is fiscal; without it the template is a fiscal A4 invoice template.
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
curl --request POST 'https://api.fiz.co/templates' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}" \
  --data '{
  "name": "Modelo Ginásio",
  "data": {
    "basePdf": {
      "width": 210,
      "height": 297,
      "padding": [
        12,
        12,
        12,
        12
      ]
    },
    "schemas": [
      [
        {
          "name": "invoice",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "number"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "customer",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "profile",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "number",
          "type": "text",
          "readOnly": true,
          "content": "{invoice.type} {invoice.number}",
          "position": {
            "x": 12,
            "y": 60
          },
          "width": 186,
          "height": 12,
          "fontName": "Roboto Bold",
          "fontSize": 24
        },
        {
          "name": "items",
          "type": "table",
          "rowSource": "items",
          "columns": [
            "{item.nameWithDescription}",
            "{item.quantity}",
            "{item.unitPrice}",
            "{item.taxRate}",
            "{item.lineTotal}"
          ],
          "head": [
            "Descrição",
            "Qtd.",
            "Preço",
            "IVA",
            "Total"
          ],
          "headWidthPercentages": [
            46,
            10,
            16,
            10,
            18
          ],
          "showHead": true,
          "tableStyles": {
            "borderWidth": 0,
            "borderColor": "#000000"
          },
          "headStyles": {
            "fontName": "Roboto Bold",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "top",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 5,
              "right": 0,
              "bottom": 5,
              "left": 1
            }
          },
          "bodyStyles": {
            "fontName": "Roboto",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "middle",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "alternateBackgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 3,
              "right": 0,
              "bottom": 2,
              "left": 1
            }
          },
          "columnStyles": {
            "alignment": {
              "0": "left",
              "1": "left",
              "2": "right",
              "3": "right",
              "4": "right"
            }
          },
          "position": {
            "x": 12,
            "y": 85
          },
          "width": 186,
          "height": 40
        }
      ]
    ]
  },
  "contractVersion": 2
}'
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.create({
  name: 'Modelo Ginásio',
  data: {
    basePdf: {
      width: 210,
      height: 297,
      padding: [
        12,
        12,
        12,
        12,
      ],
    },
    schemas: [
      [
        {
          name: 'invoice',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'number',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'customer',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'profile',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'number',
          type: 'text',
          readOnly: true,
          content: '{invoice.type} {invoice.number}',
          position: {
            x: 12,
            y: 60,
          },
          width: 186,
          height: 12,
          fontName: 'Roboto Bold',
          fontSize: 24,
        },
        {
          name: 'items',
          type: 'table',
          rowSource: 'items',
          columns: [
            '{item.nameWithDescription}',
            '{item.quantity}',
            '{item.unitPrice}',
            '{item.taxRate}',
            '{item.lineTotal}',
          ],
          head: [
            'Descrição',
            'Qtd.',
            'Preço',
            'IVA',
            'Total',
          ],
          headWidthPercentages: [
            46,
            10,
            16,
            10,
            18,
          ],
          showHead: true,
          tableStyles: {
            borderWidth: 0,
            borderColor: '#000000',
          },
          headStyles: {
            fontName: 'Roboto Bold',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'top',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 5,
              right: 0,
              bottom: 5,
              left: 1,
            },
          },
          bodyStyles: {
            fontName: 'Roboto',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'middle',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            alternateBackgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 3,
              right: 0,
              bottom: 2,
              left: 1,
            },
          },
          columnStyles: {
            alignment: {
              '0': 'left',
              '1': 'left',
              '2': 'right',
              '3': 'right',
              '4': 'right',
            },
          },
          position: {
            x: 12,
            y: 85,
          },
          width: 186,
          height: 40,
        },
      ],
    ],
  },
  contractVersion: 2,
});
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.create({
    "name": "Modelo Ginásio",
    "data": {
        "basePdf": {
            "width": 210,
            "height": 297,
            "padding": [
                12,
                12,
                12,
                12,
            ],
        },
        "schemas": [
            [
                {
                    "name": "invoice",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "number",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "customer",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "profile",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "number",
                    "type": "text",
                    "readOnly": True,
                    "content": "{invoice.type} {invoice.number}",
                    "position": {
                        "x": 12,
                        "y": 60,
                    },
                    "width": 186,
                    "height": 12,
                    "fontName": "Roboto Bold",
                    "fontSize": 24,
                },
                {
                    "name": "items",
                    "type": "table",
                    "rowSource": "items",
                    "columns": [
                        "{item.nameWithDescription}",
                        "{item.quantity}",
                        "{item.unitPrice}",
                        "{item.taxRate}",
                        "{item.lineTotal}",
                    ],
                    "head": [
                        "Descrição",
                        "Qtd.",
                        "Preço",
                        "IVA",
                        "Total",
                    ],
                    "headWidthPercentages": [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    "showHead": True,
                    "tableStyles": {
                        "borderWidth": 0,
                        "borderColor": "#000000",
                    },
                    "headStyles": {
                        "fontName": "Roboto Bold",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "top",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 5,
                            "right": 0,
                            "bottom": 5,
                            "left": 1,
                        },
                    },
                    "bodyStyles": {
                        "fontName": "Roboto",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "middle",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "alternateBackgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 3,
                            "right": 0,
                            "bottom": 2,
                            "left": 1,
                        },
                    },
                    "columnStyles": {
                        "alignment": {
                            "0": "left",
                            "1": "left",
                            "2": "right",
                            "3": "right",
                            "4": "right",
                        },
                    },
                    "position": {
                        "x": 12,
                        "y": 85,
                    },
                    "width": 186,
                    "height": 40,
                },
            ],
        ],
    },
    "contractVersion": 2,
})
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->create([
    'name' => 'Modelo Ginásio',
    'data' => [
        'basePdf' => [
            'width' => 210,
            'height' => 297,
            'padding' => [
                12,
                12,
                12,
                12,
            ],
        ],
        'schemas' => [
            [
                [
                    'name' => 'invoice',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'number',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'customer',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'profile',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'number',
                    'type' => 'text',
                    'readOnly' => true,
                    'content' => '{invoice.type} {invoice.number}',
                    'position' => [
                        'x' => 12,
                        'y' => 60,
                    ],
                    'width' => 186,
                    'height' => 12,
                    'fontName' => 'Roboto Bold',
                    'fontSize' => 24,
                ],
                [
                    'name' => 'items',
                    'type' => 'table',
                    'rowSource' => 'items',
                    'columns' => [
                        '{item.nameWithDescription}',
                        '{item.quantity}',
                        '{item.unitPrice}',
                        '{item.taxRate}',
                        '{item.lineTotal}',
                    ],
                    'head' => [
                        'Descrição',
                        'Qtd.',
                        'Preço',
                        'IVA',
                        'Total',
                    ],
                    'headWidthPercentages' => [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    'showHead' => true,
                    'tableStyles' => [
                        'borderWidth' => 0,
                        'borderColor' => '#000000',
                    ],
                    'headStyles' => [
                        'fontName' => 'Roboto Bold',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'top',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 5,
                            'right' => 0,
                            'bottom' => 5,
                            'left' => 1,
                        ],
                    ],
                    'bodyStyles' => [
                        'fontName' => 'Roboto',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'middle',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'alternateBackgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 3,
                            'right' => 0,
                            'bottom' => 2,
                            'left' => 1,
                        ],
                    ],
                    'columnStyles' => [
                        'alignment' => [
                            '0' => 'left',
                            '1' => 'left',
                            '2' => 'right',
                            '3' => 'right',
                            '4' => 'right',
                        ],
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 85,
                    ],
                    'width' => 186,
                    'height' => 40,
                ],
            ],
        ],
    ],
    'contractVersion' => 2,
]);

Response 201

Template created

FieldTypeDescription
idstringUnique template identifier
namestringTemplate name
caestring[]CAE codes the template applies to in the account's automatic choice
languagestringTemplate language
One of: en, pt
kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
starterIdstringEditor starter this template was created from. Send it back when importing: it sets the template's kind, paper and whether it is fiscal.
contractVersionnumberData contract version the template needs. Send it back when importing.
documentTypesstring[]Document types the template prints
dataobjectThe template designed in the FIZ template editor (pdfme JSON with FIZ fields)
updatedAtstringLast change

Errors

  • 400 Invalid template: unknown field, missing fiscal rule, insufficient contract version or template limit reached
  • 401 Unauthorized - API key missing or invalid
  • 409 A template with this name already exists
  • 422 The idempotency key was already used with a different request body
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Template fields

GET /templates/fields

The paths a template may reference, per data set. It is the list validation enforces: a path outside it is refused.

Authentication: an API key (x-api-key) or an OAuth access token.

curl 'https://api.fiz.co/templates/fields' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.fields();
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.fields()
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->fields();

Response 200

Fields per data set

FieldTypeDescription
[].dataSetstringData set: fiscal (invoices and related documents), nonFiscal (auxiliary print) or transport (transport documents)
[].fieldsstring[]Paths a text field or a cell may reference, such as {invoice.number}
[].rowFieldsstring[]Paths a row of a table bound to the document lines may reference
[].prefixesstring[]Families referenced by a prefix plus a key
[].rowSourcesstring[]Row sources a bound table may name
[].contractVersionnumberData contract version the server implements

Errors

  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

List starters

GET /templates/starters

The FIZ editor's starters. Use them as complete examples when writing a template.

Authentication: an API key (x-api-key) or an OAuth access token.

curl 'https://api.fiz.co/templates/starters' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.starters();
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.starters()
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->starters();

Response 200

Starters

FieldTypeDescription
[].idstringStarter identifier
[].formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
[].languagestringTemplate language
One of: en, pt
[].fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
[].kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT

Errors

  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Get starter

GET /templates/starters/{starterId}

A starter with its data. Import it with POST /templates giving the same starterId.

Authentication: an API key (x-api-key) or an OAuth access token.

Parameters

NameInTypeDescription
starterId requiredpathstringStarter identifier
curl 'https://api.fiz.co/templates/starters/STARTERID' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.starter('STARTERID');
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.starter("STARTERID")
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->starter('STARTERID');

Response 200

Starter

FieldTypeDescription
idstringStarter identifier
formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
languagestringTemplate language
One of: en, pt
fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
dataobjectThe starter (pdfme JSON with FIZ fields), a complete and valid example

Errors

  • 400 Unknown starter
  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Validate template

POST /templates/validate

Checks a template as an import would, without storing it. A refusal comes back as a problem in the response, not as an error.

Authentication: an API key (x-api-key) or an OAuth access token.

Request body

FieldTypeDescription
data requiredobjectThe template (pdfme JSON with FIZ fields)
starterIdstringStarter; sets the kind, the paper and whether the template is fiscal
contractVersionnumberData contract version the template was made for
curl --request POST 'https://api.fiz.co/templates/validate' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "data": {
    "basePdf": {
      "width": 210,
      "height": 297,
      "padding": [
        12,
        12,
        12,
        12
      ]
    },
    "schemas": [
      [
        {
          "name": "invoice",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "number"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "customer",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "profile",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "number",
          "type": "text",
          "readOnly": true,
          "content": "{invoice.type} {invoice.number}",
          "position": {
            "x": 12,
            "y": 60
          },
          "width": 186,
          "height": 12,
          "fontName": "Roboto Bold",
          "fontSize": 24
        },
        {
          "name": "items",
          "type": "table",
          "rowSource": "items",
          "columns": [
            "{item.nameWithDescription}",
            "{item.quantity}",
            "{item.unitPrice}",
            "{item.taxRate}",
            "{item.lineTotal}"
          ],
          "head": [
            "Descrição",
            "Qtd.",
            "Preço",
            "IVA",
            "Total"
          ],
          "headWidthPercentages": [
            46,
            10,
            16,
            10,
            18
          ],
          "showHead": true,
          "tableStyles": {
            "borderWidth": 0,
            "borderColor": "#000000"
          },
          "headStyles": {
            "fontName": "Roboto Bold",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "top",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 5,
              "right": 0,
              "bottom": 5,
              "left": 1
            }
          },
          "bodyStyles": {
            "fontName": "Roboto",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "middle",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "alternateBackgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 3,
              "right": 0,
              "bottom": 2,
              "left": 1
            }
          },
          "columnStyles": {
            "alignment": {
              "0": "left",
              "1": "left",
              "2": "right",
              "3": "right",
              "4": "right"
            }
          },
          "position": {
            "x": 12,
            "y": 85
          },
          "width": 186,
          "height": 40
        }
      ]
    ]
  },
  "contractVersion": 2
}'
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.validate({
  data: {
    basePdf: {
      width: 210,
      height: 297,
      padding: [
        12,
        12,
        12,
        12,
      ],
    },
    schemas: [
      [
        {
          name: 'invoice',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'number',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'customer',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'profile',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'number',
          type: 'text',
          readOnly: true,
          content: '{invoice.type} {invoice.number}',
          position: {
            x: 12,
            y: 60,
          },
          width: 186,
          height: 12,
          fontName: 'Roboto Bold',
          fontSize: 24,
        },
        {
          name: 'items',
          type: 'table',
          rowSource: 'items',
          columns: [
            '{item.nameWithDescription}',
            '{item.quantity}',
            '{item.unitPrice}',
            '{item.taxRate}',
            '{item.lineTotal}',
          ],
          head: [
            'Descrição',
            'Qtd.',
            'Preço',
            'IVA',
            'Total',
          ],
          headWidthPercentages: [
            46,
            10,
            16,
            10,
            18,
          ],
          showHead: true,
          tableStyles: {
            borderWidth: 0,
            borderColor: '#000000',
          },
          headStyles: {
            fontName: 'Roboto Bold',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'top',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 5,
              right: 0,
              bottom: 5,
              left: 1,
            },
          },
          bodyStyles: {
            fontName: 'Roboto',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'middle',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            alternateBackgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 3,
              right: 0,
              bottom: 2,
              left: 1,
            },
          },
          columnStyles: {
            alignment: {
              '0': 'left',
              '1': 'left',
              '2': 'right',
              '3': 'right',
              '4': 'right',
            },
          },
          position: {
            x: 12,
            y: 85,
          },
          width: 186,
          height: 40,
        },
      ],
    ],
  },
  contractVersion: 2,
});
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.validate({
    "data": {
        "basePdf": {
            "width": 210,
            "height": 297,
            "padding": [
                12,
                12,
                12,
                12,
            ],
        },
        "schemas": [
            [
                {
                    "name": "invoice",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "number",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "customer",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "profile",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "number",
                    "type": "text",
                    "readOnly": True,
                    "content": "{invoice.type} {invoice.number}",
                    "position": {
                        "x": 12,
                        "y": 60,
                    },
                    "width": 186,
                    "height": 12,
                    "fontName": "Roboto Bold",
                    "fontSize": 24,
                },
                {
                    "name": "items",
                    "type": "table",
                    "rowSource": "items",
                    "columns": [
                        "{item.nameWithDescription}",
                        "{item.quantity}",
                        "{item.unitPrice}",
                        "{item.taxRate}",
                        "{item.lineTotal}",
                    ],
                    "head": [
                        "Descrição",
                        "Qtd.",
                        "Preço",
                        "IVA",
                        "Total",
                    ],
                    "headWidthPercentages": [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    "showHead": True,
                    "tableStyles": {
                        "borderWidth": 0,
                        "borderColor": "#000000",
                    },
                    "headStyles": {
                        "fontName": "Roboto Bold",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "top",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 5,
                            "right": 0,
                            "bottom": 5,
                            "left": 1,
                        },
                    },
                    "bodyStyles": {
                        "fontName": "Roboto",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "middle",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "alternateBackgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 3,
                            "right": 0,
                            "bottom": 2,
                            "left": 1,
                        },
                    },
                    "columnStyles": {
                        "alignment": {
                            "0": "left",
                            "1": "left",
                            "2": "right",
                            "3": "right",
                            "4": "right",
                        },
                    },
                    "position": {
                        "x": 12,
                        "y": 85,
                    },
                    "width": 186,
                    "height": 40,
                },
            ],
        ],
    },
    "contractVersion": 2,
})
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->validate([
    'data' => [
        'basePdf' => [
            'width' => 210,
            'height' => 297,
            'padding' => [
                12,
                12,
                12,
                12,
            ],
        ],
        'schemas' => [
            [
                [
                    'name' => 'invoice',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'number',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'customer',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'profile',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'number',
                    'type' => 'text',
                    'readOnly' => true,
                    'content' => '{invoice.type} {invoice.number}',
                    'position' => [
                        'x' => 12,
                        'y' => 60,
                    ],
                    'width' => 186,
                    'height' => 12,
                    'fontName' => 'Roboto Bold',
                    'fontSize' => 24,
                ],
                [
                    'name' => 'items',
                    'type' => 'table',
                    'rowSource' => 'items',
                    'columns' => [
                        '{item.nameWithDescription}',
                        '{item.quantity}',
                        '{item.unitPrice}',
                        '{item.taxRate}',
                        '{item.lineTotal}',
                    ],
                    'head' => [
                        'Descrição',
                        'Qtd.',
                        'Preço',
                        'IVA',
                        'Total',
                    ],
                    'headWidthPercentages' => [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    'showHead' => true,
                    'tableStyles' => [
                        'borderWidth' => 0,
                        'borderColor' => '#000000',
                    ],
                    'headStyles' => [
                        'fontName' => 'Roboto Bold',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'top',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 5,
                            'right' => 0,
                            'bottom' => 5,
                            'left' => 1,
                        ],
                    ],
                    'bodyStyles' => [
                        'fontName' => 'Roboto',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'middle',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'alternateBackgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 3,
                            'right' => 0,
                            'bottom' => 2,
                            'left' => 1,
                        ],
                    ],
                    'columnStyles' => [
                        'alignment' => [
                            '0' => 'left',
                            '1' => 'left',
                            '2' => 'right',
                            '3' => 'right',
                            '4' => 'right',
                        ],
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 85,
                    ],
                    'width' => 186,
                    'height' => 40,
                ],
            ],
        ],
    ],
    'contractVersion' => 2,
]);

Response 200

Validation result

FieldTypeDescription
validbooleantrue if an import would accept the template
problemsobject[]The first problem found; validation stops at it. Empty when valid.
problems[].codestringThe error code an import would answer with
problems[].detailstringTechnical description of the fault (the path, field or element at fault), for the template's developer
problems[].requiredVersionnumberFor TEMPLATES_EDITOR_OUTDATED: the contract version the template needs
fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
contractVersionnumberData contract version the template needs

Errors

  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Preview template

POST /templates/preview

Renders an unsaved template with the same PDF engine as issued documents, on a sample document. Every page carries «DOCUMENTO DE TESTE — SEM VALIDADE FISCAL». Validated like an import: an invalid template is refused with 400. Invoice templates only. To see the template on a real document, install it and download that document's PDF with templateId.

Authentication: an API key (x-api-key) or an OAuth access token.

Request body

FieldTypeDescription
data requiredobjectThe template (pdfme JSON with FIZ fields)
starterIdstringStarter; sets the kind, the paper and whether the template is fiscal
contractVersionnumberData contract version the template was made for
languagestringPreview language. Defaults to pt.
One of: en, pt
documentTypestringSample document type. Defaults to INVOICE.
One of: INVOICE, INVOICE_RECEIPT, SIMPLIFIED_INVOICE
curl --request POST 'https://api.fiz.co/templates/preview' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "data": {
    "basePdf": {
      "width": 210,
      "height": 297,
      "padding": [
        12,
        12,
        12,
        12
      ]
    },
    "schemas": [
      [
        {
          "name": "invoice",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "number"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "customer",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "profile",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "number",
          "type": "text",
          "readOnly": true,
          "content": "{invoice.type} {invoice.number}",
          "position": {
            "x": 12,
            "y": 60
          },
          "width": 186,
          "height": 12,
          "fontName": "Roboto Bold",
          "fontSize": 24
        },
        {
          "name": "items",
          "type": "table",
          "rowSource": "items",
          "columns": [
            "{item.nameWithDescription}",
            "{item.quantity}",
            "{item.unitPrice}",
            "{item.taxRate}",
            "{item.lineTotal}"
          ],
          "head": [
            "Descrição",
            "Qtd.",
            "Preço",
            "IVA",
            "Total"
          ],
          "headWidthPercentages": [
            46,
            10,
            16,
            10,
            18
          ],
          "showHead": true,
          "tableStyles": {
            "borderWidth": 0,
            "borderColor": "#000000"
          },
          "headStyles": {
            "fontName": "Roboto Bold",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "top",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 5,
              "right": 0,
              "bottom": 5,
              "left": 1
            }
          },
          "bodyStyles": {
            "fontName": "Roboto",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "middle",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "alternateBackgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 3,
              "right": 0,
              "bottom": 2,
              "left": 1
            }
          },
          "columnStyles": {
            "alignment": {
              "0": "left",
              "1": "left",
              "2": "right",
              "3": "right",
              "4": "right"
            }
          },
          "position": {
            "x": 12,
            "y": 85
          },
          "width": 186,
          "height": 40
        }
      ]
    ]
  },
  "contractVersion": 2
}'
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.preview({
  data: {
    basePdf: {
      width: 210,
      height: 297,
      padding: [
        12,
        12,
        12,
        12,
      ],
    },
    schemas: [
      [
        {
          name: 'invoice',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'number',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'customer',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'profile',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'number',
          type: 'text',
          readOnly: true,
          content: '{invoice.type} {invoice.number}',
          position: {
            x: 12,
            y: 60,
          },
          width: 186,
          height: 12,
          fontName: 'Roboto Bold',
          fontSize: 24,
        },
        {
          name: 'items',
          type: 'table',
          rowSource: 'items',
          columns: [
            '{item.nameWithDescription}',
            '{item.quantity}',
            '{item.unitPrice}',
            '{item.taxRate}',
            '{item.lineTotal}',
          ],
          head: [
            'Descrição',
            'Qtd.',
            'Preço',
            'IVA',
            'Total',
          ],
          headWidthPercentages: [
            46,
            10,
            16,
            10,
            18,
          ],
          showHead: true,
          tableStyles: {
            borderWidth: 0,
            borderColor: '#000000',
          },
          headStyles: {
            fontName: 'Roboto Bold',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'top',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 5,
              right: 0,
              bottom: 5,
              left: 1,
            },
          },
          bodyStyles: {
            fontName: 'Roboto',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'middle',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            alternateBackgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 3,
              right: 0,
              bottom: 2,
              left: 1,
            },
          },
          columnStyles: {
            alignment: {
              '0': 'left',
              '1': 'left',
              '2': 'right',
              '3': 'right',
              '4': 'right',
            },
          },
          position: {
            x: 12,
            y: 85,
          },
          width: 186,
          height: 40,
        },
      ],
    ],
  },
  contractVersion: 2,
});
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.preview({
    "data": {
        "basePdf": {
            "width": 210,
            "height": 297,
            "padding": [
                12,
                12,
                12,
                12,
            ],
        },
        "schemas": [
            [
                {
                    "name": "invoice",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "number",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "customer",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "profile",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "number",
                    "type": "text",
                    "readOnly": True,
                    "content": "{invoice.type} {invoice.number}",
                    "position": {
                        "x": 12,
                        "y": 60,
                    },
                    "width": 186,
                    "height": 12,
                    "fontName": "Roboto Bold",
                    "fontSize": 24,
                },
                {
                    "name": "items",
                    "type": "table",
                    "rowSource": "items",
                    "columns": [
                        "{item.nameWithDescription}",
                        "{item.quantity}",
                        "{item.unitPrice}",
                        "{item.taxRate}",
                        "{item.lineTotal}",
                    ],
                    "head": [
                        "Descrição",
                        "Qtd.",
                        "Preço",
                        "IVA",
                        "Total",
                    ],
                    "headWidthPercentages": [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    "showHead": True,
                    "tableStyles": {
                        "borderWidth": 0,
                        "borderColor": "#000000",
                    },
                    "headStyles": {
                        "fontName": "Roboto Bold",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "top",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 5,
                            "right": 0,
                            "bottom": 5,
                            "left": 1,
                        },
                    },
                    "bodyStyles": {
                        "fontName": "Roboto",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "middle",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "alternateBackgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 3,
                            "right": 0,
                            "bottom": 2,
                            "left": 1,
                        },
                    },
                    "columnStyles": {
                        "alignment": {
                            "0": "left",
                            "1": "left",
                            "2": "right",
                            "3": "right",
                            "4": "right",
                        },
                    },
                    "position": {
                        "x": 12,
                        "y": 85,
                    },
                    "width": 186,
                    "height": 40,
                },
            ],
        ],
    },
    "contractVersion": 2,
})
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->preview([
    'data' => [
        'basePdf' => [
            'width' => 210,
            'height' => 297,
            'padding' => [
                12,
                12,
                12,
                12,
            ],
        ],
        'schemas' => [
            [
                [
                    'name' => 'invoice',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'number',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'customer',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'profile',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'number',
                    'type' => 'text',
                    'readOnly' => true,
                    'content' => '{invoice.type} {invoice.number}',
                    'position' => [
                        'x' => 12,
                        'y' => 60,
                    ],
                    'width' => 186,
                    'height' => 12,
                    'fontName' => 'Roboto Bold',
                    'fontSize' => 24,
                ],
                [
                    'name' => 'items',
                    'type' => 'table',
                    'rowSource' => 'items',
                    'columns' => [
                        '{item.nameWithDescription}',
                        '{item.quantity}',
                        '{item.unitPrice}',
                        '{item.taxRate}',
                        '{item.lineTotal}',
                    ],
                    'head' => [
                        'Descrição',
                        'Qtd.',
                        'Preço',
                        'IVA',
                        'Total',
                    ],
                    'headWidthPercentages' => [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    'showHead' => true,
                    'tableStyles' => [
                        'borderWidth' => 0,
                        'borderColor' => '#000000',
                    ],
                    'headStyles' => [
                        'fontName' => 'Roboto Bold',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'top',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 5,
                            'right' => 0,
                            'bottom' => 5,
                            'left' => 1,
                        ],
                    ],
                    'bodyStyles' => [
                        'fontName' => 'Roboto',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'middle',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'alternateBackgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 3,
                            'right' => 0,
                            'bottom' => 2,
                            'left' => 1,
                        ],
                    ],
                    'columnStyles' => [
                        'alignment' => [
                            '0' => 'left',
                            '1' => 'left',
                            '2' => 'right',
                            '3' => 'right',
                            '4' => 'right',
                        ],
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 85,
                    ],
                    'width' => 186,
                    'height' => 40,
                ],
            ],
        ],
    ],
    'contractVersion' => 2,
]);

Response 200

Preview PDF

FieldTypeDescription
idstringFile identifier
namestringFile name
urlstringTemporary URL of the preview PDF

Errors

  • 400 Invalid template or unsupported document type
  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Export template

GET /templates/{id}

Returns the full template, including data. The response can be sent as is to POST /templates in another company or the sandbox: the server-owned fields are ignored.

Authentication: an API key (x-api-key) or an OAuth access token.

Parameters

NameInTypeDescription
id requiredpathstringUnique template identifier
curl 'https://api.fiz.co/templates/ID' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.retrieve('ID');
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.retrieve("ID")
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->retrieve('ID');

Response 200

Template

FieldTypeDescription
idstringUnique template identifier
namestringTemplate name
caestring[]CAE codes the template applies to in the account's automatic choice
languagestringTemplate language
One of: en, pt
kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
starterIdstringEditor starter this template was created from. Send it back when importing: it sets the template's kind, paper and whether it is fiscal.
contractVersionnumberData contract version the template needs. Send it back when importing.
documentTypesstring[]Document types the template prints
dataobjectThe template designed in the FIZ template editor (pdfme JSON with FIZ fields)
updatedAtstringLast change

Errors

  • 401 Unauthorized - API key missing or invalid
  • 403 The template belongs to the account or to another application
  • 404 Template not found
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Replace template

PUT /templates/{id}

Replaces a template's name, data, CAE and language. The kind, paper and fiscal character do not change.

Authentication: an API key (x-api-key) or an OAuth access token. Send an Idempotency-Key to retry this call safely.

Parameters

NameInTypeDescription
id requiredpathstringUnique template identifier

Request body

FieldTypeDescription
idstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
kindstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
One of: INVOICE, TRANSPORT_DOCUMENT
formatstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
One of: A4, RECEIPT, RECEIPT_58
fiscalbooleanIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
documentTypesstring[]On import of a template without starterId: if it includes CREDIT_NOTE or DEBIT_NOTE, asks that the template print credit and debit notes. Granted only if the template prints the reference to the rectified document. Ignored with starterId and on replace.
updatedAtstringIgnored on import: set by the server. Accepted so the response of GET /templates/{id} can be sent as is.
name requiredstringTemplate name, unique among the templates of the same owner
data requiredobjectThe template (the data field of GET /templates/{id}, or written from the published description). Validated on the server; an unknown field or a missing fiscal rule is refused with 400.
contractVersion requirednumberData contract version the template was made for (contractVersion from the export). A template that needs a higher version than the one given is refused.
caestring[]CAE codes the template applies to in the account's automatic choice
languagestringTemplate language. Defaults to pt.
One of: en, pt
starterIdstringIgnored on replace: a template's origin does not change. Accepted so an export can be sent as is.
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
curl --request PUT 'https://api.fiz.co/templates/ID' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}" \
  --data '{
  "name": "Modelo Ginásio",
  "data": {
    "basePdf": {
      "width": 210,
      "height": 297,
      "padding": [
        12,
        12,
        12,
        12
      ]
    },
    "schemas": [
      [
        {
          "name": "invoice",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "number"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "customer",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "profile",
          "type": "multiVariableText",
          "content": "{}",
          "text": "",
          "variables": [
            "name"
          ],
          "position": {
            "x": 12,
            "y": 12
          },
          "width": 4,
          "height": 4
        },
        {
          "name": "number",
          "type": "text",
          "readOnly": true,
          "content": "{invoice.type} {invoice.number}",
          "position": {
            "x": 12,
            "y": 60
          },
          "width": 186,
          "height": 12,
          "fontName": "Roboto Bold",
          "fontSize": 24
        },
        {
          "name": "items",
          "type": "table",
          "rowSource": "items",
          "columns": [
            "{item.nameWithDescription}",
            "{item.quantity}",
            "{item.unitPrice}",
            "{item.taxRate}",
            "{item.lineTotal}"
          ],
          "head": [
            "Descrição",
            "Qtd.",
            "Preço",
            "IVA",
            "Total"
          ],
          "headWidthPercentages": [
            46,
            10,
            16,
            10,
            18
          ],
          "showHead": true,
          "tableStyles": {
            "borderWidth": 0,
            "borderColor": "#000000"
          },
          "headStyles": {
            "fontName": "Roboto Bold",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "top",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 5,
              "right": 0,
              "bottom": 5,
              "left": 1
            }
          },
          "bodyStyles": {
            "fontName": "Roboto",
            "fontSize": 10,
            "characterSpacing": 0,
            "alignment": "left",
            "verticalAlignment": "middle",
            "lineHeight": 1,
            "fontColor": "#000000",
            "borderColor": "#000000",
            "backgroundColor": "",
            "alternateBackgroundColor": "",
            "borderWidth": {
              "top": 0,
              "right": 0,
              "bottom": 0,
              "left": 0
            },
            "padding": {
              "top": 3,
              "right": 0,
              "bottom": 2,
              "left": 1
            }
          },
          "columnStyles": {
            "alignment": {
              "0": "left",
              "1": "left",
              "2": "right",
              "3": "right",
              "4": "right"
            }
          },
          "position": {
            "x": 12,
            "y": 85
          },
          "width": 186,
          "height": 40
        }
      ]
    ]
  },
  "contractVersion": 2
}'
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.update('ID', {
  name: 'Modelo Ginásio',
  data: {
    basePdf: {
      width: 210,
      height: 297,
      padding: [
        12,
        12,
        12,
        12,
      ],
    },
    schemas: [
      [
        {
          name: 'invoice',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'number',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'customer',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'profile',
          type: 'multiVariableText',
          content: '{}',
          text: '',
          variables: [
            'name',
          ],
          position: {
            x: 12,
            y: 12,
          },
          width: 4,
          height: 4,
        },
        {
          name: 'number',
          type: 'text',
          readOnly: true,
          content: '{invoice.type} {invoice.number}',
          position: {
            x: 12,
            y: 60,
          },
          width: 186,
          height: 12,
          fontName: 'Roboto Bold',
          fontSize: 24,
        },
        {
          name: 'items',
          type: 'table',
          rowSource: 'items',
          columns: [
            '{item.nameWithDescription}',
            '{item.quantity}',
            '{item.unitPrice}',
            '{item.taxRate}',
            '{item.lineTotal}',
          ],
          head: [
            'Descrição',
            'Qtd.',
            'Preço',
            'IVA',
            'Total',
          ],
          headWidthPercentages: [
            46,
            10,
            16,
            10,
            18,
          ],
          showHead: true,
          tableStyles: {
            borderWidth: 0,
            borderColor: '#000000',
          },
          headStyles: {
            fontName: 'Roboto Bold',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'top',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 5,
              right: 0,
              bottom: 5,
              left: 1,
            },
          },
          bodyStyles: {
            fontName: 'Roboto',
            fontSize: 10,
            characterSpacing: 0,
            alignment: 'left',
            verticalAlignment: 'middle',
            lineHeight: 1,
            fontColor: '#000000',
            borderColor: '#000000',
            backgroundColor: '',
            alternateBackgroundColor: '',
            borderWidth: {
              top: 0,
              right: 0,
              bottom: 0,
              left: 0,
            },
            padding: {
              top: 3,
              right: 0,
              bottom: 2,
              left: 1,
            },
          },
          columnStyles: {
            alignment: {
              '0': 'left',
              '1': 'left',
              '2': 'right',
              '3': 'right',
              '4': 'right',
            },
          },
          position: {
            x: 12,
            y: 85,
          },
          width: 186,
          height: 40,
        },
      ],
    ],
  },
  contractVersion: 2,
});
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.update("ID", {
    "name": "Modelo Ginásio",
    "data": {
        "basePdf": {
            "width": 210,
            "height": 297,
            "padding": [
                12,
                12,
                12,
                12,
            ],
        },
        "schemas": [
            [
                {
                    "name": "invoice",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "number",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "customer",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "profile",
                    "type": "multiVariableText",
                    "content": "{}",
                    "text": "",
                    "variables": [
                        "name",
                    ],
                    "position": {
                        "x": 12,
                        "y": 12,
                    },
                    "width": 4,
                    "height": 4,
                },
                {
                    "name": "number",
                    "type": "text",
                    "readOnly": True,
                    "content": "{invoice.type} {invoice.number}",
                    "position": {
                        "x": 12,
                        "y": 60,
                    },
                    "width": 186,
                    "height": 12,
                    "fontName": "Roboto Bold",
                    "fontSize": 24,
                },
                {
                    "name": "items",
                    "type": "table",
                    "rowSource": "items",
                    "columns": [
                        "{item.nameWithDescription}",
                        "{item.quantity}",
                        "{item.unitPrice}",
                        "{item.taxRate}",
                        "{item.lineTotal}",
                    ],
                    "head": [
                        "Descrição",
                        "Qtd.",
                        "Preço",
                        "IVA",
                        "Total",
                    ],
                    "headWidthPercentages": [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    "showHead": True,
                    "tableStyles": {
                        "borderWidth": 0,
                        "borderColor": "#000000",
                    },
                    "headStyles": {
                        "fontName": "Roboto Bold",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "top",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 5,
                            "right": 0,
                            "bottom": 5,
                            "left": 1,
                        },
                    },
                    "bodyStyles": {
                        "fontName": "Roboto",
                        "fontSize": 10,
                        "characterSpacing": 0,
                        "alignment": "left",
                        "verticalAlignment": "middle",
                        "lineHeight": 1,
                        "fontColor": "#000000",
                        "borderColor": "#000000",
                        "backgroundColor": "",
                        "alternateBackgroundColor": "",
                        "borderWidth": {
                            "top": 0,
                            "right": 0,
                            "bottom": 0,
                            "left": 0,
                        },
                        "padding": {
                            "top": 3,
                            "right": 0,
                            "bottom": 2,
                            "left": 1,
                        },
                    },
                    "columnStyles": {
                        "alignment": {
                            "0": "left",
                            "1": "left",
                            "2": "right",
                            "3": "right",
                            "4": "right",
                        },
                    },
                    "position": {
                        "x": 12,
                        "y": 85,
                    },
                    "width": 186,
                    "height": 40,
                },
            ],
        ],
    },
    "contractVersion": 2,
})
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->update('ID', [
    'name' => 'Modelo Ginásio',
    'data' => [
        'basePdf' => [
            'width' => 210,
            'height' => 297,
            'padding' => [
                12,
                12,
                12,
                12,
            ],
        ],
        'schemas' => [
            [
                [
                    'name' => 'invoice',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'number',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'customer',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'profile',
                    'type' => 'multiVariableText',
                    'content' => '{}',
                    'text' => '',
                    'variables' => [
                        'name',
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 12,
                    ],
                    'width' => 4,
                    'height' => 4,
                ],
                [
                    'name' => 'number',
                    'type' => 'text',
                    'readOnly' => true,
                    'content' => '{invoice.type} {invoice.number}',
                    'position' => [
                        'x' => 12,
                        'y' => 60,
                    ],
                    'width' => 186,
                    'height' => 12,
                    'fontName' => 'Roboto Bold',
                    'fontSize' => 24,
                ],
                [
                    'name' => 'items',
                    'type' => 'table',
                    'rowSource' => 'items',
                    'columns' => [
                        '{item.nameWithDescription}',
                        '{item.quantity}',
                        '{item.unitPrice}',
                        '{item.taxRate}',
                        '{item.lineTotal}',
                    ],
                    'head' => [
                        'Descrição',
                        'Qtd.',
                        'Preço',
                        'IVA',
                        'Total',
                    ],
                    'headWidthPercentages' => [
                        46,
                        10,
                        16,
                        10,
                        18,
                    ],
                    'showHead' => true,
                    'tableStyles' => [
                        'borderWidth' => 0,
                        'borderColor' => '#000000',
                    ],
                    'headStyles' => [
                        'fontName' => 'Roboto Bold',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'top',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 5,
                            'right' => 0,
                            'bottom' => 5,
                            'left' => 1,
                        ],
                    ],
                    'bodyStyles' => [
                        'fontName' => 'Roboto',
                        'fontSize' => 10,
                        'characterSpacing' => 0,
                        'alignment' => 'left',
                        'verticalAlignment' => 'middle',
                        'lineHeight' => 1,
                        'fontColor' => '#000000',
                        'borderColor' => '#000000',
                        'backgroundColor' => '',
                        'alternateBackgroundColor' => '',
                        'borderWidth' => [
                            'top' => 0,
                            'right' => 0,
                            'bottom' => 0,
                            'left' => 0,
                        ],
                        'padding' => [
                            'top' => 3,
                            'right' => 0,
                            'bottom' => 2,
                            'left' => 1,
                        ],
                    ],
                    'columnStyles' => [
                        'alignment' => [
                            '0' => 'left',
                            '1' => 'left',
                            '2' => 'right',
                            '3' => 'right',
                            '4' => 'right',
                        ],
                    ],
                    'position' => [
                        'x' => 12,
                        'y' => 85,
                    ],
                    'width' => 186,
                    'height' => 40,
                ],
            ],
        ],
    ],
    'contractVersion' => 2,
]);

Response 200

Template updated

FieldTypeDescription
idstringUnique template identifier
namestringTemplate name
caestring[]CAE codes the template applies to in the account's automatic choice
languagestringTemplate language
One of: en, pt
kindstringWhat the template prints: invoices and related documents, or transport documents
One of: INVOICE, TRANSPORT_DOCUMENT
formatstringPaper the template is laid out for
One of: A4, RECEIPT, RECEIPT_58
fiscalbooleantrue if the template prints the fiscal document itself; false for an auxiliary print without fiscal value
starterIdstringEditor starter this template was created from. Send it back when importing: it sets the template's kind, paper and whether it is fiscal.
contractVersionnumberData contract version the template needs. Send it back when importing.
documentTypesstring[]Document types the template prints
dataobjectThe template designed in the FIZ template editor (pdfme JSON with FIZ fields)
updatedAtstringLast change

Errors

  • 400 Invalid template: unknown field, missing fiscal rule, insufficient contract version or template limit reached
  • 401 Unauthorized - API key missing or invalid
  • 403 The template belongs to the account or to another application
  • 404 Template not found
  • 409 A request with this idempotency key is still being processed, or the outcome of the first attempt is unknown
  • 422 The idempotency key was already used with a different request body
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Delete template

DELETE /templates/{id}

Deletes a template.

Authentication: an API key (x-api-key) or an OAuth access token. Send an Idempotency-Key to retry this call safely.

Parameters

NameInTypeDescription
id requiredpathstringUnique template identifier
# Once per operation. Keep it and reuse it on every retry.
IDEMPOTENCY_KEY=$(uuidgen)
curl --request DELETE 'https://api.fiz.co/templates/ID' \
  --header "x-api-key: $FIZ_API_KEY" \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY:?set the operation key first, in the step above}"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.templates.delete('ID');
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.templates.delete("ID")
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->templates->delete('ID');

Response 200

Template deleted

FieldTypeDescription
idstringIdentifier of the deleted template
deletedbooleantrue when the template was deleted

Errors

  • 401 Unauthorized - API key missing or invalid
  • 403 The template belongs to the account or to another application
  • 404 Template not found
  • 409 A request with this idempotency key is still being processed, or the outcome of the first attempt is unknown
  • 422 The idempotency key was already used with a different request body
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Errors

Errors share one shape: statusCode, message, code and error, with the request id in the X-Request-Id header.

All resources