On the wire · 04:47:23 UTC Live 550 · Prematch 14,364 · Markets 57,016 Vol. I · No. 5 · Friday 13 November 2026 wss://pinnfeed.io/v1/stream
PinnFeed
Risposta · Frontend · Sicurezza

Quote Pinnacle in JavaScript nel browser

Aggiornato il · PinnFeed · 1 min di lettura

Risposta: le risposte REST /v1/* includono Access-Control-Allow-Origin: *, quindi fetch() da una pagina non dà errore CORS. Il problema è la chiave: tutto il front è visibile. Per siti pubblici chiama PinnFeed da un piccolo server (o serverless) che tiene PINNFEED_KEY e restituisce solo il necessario. I browser non possono impostare header su un WebSocket; un socket nel browser servirebbe ?key= nell'URL ed esporrebbe la chiave allo stesso modo.

Ok per un test privato#

<script>
fetch('https://pinnfeed.io/v1/odds?sport=tennis&market=moneyline&main=true&limit=5', {
  headers: { 'x-api-key': 'ps_live_your_key' }   // visible to anyone who opens this page
}).then(r => r.json()).then(d => console.log(d.events));
</script>

Sito pubblico: pattern proxy#

// server.js (Node 18+), run with PINNFEED_KEY in the environment
import http from 'node:http';
http.createServer(async (req, res) => {
  if (!req.url.startsWith('/odds')) { res.writeHead(404).end(); return; }
  const r = await fetch('https://pinnfeed.io/v1/odds?sport=tennis&market=moneyline&main=true&limit=20', {
    headers: { 'x-api-key': process.env.PINNFEED_KEY },
  });
  res.writeHead(r.status, { 'content-type': 'application/json', 'cache-control': 'max-age=5' });
  res.end(await r.text());
}).listen(3000);

Una cache breve evita che tanti visitatori consumino il rate limit (Free 1 req/s, Hobby 2, Builder 10, Pro 30). Proxy pronti: FastAPI, Cloudflare Worker, Supabase Edge.

Aggiornamenti live nella pagina#

Tieni il WebSocket sul server (Builder) e inoltra solo i cambiamenti al browser con il tuo WS o SSE. Reconnect Node.

CTA#

Builder (99 €/mese). Prova 3 giorni; carta richiesta. REST gratis: signup. Chiave esposta? Ruotala.

Domande frequenti#

Posso limitare una chiave al mio dominio?#

Nessuna restrizione per dominio — per questo il proxy è il pattern sicuro.

Il WebSocket invia header CORS?#

CORS non si applica ai WebSocket; il problema è la chiave nell'URL dal browser.

Contenuto educativo per adulti?#

Sì (18+).

Contenuto educativo per maggiorenni (18+): non pronostici né promesse di guadagno. In Italia scommetti solo con operatori autorizzati ADM.

Il piano WebSocket: Builder, 99 €/mese.

Quote Pinnacle in tempo reale su un unico WebSocket: tutti i 13 sport, tutti i mercati, quote eque senza margine e quote di chiusura. 3 giorni gratis, disdici con un clic.

Form K-1 · Free API key

Get your free API key.

One field. No password, no card: enter your email, click the link we send, and your key is on screen.

By continuing you agree to the Terms and Privacy Policy.

One free key per email. Link valid for 20 minutes.