> For the complete documentation index, see [llms.txt](https://docs.locoia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.locoia.com/connectors/building-connectors/building-connector-actions/actions-examples.md).

# Actions Examples

### **Invoicing**

#### Line Items

**1. LexOffice > Create Vouchers**

UI form schema:

{% code lineNumbers="true" %}

```json
{
  "type": {
    "type": "select",
    "title": "Type",
    "enum": [
      "salesinvoice",
      "salescreditnote",
      "purchaseinvoice",
      "purchasecreditnote",
      "invoice",
      "downpaymentinvoice",
      "creditnote",
      "orderconfirmation",
      "quotation",
      "deliverynote"
    ],
    "info": "Possible values are salesinvoice (e.g. for sales orders), and salescreditnote (e.g. for refunds or returned sales orders).",
    "required": true
  },
  "voucherNumber": {
    "type": "text",
    "title": "Voucher number",
    "placeholder": "2345678",
    "required": true
  },
  "voucherDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "title": "Voucher date",
    "required": true
  },
  "shippingDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "title": "Shipping date",
    "required": false
  },
  "dueDate": {
    "type": "date",
    "placeholder": "2016-06-29T15:15:09.447+02:00",
    "info": "If not specified then the voucherDate will also be used for dueDate.",
    "title": "Due date",
    "required": false
  },
  "totalGrossAmount": {
    "type": "text",
    "placeholder": "119.00",
    "title": "Total gross amount",
    "required": true
  },
  "totalTaxAmount": {
    "type": "text",
    "placeholder": "19",
    "title": "Total tax amount",
    "required": true
  },
  "taxType": {
    "type": "select",
    "enum": [
      "net",
      "gross"
    ],
    "default": "gross",
    "allowCreate": true,
    "title": "Tax type",
    "required": true
  },
  "useCollectiveContact": {
    "type": "switch",
    "default": true,
    "title": "Use collective contact",
    "info": "Set to true if the Collective Contact (customer/vendor) within lexoffice should be used. If used, the optional contactId will be ignored.",
    "required": false
  },
  "remark": {
    "type": "text",
    "title": "Subject remarks",
    "placeholder": "AWS invoice",
    "required": true
  },
  "voucherItems": {
    "type": "code",
    "mode": "jinja2",
    "rows": "9",
    "title": "Voucher items (Jinja code field)",
    "placeholder": "{% for item in line_items %}\n  {\n    \"amount\": {{ item.amount }},\n    \"taxAmount\": {{ item.taxAmount }},\n    \"taxRatePercent\": {{ item.taxRatePercent }},\n    \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n  }\n  {% if not loop.last %},{% endif %}\n{% endfor %}",
    "default": "{% for item in line_items %}\n  {\n    \"amount\": {{ item.amount }},\n    \"taxAmount\": {{ item.taxAmount }},\n    \"taxRatePercent\": {{ item.taxRatePercent }},\n    \"categoryId\": \"8f8664a8-fd86-11e1-a21f-0800200c9a66\" {# this id is Warenverkäufe as per https://developers.lexoffice.io/docs/#vouchers-endpoint-list-of-categoryids #}\n  }\n  {% if not loop.last %},{% endif %}\n{% endfor %}",
    "info": "Use this field if you want to define your line items flexibly (multiple). Here is the docs: https://developers.lexoffice.io/docs/#vouchers-endpoint-create-a-voucher",
    "required": false
  }
}
```

{% endcode %}

Request **body** of the action:

{% code lineNumbers="true" %}

```python
{
  "type": "{{ type }}",
  "voucherNumber": "{{ voucherNumber }}",
  "voucherDate": "{{ voucherDate }}",
  {% if shippingDate is defined %}
    ,"shippingDate": "{{ shippingDate }}"
  {% endif %}
  {% if dueDate is defined %}
    ,"dueDate": "{{ dueDate }}"
  {% endif %}
  "totalGrossAmount": {{ totalGrossAmount }},
  "totalTaxAmount": {{ totalTaxAmount }},
  "taxType": "{{ taxType }}",
  "useCollectiveContact": {{ useCollectiveContact | lower }},
  "remark": "{{ remark }}",
  "voucherItems": [ {{ voucherItems }} ]
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.locoia.com/connectors/building-connectors/building-connector-actions/actions-examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
