eb e-bill

Grundlagen

  • Authentifizierung: Authorization: Bearer eb_… – Schlüssel legt der Inhaber unter Einstellungen → API-Schlüssel an. Scopes: customers, offers, invoices:draft, invoices:issue, send.
  • Idempotenz: Header Idempotency-Key auf allen POST/PUT. Gleicher Key + gleicher Body liefert die gespeicherte Antwort (Header Idempotent-Replayed: true), gleicher Key + anderer Body ergibt 409.
  • Fehler: immer {"error": {"code", "message", "details"}}.
  • Beträge als Dezimal-Strings ("119.00"), Datumswerte ISO 8601.

Beispiel

curl -X PUT https://ebill.phradio.org/api/v1/customers/by-ref/card-4711 \
  -H "Authorization: Bearer $EBILL_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: kunde-4711-v1" \
  -d '{"company_name":"Beispiel GmbH","street":"Hauptstr. 5","zip":"10115","city":"Berlin","email":"rechnung@beispiel.de"}'

curl -X POST https://ebill.phradio.org/api/v1/invoices \
  -H "Authorization: Bearer $EBILL_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: aufladung-2026-12-01-4711" \
  -d '{"customer_ref":"card-4711","action":"issue_and_send","lines":[{"name":"Aufladepaket","unit_price":"42.02","tax_rate":19}]}'

PUT /api/v1/customers/by-ref/{external_ref}

Kunde anlegen oder aktualisieren (Upsert über external_ref)

Parameter

  • external_ref (path, Pflicht)
  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Body: CustomerIn

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content
  • 201 angelegt

GET /api/v1/customers/by-ref/{external_ref}

Kunde über external_ref lesen

Parameter

  • external_ref (path, Pflicht)

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

POST /api/v1/offers

Angebot anlegen (optional sofort senden)

Parameter

  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Body: OfferIn

Antworten

  • 201 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

POST /api/v1/invoices

Rechnung anlegen: action = draft | issue | issue_and_send

Bei `issue` wird die Rechnung nummeriert, als XRechnung/ZUGFeRD erzeugt, validiert und festgeschrieben. Scheitert die Validierung, antwortet die API mit 422 (`validation_failed`); der Entwurf bleibt erhalten (`details.document_id`).

Parameter

  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Body: InvoiceIn

Antworten

  • 201 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

POST /api/v1/documents/{doc_id}/issue

Rechnungsentwurf ausstellen

Parameter

  • doc_id (path, Pflicht)
  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

GET /api/v1/documents/{doc_id}

Beleg lesen

Parameter

  • doc_id (path, Pflicht)

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

POST /api/v1/documents/{doc_id}/send

Beleg per E-Mail versenden

Parameter

  • doc_id (path, Pflicht)
  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Body: SendIn

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

POST /api/v1/documents/{doc_id}/cancel

Rechnung stornieren (erzeugt Stornorechnung, Typ 381, Bezug BT-25)

Parameter

  • doc_id (path, Pflicht)
  • Idempotency-Key (header) – Optional, empfohlen. Gleicher Key + gleicher Body → gespeicherte Antwort (kein zweiter Beleg); gleicher Key + anderer Body → 409.

Body: CancelIn

Antworten

  • 201 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

GET /api/v1/documents/{doc_id}/pdf

PDF herunterladen

Parameter

  • doc_id (path, Pflicht)

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

GET /api/v1/documents/{doc_id}/xml

XRechnung-XML (CII) herunterladen

Parameter

  • doc_id (path, Pflicht)

Antworten

  • 200 Successful Response
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 422 Unprocessable Content

Schemas

CancelIn

FeldTypPflichtBeschreibung
reason string

CustomerIn

FeldTypPflichtBeschreibung
kind string (b2b, b2c) Standard: b2b
company_name string
person_name string
street string
street2 string
zip string
city string
country string Standard: DE
email string
phone string
vat_id string
buyer_reference string BT-10 Käuferreferenz / Leitweg-ID
preferred_format string (zugferd, xrechnung, pdf) Standard: zugferd
notes string

CustomerOut

FeldTypPflichtBeschreibung
id integer ja
number string ja
external_ref string | null ja
kind string ja
company_name string ja
person_name string ja
street string ja
street2 string ja
zip string ja
city string ja
country string ja
email string ja
phone string ja
vat_id string ja
buyer_reference string ja
preferred_format string ja
created boolean Standard: False

DocumentOut

FeldTypPflichtBeschreibung
id integer ja
type string ja
type_code string ja
number string | null ja
status string ja
customer_ref string | null ja
customer_number string ja
issue_date string | null ja
due_date string | null ja
service_date string | null ja
period_start string | null ja
period_end string | null ja
currency string ja
net_total string ja
tax_total string ja
gross_total string ja
output_format string ja
finalized_at string | null ja
sha256 string ja
sent_at string | null ja
paid_at string | null ja
references_number string | null
public_url string | null
lines array ja
links object ja
validation array Standard: []

ErrorBody

FeldTypPflichtBeschreibung
code string ja
message string ja
details null

ErrorOut

FeldTypPflichtBeschreibung
error ErrorBody ja

InvoiceIn

FeldTypPflichtBeschreibung
customer_ref string ja external_ref des Kunden
lines array ja
title string
intro_text string
closing_text string
service_date string | null
period_start string | null
period_end string | null
send_to string | null Abweichende Empfängeradresse für den Versand
action string (draft, issue, issue_and_send) Standard: draft

LineIn

FeldTypPflichtBeschreibung
name string ja
description string
quantity number | string Standard: 1
unit_code string UN/ECE Rec 20, z. B. C62, HUR Standard: C62
unit_price number | string ja Netto-Einzelpreis
tax_rate number | string 19, 7 oder 0 Standard: 19
tax_category string | null Bei 0 %: Z, E, AE, K, G

LineOut

FeldTypPflichtBeschreibung
position integer ja
name string ja
description string ja
quantity string ja
unit_code string ja
unit_price string ja
tax_rate string ja
tax_category string ja
line_net string ja

OfferIn

FeldTypPflichtBeschreibung
customer_ref string ja external_ref des Kunden
lines array ja
title string
intro_text string
closing_text string
service_date string | null
period_start string | null
period_end string | null
send_to string | null Abweichende Empfängeradresse für den Versand
valid_until string | null
action string (draft, send) Standard: draft

SendIn

FeldTypPflichtBeschreibung
to string | null