Evyoo POS API v1

Démarrage rapide

En cinq minutes, vous aurez lu votre premier produit. Il faut seulement deux choses : l'adresse de votre Evyoo POS et vos deux clés.

Ce qu'il vous faut#

  • L'adresse de votre entreprise, par exemple clientA.evyooht.com. Chaque entreprise a la sienne. Ne l'écrivez jamais « en dur » dans votre code : mettez-la dans un réglage.
  • Une clé d'accès (elle commence par evy_ak_) et un code de sécurité (il commence par evy_sk_). Ils sont créés pour votre système par Evyoo ou par l'administrateur de votre entreprise. Le code de sécurité n'est affiché qu'une seule fois : notez-le dans un endroit sûr.
  • Un moyen d'envoyer une requête web : un terminal, ou le logiciel Postman si vous préférez cliquer.

1. Vérifier que l'API répond#

Cet appel est public : il ne demande aucune clé. Il sert à savoir si vous parlez au bon serveur.

bash
curl "https://votre-entreprise.evyooht.com/api/v1/status"
powershell
Invoke-RestMethod -Uri "https://votre-entreprise.evyooht.com/api/v1/status"
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/status");
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/status");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
]);
$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/status",
)
print(response.json())

Vous devez recevoir :

json
{
  "status": "ok",
  "api": "v1",
  "enabled": true,
  "authorization_header_received": false,
  "https": true,
  "time": "2026-03-15T14:30:00+00:00"
}
  • enabled: true : votre entreprise a bien l'API.
  • enabled: false : l'API n'est pas activée pour votre entreprise. Contactez Evyoo.
  • Une erreur de connexion : l'adresse est probablement fausse.

2. Demander un jeton#

Envoyez votre clé d'accès et votre code de sécurité. En échange, vous recevez un jeton.

bash
curl -X POST "https://votre-entreprise.evyooht.com/api/v1/auth/token" \
  -d "grant_type=client_credentials" \
  -d "client_id=evy_ak_votre_cle" \
  -d "client_secret=evy_sk_votre_code"
powershell
$body = @{
    grant_type = "client_credentials"
    client_id = "evy_ak_votre_cle"
    client_secret = "evy_sk_votre_code"
}
Invoke-RestMethod -Method Post -Uri "https://votre-entreprise.evyooht.com/api/v1/auth/token" -Body $body
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/auth/token", {
  method: "POST",
  body: new URLSearchParams({
    grant_type: "client_credentials",
    client_id: "evy_ak_votre_cle",
    client_secret: "evy_sk_votre_code",
  }),
});
const data = await response.json();
console.log(data);
php
$ch = curl_init("https://votre-entreprise.evyooht.com/api/v1/auth/token");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => http_build_query([
        "grant_type" => "client_credentials",
        "client_id" => "evy_ak_votre_cle",
        "client_secret" => "evy_sk_votre_code",
    ]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
python
import requests

response = requests.post(
    "https://votre-entreprise.evyooht.com/api/v1/auth/token",
    data={"grant_type": "client_credentials", "client_id": "evy_ak_votre_cle", "client_secret": "evy_sk_votre_code"},
)
print(response.json())

Remplacez evy_ak_votre_cle et evy_sk_votre_code par vos vraies clés. Vous recevez :

json
{
  "access_token": "evy_at_0000000000000000000000000000000000000000000000000000000000000000",
  "token_type": "Bearer",
  "expires_in": 900,
  "scope": "products:read invoices:read"
}
  • access_token : votre jeton. Copiez-le.
  • expires_in : sa durée de vie en secondes. 900 secondes, soit 15 minutes.
  • scope : ce que vous avez le droit de lire. Ici les produits et les factures.

3. Vérifier que votre jeton marche#

Envoyez le jeton dans l'en-tête Authorization, précédé du mot Bearer. Les exemples utilisent evy_at_votre_jeton : remplacez-le par votre jeton.

bash
curl "https://votre-entreprise.evyooht.com/api/v1/ping" \
  -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/ping" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/ping", {
  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/ping");
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/ping",
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Réponse :

json
{
  "ok": true,
  "client": "Boutique en ligne",
  "scopes": ["products:read", "invoices:read"]
}

Si vous recevez une erreur 401, le jeton est faux ou expiré : retournez à l'étape 2.

4. Lire vos produits#

Demandez deux produits :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/products?per_page=2" \
  -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/products?per_page=2" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/products?per_page=2", {
  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/products?per_page=2");
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/products",
    params={"per_page": 2},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Réponse (raccourcie) :

json
{
  "data": [
    {
      "id": 463,
      "code": "PRD-0463",
      "name": "Rouleau papier thermique 57x18m",
      "type": "inventory",
      "status": "active",
      "price": 125.0
    }
  ],
  "meta": { "page": 1, "per_page": 2, "total": 615, "total_pages": 308 }
}

La réponse a toujours la même forme : data contient les éléments, meta dit où vous en êtes (page, total). L'en-tête X-Total-Count donne aussi le total.

Cherchez maintenant par texte :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/products?search=papier&per_page=5" \
  -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/products?search=papier&per_page=5" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/products?search=papier&per_page=5", {
  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/products?search=papier&per_page=5");
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/products",
    params={"search": "papier", "per_page": 5},
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Et lisez un produit par son identifiant (le champ id de la liste) :

bash
curl "https://votre-entreprise.evyooht.com/api/v1/products/463" \
  -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/products/463" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/products/463", {
  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/products/463");
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/products/463",
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

5. Découvrir ce que vous pouvez lire#

bash
curl "https://votre-entreprise.evyooht.com/api/v1/resources" \
  -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/resources" -Headers $headers
javascript
const response = await fetch("https://votre-entreprise.evyooht.com/api/v1/resources", {
  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/resources");
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/resources",
    headers={"Authorization": "Bearer evy_at_votre_jeton"},
)
print(response.json())

Cette réponse décrit, pour votre clé, les ressources que vous pouvez lire, avec leurs champs, leurs filtres et leurs tris. Une ressource pour laquelle vous n'avez pas la permission n'y figure pas.

Et si ça ne marche pas ?#

Vous recevezÇa veut direQue faire
Une erreur de connexionL'adresse est fausseVérifiez l'adresse dans « Votre adresse »
403 https_requiredVous avez écrit http://Écrivez https://
401 invalid_client à l'étape 2Clé d'accès ou code de sécurité incorrectVérifiez-les. Après plusieurs échecs, vous êtes bloqué 15 minutes
401 invalid_tokenJeton absent, faux ou expiréRefaites l'étape 2
403 insufficient_scopeVotre clé n'a pas la permission de cette ressourceDemandez-la à l'administrateur
503 api_not_enabledL'API n'est pas activée pour votre entrepriseContactez Evyoo

Toutes les erreurs sont expliquées sur la page Erreurs.

Et ensuite ?#