# CraftMyPDF

> Generate PDFs and images, find templates and read document usage in CraftMyPDF.

App · 10 actions. Web page: https://docs.lodol.com/docs/integrations/craftmypdf

## Actions

### Generate a PDF

Generate a PDF.

**Inputs**

- Template (`template_id`, text, required): - Template ID.
- Template data (`template_data`, object, required): JSON data, it supports stringified JSON string or an JSON object
- Version (`version`, text): To generate a PDF using a specific version of the template. We use the latest template version unless you specify otherwise.
- Expiration (`expiration`, number): Expiration of the generated PDF in minutes. default to 5 minutes, range between 1 minute and 10080 minutes(7 days)
- Output file (`output_file`, text): output file, default to 'output.pdf'

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "anchors": [
      {}
    ],
    "einvoice_validation_details": "example",
    "einvoice_validation_status": "valid",
    "file": "example",
    "status": "example",
    "transaction_ref": "example"
  }
}
```

### Generate an image

Generate an image.

**Inputs**

- Template (`template_id`, text, required): Template ID
- Template data (`template_data`, object, required): JSON data, it supports stringified JSON string or an JSON object
- Version (`version`, text): To generate an image using a specific version of the template. We use the latest template version unless you specify otherwise.
- Expiration (`expiration`, number): Expiration of the generated PDF in minutes. default to 5 minutes, range between 1 minute and 10080 minutes(7 days)
- Output file (`output_file`, text): output file, default to 'output.jpg'
- Output type (`output_type`, text): image output file type, default to 'jpeg'. Options are 'jpeg' or 'png'. One of: `jpeg`, `png`.

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "file": "example",
    "status": "example",
    "transaction_ref": "example"
  }
}
```

### Get a template

Get a template.

**Inputs**

- Template (`template_id`, text, required): Template id
- Version (`version`, text): Version of the template. Leave it empty to use the latest version.

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "body": "example",
    "json": "example",
    "name": "example",
    "status": "example"
  }
}
```

### Get account information

Get account information.

**Inputs**: None.

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "quota_counter": 1,
    "quota_max": 1,
    "status": "example",
    "template_counter": "example",
    "template_max": 1,
    "username": "example"
  }
}
```

### Get PDF information

Get PDF information.

**Inputs**

- Url (`url`, text, required): URL to a PDF file

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "author": "example",
    "creationDate": "example",
    "creator": "example",
    "keywords": "example",
    "modificationDate": "example",
    "producer": "example",
    "status": "example",
    "subject": "example",
    "title": "example",
    "totalPages": 1,
    "url": "example"
  }
}
```

### Get template usage

Get template usage.

**Inputs**

- Template IDs (`template_ids`, list, required): Templates to include in the usage report.
- Start date (`start_date`, date and time): Start date in ISO 8601 format (UTC time).
- End date (`end_date`, date and time): End date in ISO 8601 format (UTC time).

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "end_date": "example",
    "results": [
      {
        "template_id": "example",
        "total_count": "example",
        "total_credit": "example"
      }
    ],
    "start_date": "example",
    "status": "example",
    "template_ids": [
      "example"
    ]
  }
}
```

### List template versions

List template versions.

**Inputs**

- Template (`template_id`, text, required): Template ID

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "status": "example",
    "template_id": "example",
    "versions": [
      {}
    ]
  }
}
```

### List templates

List templates.

**Inputs**

- Limit (`limit`, number): Retrieve only the number of records specified. Default to 300
- Offset (`offset`, number): Offset is used to skip the number of records from the results. Default to 0
- Template group (`group_name`, text): Return templates in the named group.

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "status": "example",
    "templates": [
      {
        "name": "example",
        "template_id": "example"
      }
    ]
  }
}
```

### List transactions

List transactions.

**Inputs**

- Limit (`limit`, number): Retrieve only the number of records specified. Default to 300
- Offset (`offset`, number): Offset is used to skip the number of records from the results. Default to 0

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "status": "example",
    "transactions": [
      {
        "created_at": "example",
        "credit": "example",
        "exec_tm": 1,
        "resp_file_size": 1,
        "resp_status": "success",
        "transaction_ref": "example",
        "transaction_type": "example"
      }
    ]
  }
}
```

### Merge PDFs

Merge PDFs.

**Inputs**

- PDF URLs (`urls`, list, required): HTTPS URLs of the PDF files, in merge order.
- Expiration (`expiration`, number): Expiration of the generated PDF in minutes. default to 5 minutes, range between 1 minute and 10080 minutes(7 days)
- Output file (`output_file`, text): output file, default to 'output.pdf'

**Outputs**

- `data` (object): The response from CraftMyPDF.

**Example output**

```json
{
  "data": {
    "anchors": [
      {}
    ],
    "einvoice_validation_details": "example",
    "einvoice_validation_status": "valid",
    "file": "example",
    "status": "example",
    "transaction_ref": "example"
  }
}
```
