Crea tu llave
Entra al panel, crea tu cuenta y copia tu llave sk_…. Se ve una sola vez: guárdala como secreto en tu servidor (nunca en el navegador de tus clientes).
En los ejemplos va en la variable de entorno SHALOM_API_KEY. Para probarla:
curl "https://shalom.smartflow.pe/v1/yo" \
-H "x-api-key: $SHALOM_API_KEY"
const r = await fetch("https://shalom.smartflow.pe/v1/yo", {
method: "GET",
headers: { "x-api-key": process.env.SHALOM_API_KEY },
});
const { ok, data, codigo_error, error } = await r.json();
if (!ok) throw new Error(`${codigo_error}: ${error}`);
console.log(data);
<?php
$ch = curl_init('https://shalom.smartflow.pe/v1/yo');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['x-api-key: ' . getenv('SHALOM_API_KEY')],
]);
$r = json_decode(curl_exec($ch), true);
if (!$r['ok']) throw new Exception($r['codigo_error'] . ': ' . $r['error']);
print_r($r['data']);
import os, requests
r = requests.get(
"https://shalom.smartflow.pe/v1/yo",
headers={"x-api-key": os.environ["SHALOM_API_KEY"]},
timeout=60,
).json()
if not r["ok"]:
raise RuntimeError(f"{r['codigo_error']}: {r['error']}")
print(r["data"])