> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lastaccountingcompany.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Invoice for a partner

> Create and send an invoice where a partner company is the legal seller and payee.

Use a seller profile when your company produces an invoice in a partner's name and for the partner's account. The partner is the legal seller. Payment goes to the partner. The sale does not enter your ledger.

## Before the first invoice

Prepare the partner through REST, MCP, or **Invoicing → Partners**. A company admin must then review and activate it in **Invoicing → Partners**. Activation requires:

* registered legal name, Finnish business ID, and postal address;
* the partner's own IBAN and bookkeeping-copy email;
* signed mandate reference and KYC reference.

A write-scoped REST or MCP credential can create and update the draft. It cannot approve its own evidence, activate the partner, or change an active partner. The same validation and audit rules apply to every route. For example, REST can prepare the draft in one call:

```bash theme={null}
curl https://api.app.lastaccountingcompany.com/portal/seller-profiles \
  -H "Authorization: Bearer $LAC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "legal_name": "<partner_legal_name>",
    "business_id": "<partner_business_id>",
    "street_address": "<partner_street_address>",
    "postal_code": "<partner_postal_code>",
    "city": "<partner_city>",
    "country_code": "FI",
    "iban": "<partner_iban>",
    "contact_email": "<partner_bookkeeping_email>",
    "mandate_evidence_ref": "<signed_mandate_reference>",
    "kyc_evidence_ref": "<identity_check_reference>"
  }'
```

Add or correct draft fields with `PATCH /portal/seller-profiles/{profile_id}`. The company admin then verifies that LAC holds the evidence and selects **Start using this partner** in the portal.

## 1. Get the seller profile

Use a write-scoped key because the result contains bank and evidence references.

```bash theme={null}
curl https://api.app.lastaccountingcompany.com/portal/seller-profiles \
  -H "Authorization: Bearer $LAC_API_KEY"
```

Select a profile whose `status` is `active`. Copy its `id` to the draft's `seller_profile_id`.

## 2. Resolve the buyer's e-invoice route

Search by the buyer's name, Finnish business ID, or FI VAT ID. LAC asks Maventa for the current OVT/e-invoice address and operator; you do not create a receiver record.

```bash theme={null}
curl --get https://api.app.lastaccountingcompany.com/portal/invoice-receivers \
  -H "Authorization: Bearer $LAC_API_KEY" \
  --data-urlencode "query=<buyer_business_id_or_fi_vat_id>"
```

Copy the returned `einvoice_address` and `operator` to the draft's `customer`.

## 3. Create the draft

```bash theme={null}
curl https://api.app.lastaccountingcompany.com/portal/invoices \
  -H "Authorization: Bearer $LAC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "seller_profile_id": "selp_...",
    "delivery_channel": "maventa_einvoice",
    "issue_date": "<YYYY-MM-DD>",
    "terms_days": 14,
    "customer": {
      "name": "<buyer_legal_name>",
      "business_id": "<buyer_business_id>",
      "country_code": "FI",
      "einvoice_address": "<from recipient search>",
      "einvoice_operator": "<from recipient search>"
    },
    "lines": [{
      "description": "Consulting services",
      "quantity": "1",
      "unit_price_cents": 100000,
      "vat_rate_basis_points": 2550,
      "net_cents": 100000,
      "vat_cents": 25500,
      "gross_cents": 125500
    }],
    "net_cents": 100000,
    "vat_cents": 25500,
    "gross_cents": 125500
  }'
```

Set the VAT treatment from the underlying sale. The example rate shows the input shape only.

Read the returned draft with `GET /portal/invoices/{draft_id}`. Confirm `seller_profile_id`, partner legal name, business ID, and IBAN before issue.

### Consumer buyers and PDF delivery

For a consumer, use the customer-directory `id` returned by LAC when updating
an existing buyer. A Business ID and e-invoice route are not required for the
PDF channel.

```json theme={null}
{
  "seller_profile_id": "selp_...",
  "delivery_channel": "pdf_download",
  "customer": {
    "name": "<consumer_name>",
    "email": "<consumer_email>",
    "country_code": "FI"
  }
}
```

Finalize that draft with `POST /portal/invoices/{draft_id}/finalize`. The
response includes `pdf_document_id`, `pdf_sha256`, `pdf_size_bytes`, and
`pdf_available=true`. Download the exact retained bytes from
`GET /portal/invoices/{invoice_id}/pdf`; its `ETag` and `X-Content-SHA256`
headers equal `pdf_sha256`. LAC keeps that immutable PDF as accounting evidence.
You can attach the downloaded PDF to your own email, or host it behind your own
authenticated link and send that link by text message. Finalizing does not send
anything to the consumer.

A consumer e-invoice still requires the consumer to have activated e-invoicing
with their bank and supplied the corresponding receiving route. The PDF flow
does not require that subscription.

## 4. Send

```bash theme={null}
curl -X POST https://api.app.lastaccountingcompany.com/portal/invoices/invd_.../send \
  -H "Authorization: Bearer $LAC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

If invoice approval is required, call `/request-approval` first and wait for a person to approve it in the portal.

The send has these fixed effects:

* the Finvoice seller, postal address, business ID, VAT identity, invoice series, and payment IBAN come from the partner profile;
* the tenant's Maventa address is the technical material-handler route, not the legal seller;
* the partner receives a PDF copy for its own books;
* `posts_ledger=false`: no tenant journal, output VAT, receivable, aging, or overdue item is created.

## MCP

Use `create_seller_profile` and `update_seller_profile` to prepare the draft partner. A company admin activates it in the portal after checking the evidence. Then use `list_seller_profiles`, `search_invoice_receivers`, `create_invoice_draft`, `get_invoice`, and `send_invoice`. MCP uses the same draft and customer fields as REST, but it does not expose the seller-profile status field.

For recovery, use `retry_invoice_send` only after a safe failure. Use `retry_partner_invoice_copy` only after you verified that the partner did not receive an ambiguous earlier copy. LAC refuses ambiguous e-invoice sends until the outcome is checked in Maventa.
