Skip to Content
Referencia de la APICuotas por lotes

Cuotas por Lotes

Obtén cuotas de varios eventos en una sola petición. Esto evita realizar llamadas a la API independientes para cada evento, reduciendo la latencia y el consumo del rate limit.

POST /api/v1/odds/batch

AutenticaciónPermalink for this section

Requiere API key. Disponible en todos los planes.

Cuerpo de la PeticiónPermalink for this section

Envía un cuerpo JSON con los siguientes campos:

CampoTipoObligatorioDescripción
event_idsstring[]Array de IDs de eventos para los que se obtendrán las cuotas
sportsbookstringNoFiltro de un único ID de sportsbook (por defecto, todos los disponibles según tu plan)
marketstringNoFiltro de un único tipo de mercado (por defecto, todos)

Límites de Lote por PlanPermalink for this section

El número máximo de eventos por petición de lote depende de tu plan:

PlanMáx. Eventos por Lote
Free10
Hobby10
Pro50
Sharp50
Enterprise100

Superar el límite de lote de tu plan devolverá un error 400 validation_error. Divide las peticiones grandes en varios lotes si es necesario.

Ejemplos de PeticiónPermalink for this section

curl -X POST "https://api.sharpapi.io/api/v1/odds/batch" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "event_ids": ["evt_nba_lal_bos_20260126", "evt_nba_gsw_mia_20260126"], "sportsbook": "draftkings", "market": "moneyline" }'

RespuestaPermalink for this section

Éxito (200)Permalink for this section

{ "success": true, "data": { "events": [ { "event_id": "evt_nba_lal_bos_20260126", "event_name": "Los Angeles Lakers @ Boston Celtics", "sport": "basketball", "league": "nba", "start_time": "2026-01-26T19:30:00Z", "is_live": false, "odds": [ { "sportsbook": "draftkings", "market_type": "moneyline", "selection": "Boston Celtics", "selection_type": "home", "odds_american": -210, "odds_decimal": 1.476, "line": null, "timestamp": "2026-01-26T10:15:00.000Z" }, { "sportsbook": "draftkings", "market_type": "moneyline", "selection": "Los Angeles Lakers", "selection_type": "away", "odds_american": 175, "odds_decimal": 2.75, "line": null, "timestamp": "2026-01-26T10:15:00.000Z" } ] }, { "event_id": "evt_nba_gsw_mia_20260126", "event_name": "Golden State Warriors @ Miami Heat", "sport": "basketball", "league": "nba", "start_time": "2026-01-26T20:00:00Z", "is_live": false, "odds": [ { "sportsbook": "draftkings", "market_type": "moneyline", "selection": "Miami Heat", "selection_type": "home", "odds_american": -130, "odds_decimal": 1.769, "line": null, "timestamp": "2026-01-26T10:15:05.000Z" } ] } ], "missing_events": [] }, "meta": { "requested": 2, "found": 2, "missing": 0, "max_batch": 50, "filters": { "sportsbook": "draftkings", "market": "moneyline" }, "updated_at": "2026-01-26T10:15:05.000Z" } }

Cabeceras de RespuestaPermalink for this section

X-RateLimit-Limit: 300 X-RateLimit-Remaining: 296 X-RateLimit-Reset: 1737853200 X-Data-Delay: 0 X-Request-Id: req_batch_abc123

Respuestas de ErrorPermalink for this section

400 Límite de Lote Superado

{ "error": { "code": "validation_error", "message": "Batch limit exceeded. Your tier (hobby) allows 10 events per batch, but 25 were requested.", "docs": "https://docs.sharpapi.io/en/api-reference/odds-batch" } }

400 Campo de Eventos Faltante

{ "error": { "code": "validation_error", "message": "The 'event_ids' field is required and must be a non-empty array of event IDs.", "docs": "https://docs.sharpapi.io/en/api-reference/odds-batch" } }

401 No Autorizado

{ "error": { "code": "unauthorized", "message": "Invalid or missing API key", "docs": "https://docs.sharpapi.io/en/authentication" } }

Estructura de la RespuestaPermalink for this section

La respuesta del lote anida los eventos y los IDs faltantes bajo data, con los conteos en meta:

Objeto DataPermalink for this section

CampoTipoDescripción
data.eventsEventOdds[]Array de objetos de evento con cuotas anidadas
data.missing_eventsstring[]IDs de eventos que no se encontraron o no tenían cuotas

Objeto MetaPermalink for this section

CampoTipoDescripción
meta.requestedintegerNúmero de IDs de eventos en tu petición
meta.foundintegerNúmero de eventos que tenían datos de cuotas
meta.missingintegerNúmero de eventos no encontrados
meta.max_batchintegerTamaño máximo de lote para tu plan
meta.filtersobjectFiltros aplicados (sportsbook, market)

Si un ID de evento de tu petición no tiene cuotas (por ejemplo, el evento ha terminado o no existe), aparecerá en data.missing_events en lugar de provocar un error. La respuesta seguirá incluyendo las cuotas de todos los eventos válidos.

Esquema de la RespuestaPermalink for this section

Cada elemento del array data.events es un objeto de evento con cuotas anidadas:

Objeto EventPermalink for this section

CampoTipoDescripción
event_idstringIdentificador del evento
event_namestringNombre legible del evento
sportstringSlug del deporte
leaguestringSlug de la liga
start_timestringHora de inicio del evento en ISO 8601
is_livebooleanSi el evento está en directo
game_stateobject | undefinedEstado del juego en directo (solo para eventos en directo con marcador)
oddsarrayArray de cuotas para este evento

Objeto Odds (anidado en el evento)Permalink for this section

CampoTipoDescripción
sportsbookstringID del sportsbook
market_typestringTipo de mercado
selectionstringNombre de la selección
selection_typestringhome, away, over, under
odds_americannumberCuotas americanas
odds_decimalnumberCuotas decimales
linenumber | nullValor de la línea
timestampstringHora ISO 8601 en que SharpAPI refrescó por última vez esta cuota a través de su pipeline — avanza en cada ciclo de ingesta. Es una señal de frescura del feed / actividad (igual que el timestamp de OpticOdds); NO es cuándo cambió el precio por última vez. Consulta Entendiendo el campo timestamp.

Casos de UsoPermalink for this section

Carga de Cuotas Pre-partidoPermalink for this section

Carga las cuotas de toda la jornada del día en una sola llamada en lugar de hacer decenas de peticiones individuales:

# Get all NBA event IDs from the events endpoint events_response = requests.get( 'https://api.sharpapi.io/api/v1/events', params={'league': 'nba', 'limit': 50}, headers={'X-API-Key': 'YOUR_API_KEY'} ) event_ids = [e['id'] for e in events_response.json()['data']] # Batch fetch all odds at once odds_response = requests.post( 'https://api.sharpapi.io/api/v1/odds/batch', headers={'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json'}, json={'event_ids': event_ids} )

Refresco del DashboardPermalink for this section

Refresca periódicamente las cuotas de los eventos que un usuario está siguiendo:

async function refreshWatchlist(eventIds) { const response = await fetch('https://api.sharpapi.io/api/v1/odds/batch', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ event_ids: eventIds }) }); const { data, meta } = await response.json(); if (data.missing_events.length > 0) { console.warn('Missing events:', data.missing_events); } return data.events; }

Endpoints RelacionadosPermalink for this section

  • Snapshot de Cuotas - Obtén cuotas con filtros de consulta flexibles
  • Mejores Cuotas - Obtén las mejores cuotas entre books por selección
  • Eventos - Lista los eventos para obtener los IDs de evento para peticiones por lotes
Last updated on