Evyoo POS API v1

Lire des factures et des documents

Les documents de vente et d'achat (quotes, sales-orders, invoices, credit-memos, payments, purchase-orders, receivings, transfers, adjustments) se lisent tous de la même façon. Cette page prend l'exemple des factures.

Les factures d'une période#

date_from et date_to bornent la période. Les deux jours sont inclus, heures comprises.

bash
curl "https://votre-entreprise.evyooht.com/api/v1/invoices?date_from=2026-01-01&date_to=2026-01-31&per_page=50" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/invoices?date_from=2026-01-01&date_to=2026-01-31&per_page=50" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/invoices?date_from=2026-01-01&date_to=2026-01-31&per_page=50", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/invoices?date_from=2026-01-01&date_to=2026-01-31&per_page=50");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/invoices",
    params={"date_from": "2026-01-01", "date_to": "2026-01-31", "per_page": 50},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Chaque facture de la liste porte son en-tête : numéro, date, client, statut, montants. Les lignes et les paiements n'y sont pas, pour que la liste reste légère.

Les factures d'un client#

bash
curl "https://votre-entreprise.evyooht.com/api/v1/invoices?customer_id=58&sort=-date" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/invoices?customer_id=58&sort=-date" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/invoices?customer_id=58&sort=-date", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/invoices?customer_id=58&sort=-date");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/invoices",
    params={"customer_id": 58, "sort": "-date"},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Pour trouver le customer_id d'un client, cherchez-le :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/customers?search=dupont" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/customers?search=dupont" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/customers?search=dupont", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/customers?search=dupont");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/customers",
    params={"search": "dupont"},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Une facture complète#

Lisez-la par son id : la réponse contient en plus ses lignes (lines) et son paiement (payments).

bash
curl "https://votre-entreprise.evyooht.com/api/v1/invoices/4149" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/invoices/4149" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/invoices/4149", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/invoices/4149");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/invoices/4149",
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Réponse (raccourcie) :

json
{
  "data": {
    "id": 4149,
    "number": "I1-4149",
    "date": "2026-03-15T14:30:00",
    "customer_name": "Marie Dupont",
    "status": "regular",
    "currency": "USD",
    "total": 1250.0,
    "lines": [
      {
        "id": 9001,
        "product_id": 463,
        "name": "Rouleau papier thermique 57x18m",
        "quantity": 10.0,
        "unit": "Boîte de 100",
        "unit_price": 125.0
      }
    ],
    "payments": [
      { "date": "2026-03-15T14:30:00", "cash": 1250.0, "card": 0.0, "cheque": 0.0, "account": 0.0 }
    ]
  }
}

Les statuts#

Une facture a un status : new, open, hold, regular ou void. Filtrez avec status :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/invoices?status=regular&date_from=2026-01-01" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/invoices?status=regular&date_from=2026-01-01" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/invoices?status=regular&date_from=2026-01-01", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/invoices?status=regular&date_from=2026-01-01");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/invoices",
    params={"status": "regular", "date_from": "2026-01-01"},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())
StatutCe que ça veut dire
regularFacture définitive.
new, openFacture en cours.
holdBrouillon. Il n'apparaît pas dans la liste, sauf si vous le demandez.
voidAnnulée (voir plus bas).

Les documents annulés#

Un document annulé garde son identité (numéro, date, client), mais tous ses montants sont à zéro : l'en-tête, les lignes et les paiements. Les quantités restent.

C'est voulu : si vous additionnez les totaux d'une liste de factures, vous ne comptez pas deux fois une vente qui a été annulée. Pour retrouver les annulations :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/invoices?status=void&date_from=2026-01-01" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/invoices?status=void&date_from=2026-01-01" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/invoices?status=void&date_from=2026-01-01", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/invoices?status=void&date_from=2026-01-01");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/invoices",
    params={"status": "void", "date_from": "2026-01-01"},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Les totaux : celui du document fait foi#

Une ligne donne des faits : la quantité, l'unité, le prix. L'API ne calcule pas de « total de ligne » : un même article peut se vendre dans plusieurs unités (à l'unité, à la caisse de 50), et le total d'une ligne dépend de l'unité choisie. Le total du document (items_total, total) est la référence. Si vous devez recalculer, comparez toujours avec lui.

Avoirs et factures#

Les avoirs (credit-memos) sont rangés avec les factures dans Evyoo POS, mais ce sont deux ressources séparées : un avoir ne se lit pas comme une facture, et l'inverse non plus. Une adresse /invoices/212 pour un avoir répond 404.

Les paiements reçus#

Deux choses portent le mot « paiement » :

  • le paiement d'une facture au comptoir : il est dans la facture (payments du détail) ;
  • les paiements reçus plus tard des clients, sur leur compte : c'est la ressource payments, dont le détail liste les factures auxquelles chaque paiement a été appliqué (applied_to).
bash
curl "https://votre-entreprise.evyooht.com/api/v1/payments?customer_id=58&date_from=2026-01-01" \
  -H "Authorization: Bearer evy_at_votre_jeton"
powershell
$headers = @{ Authorization = "Bearer evy_at_votre_jeton" }
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/payments?customer_id=58&date_from=2026-01-01" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/payments?customer_id=58&date_from=2026-01-01", {
  headers: { Authorization: "Bearer evy_at_votre_jeton" },
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/payments?customer_id=58&date_from=2026-01-01");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer evy_at_votre_jeton"],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.get(
    "https://votre-entreprise.evyooht.com/api/v1/payments",
    params={"customer_id": 58, "date_from": "2026-01-01"},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Les coûts#

Le coût de revient d'une facture (cost_total) et celui de chaque ligne (cost) n'existent dans la réponse que si votre clé a la permission costs:read. Sans elle, ces champs sont absents. Voir les notions.