# invoice.created

> Sent when a finalized invoice is created, whether through the API, the app or a recurring invoice. The PDF is rendered asynchronously, so it may not exist yet when this event arrives; GET /invoices/{invoice}/download waits for it. Each event is attempted up to 3 times: the first delivery, then retries after 10 s and 100 s; only a 2xx response counts as success. The request times out after 10 seconds.

## Webhook event: POST invoice.created

Sent when a finalized invoice is created, whether through the API, the app or a recurring invoice. The PDF is rendered asynchronously, so it may not exist yet when this event arrives; `GET /invoices/{invoice}/download` waits for it. Each event is attempted up to 3 times: the first delivery, then retries after 10 s and 100 s; only a 2xx response counts as success. The request times out after 10 seconds.

### Request and responses

```json
{
  "servers": [
    {
      "url": "https://app.fsaskaita.lt/api",
      "description": "Production"
    }
  ],
  "operation": {
    "tags": [
      "Invoices"
    ],
    "operationId": "webhookInvoiceCreated",
    "summary": "invoice.created",
    "description": "Sent when a finalized invoice is created, whether through the API, the app or a recurring invoice. The PDF is rendered asynchronously, so it may not exist yet when this event arrives; `GET /invoices/{invoice}/download` waits for it. Each event is attempted up to 3 times: the first delivery, then retries after 10 s and 100 s; only a 2xx response counts as success. The request times out after 10 seconds.",
    "parameters": [
      {
        "$ref": "#/components/parameters/webhookSignature"
      }
    ],
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "event",
              "data"
            ],
            "properties": {
              "event": {
                "const": "invoice.created"
              },
              "data": {
                "$ref": "#/components/schemas/Invoice"
              }
            }
          }
        }
      }
    },
    "responses": {
      "2XX": {
        "description": "Return any 2xx status to acknowledge the delivery. Any other status or a timeout schedules a retry."
      }
    }
  },
  "securitySchemes": {
    "bearerAuth": {
      "type": "http",
      "description": "Business token created in the app under Settings, Integrations, API. The token is scoped to exactly one business, has no expiry and is shown only once. Send it as `Authorization: Bearer <token>` together with `Accept: application/json`.",
      "scheme": "bearer"
    }
  }
}
```

### Referenced components

```json
{
  "#/components/parameters/webhookSignature": {
    "name": "Signature",
    "in": "header",
    "required": true,
    "description": "Lowercase hex HMAC-SHA256 of the raw request body, keyed with the webhook's signing secret (`whsec_…`). Recompute it over the exact bytes received and compare with a constant-time function before trusting the payload. No timestamp or event-id header is sent.",
    "schema": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "example": "5f1c0d8f9a7e4b2c6d3e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1b0c"
  },
  "#/components/schemas/Invoice": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "business_id": {
        "type": "string",
        "format": "uuid"
      },
      "invoice_type": {
        "$ref": "#/components/schemas/InvoiceType"
      },
      "series": {
        "type": "string"
      },
      "invoice_number": {
        "type": "string",
        "description": "Zero-padded to three digits, e.g. `\"007\"`. Send it back padded or unpadded on update; both are accepted."
      },
      "invoice_date": {
        "type": "string",
        "format": "date",
        "description": "Issue date, `Y-m-d`."
      },
      "pay_until_date": {
        "type": [
          "string",
          "null"
        ],
        "format": "date",
        "description": "Due date, `Y-m-d`."
      },
      "language": {
        "$ref": "#/components/schemas/InvoiceLanguage"
      },
      "subtotal": {
        "type": "number",
        "description": "Sum of the lines excluding VAT."
      },
      "vat": {
        "type": "number"
      },
      "total_incl_vat": {
        "type": "number"
      },
      "currency": {
        "type": "string"
      },
      "payment_status": {
        "$ref": "#/components/schemas/PaymentStatus"
      },
      "notes": {
        "type": [
          "string",
          "null"
        ]
      },
      "share_link": {
        "type": "string",
        "format": "uri",
        "description": "Public link to the invoice; anyone with the link can view it."
      },
      "seller": {
        "type": "object",
        "properties": {
          "business_type": {
            "$ref": "#/components/schemas/BusinessType"
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "individual_activity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "custom_fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          }
        },
        "required": [
          "business_type",
          "first_name",
          "last_name",
          "company_name",
          "company_code",
          "individual_activity_id",
          "vat_code",
          "address",
          "email",
          "phone",
          "custom_fields"
        ]
      },
      "buyer": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "`person` sent on input is returned as `individual`.",
            "enum": [
              "company",
              "individual"
            ]
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "individual_activity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "vat_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "type",
          "first_name",
          "last_name",
          "company_name",
          "company_code",
          "individual_activity_id",
          "vat_code",
          "address",
          "email",
          "phone"
        ]
      },
      "items": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/InvoiceItem"
        }
      },
      "payment_options": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PaymentOption"
        }
      },
      "created_at": {
        "type": "integer",
        "description": "Unix timestamp, seconds."
      },
      "updated_at": {
        "type": "integer",
        "description": "Unix timestamp, seconds."
      }
    },
    "required": [
      "id",
      "business_id",
      "invoice_type",
      "series",
      "invoice_number",
      "invoice_date",
      "pay_until_date",
      "language",
      "subtotal",
      "vat",
      "total_incl_vat",
      "currency",
      "payment_status",
      "notes",
      "share_link",
      "seller",
      "buyer",
      "items",
      "payment_options",
      "created_at",
      "updated_at"
    ],
    "title": "Invoice"
  },
  "#/components/schemas/InvoiceType": {
    "type": "string",
    "description": "The three `*vat_invoice` types require `vat_percentage` on every line and, when `seller` is sent, `seller.vat_code`.\n",
    "enum": [
      "regular_invoice",
      "vat_invoice",
      "preliminary_invoice",
      "preliminary_vat_invoice",
      "credit_invoice",
      "credit_vat_invoice"
    ],
    "title": "InvoiceType"
  },
  "#/components/schemas/InvoiceLanguage": {
    "type": "string",
    "description": "Language of the PDF and the public share page.\n",
    "enum": [
      "en",
      "lt",
      "es",
      "de",
      "fr"
    ],
    "title": "InvoiceLanguage"
  },
  "#/components/schemas/PaymentStatus": {
    "type": "string",
    "enum": [
      "not_paid",
      "paid"
    ],
    "title": "PaymentStatus"
  },
  "#/components/schemas/BusinessType": {
    "type": "string",
    "description": "Every type except `individual_activity` is a company.\n",
    "enum": [
      "small_partnership",
      "individual_activity",
      "private_limited_liability_company",
      "sole_proprietorship",
      "public_institution",
      "association",
      "joint_stock_company"
    ],
    "title": "BusinessType"
  },
  "#/components/schemas/InvoiceItem": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "name": {
        "type": "string"
      },
      "price": {
        "type": "number"
      },
      "vat_percentage": {
        "type": [
          "number",
          "null"
        ]
      },
      "quantity": {
        "type": "number"
      },
      "units": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "name",
      "price",
      "vat_percentage",
      "quantity",
      "units"
    ],
    "title": "InvoiceItem"
  },
  "#/components/schemas/PaymentOption": {
    "type": "object",
    "properties": {
      "type": {
        "$ref": "#/components/schemas/PaymentOptionType"
      },
      "bank_account": {
        "type": [
          "string",
          "null"
        ]
      },
      "bank_name": {
        "type": [
          "string",
          "null"
        ]
      },
      "routing_or_sort_number": {
        "type": [
          "string",
          "null"
        ]
      },
      "swift_bic_code": {
        "type": [
          "string",
          "null"
        ]
      },
      "fields": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/LabelValue"
        }
      }
    },
    "required": [
      "type",
      "fields"
    ],
    "title": "PaymentOption"
  },
  "#/components/schemas/PaymentOptionType": {
    "type": "string",
    "description": "`bank` carries the bank account fields; `other` carries free-form label/value `fields`.\n",
    "enum": [
      "bank",
      "other"
    ],
    "title": "PaymentOptionType"
  },
  "#/components/schemas/LabelValue": {
    "type": "object",
    "properties": {
      "label": {
        "type": "string"
      },
      "value": {
        "type": "string"
      }
    },
    "required": [
      "label",
      "value"
    ],
    "title": "LabelValue"
  }
}
```
