Aller au contenu

Tape un mot pour chercher dans les pages.

↑↓ Choisir↵ OuvrirÉchap Fermer
Ouvrir Portal

Référence des endpoints

Routes GET /invoices, GET /invoices/{id}.

GET /invoices

Lister les factures de l’espace

Montants en centimes de CHF. Une facture émise ne change plus (sauf son statut payé ou annulé).

Demande une clé d’API avec la portée portal:read.

Paramètres de requête

ChampTypeObligatoireDescription
status“draft” | “issued” | “paid” | “cancelled”Non
limitintegerNonPar défaut : 20. min. 1, max. 100.
cursorstringNon

Réponses

CodeDescriptionCorps
200Succèsobjet
400Requête invalideProblem
401Authentification requiseProblem
403Accès refuséProblem
429Trop de requêtesProblem
500Erreur interneProblem

Champs de la réponse 200

ChampTypeDescription
dataobjet[]
data[].idstringIdentifiant Portal.
data[].objectstring
data[].status“draft” | “issued” | “paid” | “cancelled”
data[].numberstring ou null
data[].project_idstringIdentifiant Portal.
data[].client_idstringIdentifiant Portal.
data[].currencystring
data[].subtotalintegermin. -9007199254740991, max. 9007199254740991.
data[].vat_totalintegermin. -9007199254740991, max. 9007199254740991.
data[].totalintegerTotal TTC en centimes. min. -9007199254740991, max. 9007199254740991.
data[].issue_datestring ou nullAAAA-MM-JJ.
data[].due_datestring ou nullAAAA-MM-JJ.
data[].paid_atstring ou null
data[].referencestring ou nullRéférence QR de paiement.
data[].linesobjet[]
data[].lines[].descriptionstring
data[].lines[].quantitynumberQuantité, trois décimales au plus.
data[].lines[].unit_priceintegerPrix unitaire en centimes. min. -9007199254740991, max. 9007199254740991.
data[].lines[].vat_rateintegerTVA en points de base (810 = 8,1 %). min. -9007199254740991, max. 9007199254740991.
data[].created_atstringDate et heure ISO 8601 (UTC).
next_cursorstring ou nullÀ renvoyer en cursor pour la page suivante.
has_moreboolean

Exemple

curl -X GET "https://app.hgdc.ch/portal/api/v1/invoices" \
-H "Authorization: Bearer $HGDC_PORTAL_API_KEY"

Réponse 200 :

{
"data": [
{
"id": "exemple",
"object": "exemple",
"status": "draft",
"number": "exemple",
"project_id": "exemple",
"client_id": "exemple",
"currency": "exemple",
"subtotal": -9007199254740991,
"vat_total": -9007199254740991,
"total": -9007199254740991,
"issue_date": "exemple",
"due_date": "exemple",
"paid_at": "exemple",
"reference": "exemple",
"lines": [
{}
],
"created_at": "exemple"
}
],
"next_cursor": "exemple",
"has_more": true
}

GET /invoices/{id}

Lire une facture

Demande une clé d’API avec la portée portal:read.

Paramètres de chemin

ChampTypeObligatoireDescription
idstringOui

Réponses

CodeDescriptionCorps
200Succèsobjet
400Requête invalideProblem
401Authentification requiseProblem
403Accès refuséProblem
404Ressource introuvableProblem
429Trop de requêtesProblem
500Erreur interneProblem

Champs de la réponse 200

ChampTypeDescription
idstringIdentifiant Portal.
objectstring
status“draft” | “issued” | “paid” | “cancelled”
numberstring ou null
project_idstringIdentifiant Portal.
client_idstringIdentifiant Portal.
currencystring
subtotalintegermin. -9007199254740991, max. 9007199254740991.
vat_totalintegermin. -9007199254740991, max. 9007199254740991.
totalintegerTotal TTC en centimes. min. -9007199254740991, max. 9007199254740991.
issue_datestring ou nullAAAA-MM-JJ.
due_datestring ou nullAAAA-MM-JJ.
paid_atstring ou null
referencestring ou nullRéférence QR de paiement.
linesobjet[]
lines[].descriptionstring
lines[].quantitynumberQuantité, trois décimales au plus.
lines[].unit_priceintegerPrix unitaire en centimes. min. -9007199254740991, max. 9007199254740991.
lines[].vat_rateintegerTVA en points de base (810 = 8,1 %). min. -9007199254740991, max. 9007199254740991.
created_atstringDate et heure ISO 8601 (UTC).

Exemple

curl -X GET "https://app.hgdc.ch/portal/api/v1/invoices/<id>" \
-H "Authorization: Bearer $HGDC_PORTAL_API_KEY"

Réponse 200 :

{
"id": "exemple",
"object": "exemple",
"status": "draft",
"number": "exemple",
"project_id": "exemple",
"client_id": "exemple",
"currency": "exemple",
"subtotal": -9007199254740991,
"vat_total": -9007199254740991,
"total": -9007199254740991,
"issue_date": "exemple",
"due_date": "exemple",
"paid_at": "exemple",
"reference": "exemple",
"lines": [
{
"description": "exemple",
"quantity": 1,
"unit_price": -9007199254740991,
"vat_rate": -9007199254740991
}
],
"created_at": "exemple"
}