# common.convert.xrechnung

common.convert.xrechnung: Write an XRechnung 3.0 (EN 16931, UBL) e-invoice from invoice facts; facts a conformant invoice cannot carry are refused with the rule id.

Write an XRechnung 3.0 (EN 16931, UBL) e-invoice from invoice facts; facts a conformant invoice cannot carry are refused with the rule id.

Use `describe("common.convert.xrechnung")` when your code needs the complete live JSON Schemas.

## At a glance

| Property | Value |
| --- | --- |
| Package | `@runstamp/registry` |
| Domain / verb | `common` / `convert` |
| Customer jobs | convert, transform |
| Deterministic | Yes |
| Side effects | none |

## Availability

| Local | SDK | CLI | MCP | Managed API |
| --- | --- | --- | --- | --- |
| unavailable | unavailable | unavailable | unavailable | public ga |

Managed API route: `POST /api/v2/operations/common/convert/xrechnung`. Managed execution requires a free-trial workspace or an active Platform or Enterprise workspace, and an environment-bound API key.

## Input and result

| Schema | Required fields | Optional fields |
| --- | --- | --- |
| Input | `id`, `issueDate`, `currency`, `buyerReference`, `seller`, `buyer`, `payment`, `lines` | `dueDate` |
| Options | none | `to`, `deterministic`, `deterministicSeed`, `timeoutMs`, `locale`, `lossPolicy`, `limits` |
| Result value | `artifact`, `totals`, `notices` | none |

Every success also carries `losses`, `diagnostics`, and a hash-bound `receipt`.

<Accordion title="Defaults, limits, and format constraints">

### Defaults

| Path | Default |
| --- | --- |
| `$.deterministic` | `default=true` |
| `$.lossPolicy` | `default="collect"` |

### Formats and profiles

No separate format selector is declared. Accepted artifacts are bounded by the exact input schema.

### Other limits

| Path | Constraint |
| --- | --- |
| `$.id` | `minLength=1` |
| `$.issueDate` | `pattern="^\\d{4}-\\d{2}-\\d{2}$"` |
| `$.dueDate` | `pattern="^\\d{4}-\\d{2}-\\d{2}$"` |
| `$.currency` | `pattern="^[A-Z]{3}$"` |
| `$.buyerReference` | `minLength=1` |
| `$.seller.name` | `minLength=1` |
| `$.seller.endpoint` | `minLength=1` |
| `$.buyer.name` | `minLength=1` |
| `$.buyer.endpoint` | `minLength=1` |
| `$.lines` | `minItems=1` |
| `$.timeoutMs` | `minimum=1` |

</Accordion>

## Invoke

<CodeGroup>

```ts TypeScript docs-verify=skip docs-verify-reason="Generated example uses the published, hash-verified operation input."
const input = await fetch("https://runstamp.com/demo-evidence/operation-evidence/common/common.convert.xrechnung/input.json").then((response) => response.json());
const result = await runstamp.run("common.convert.xrechnung", input);
if (!result.ok) throw new Error(`${result.error.code}: ${result.error.remediation}`);
console.log(result.value, result.losses, result.diagnostics, result.receipt);
```

```bash CLI
curl -fsS https://runstamp.com/demo-evidence/operation-evidence/common/common.convert.xrechnung/input.json -o input.json
npx -p @runstamp/sdk runstamp ops invoke common.convert.xrechnung --input input.json
```

```json MCP
{
  "tool": "runstamp_invoke_operation",
  "arguments": {
    "operation": "common.convert.xrechnung",
    "input": "<JSON from https://runstamp.com/demo-evidence/operation-evidence/common/common.convert.xrechnung/input.json>",
    "execution_mode": "local"
  }
}
```

</CodeGroup>

## Errors and losses

<Accordion title="Declared errors (6)">

- `common/SCHEMA_REJECTED`
- `common/CONTRACT_VIOLATION`
- `common/OPERATION_CANCELLED`
- `common/OPERATION_TIMEOUT`
- `common/RESOURCE_LIMIT_EXCEEDED`
- `common/INPUT_CORRUPT`

</Accordion>

<Accordion title="Declared losses (0)">

- None.

</Accordion>

SDK `AbortSignal`, CLI exit 130, and MCP cancellation return the typed `common/OPERATION_CANCELLED` failure envelope.

## Verified example and exact contract

- Fixture: `icp-workflow` (Invoice RE-2026-0001: one software licence, 19 percent VAT, German public buyer (Leitweg-ID)).
- [Example input](/demo-evidence/operation-evidence/common/common.convert.xrechnung/input.json) — SHA-256 `99c4b0f43e81a4b48142a0f0df223e2e4603cbfa36915f237488b470f464a3a6`.
- [Example result](/demo-evidence/operation-evidence/common/common.convert.xrechnung/result.json) — SHA-256 `767eca3bee8f1f27d62edca9ce35a40c5c3c6c0db20513bb32873990df30ae28`.
- Verified result SHA-256: `d84d35d896f7df812aa3d5893dc14ba6de3300ca29563efcc9e8d7f8b6ba4f57`.
- Qualification lane: `10-pptx-docx`.

<Accordion title="Contract fingerprints">

- Descriptor: `1e9794a611e5b9e93d8c87db06ddf1eb82208375afb4b66a98f1f997a7ca3503`.
- Input schema: `25e7af6dc99ec471c459828df2857cff722af4b6a1bb681f9de0bcf2f10aa6f9`.
- Options schema: `852d29466282924e059ec0fd9e252d6fe7784efef4c2df8d1e1a254c7807cb78`.
- Result value schema: `14f88d215a0959d357dcc867b8271f0a15dc56f13a908d6cc2367f6a2cb7e558`.

</Accordion>

The [machine-readable operation reference](/operation-reference.json) publishes the complete schemas, qualification results, and evidence bindings for every operation.
