Drop-in quickstart for every ParlayAPI reference client. Every client implements the same patterns: X-API-Key auth, capped exponential backoff on 429/5xx, Retry-After honoring, per-request X-Request-ID surfacing, and Idempotency-Key support on writes. Each is a single file with minimal dependencies. Pick your language and start.
3.10+ · single file · requests is the only dep (stdlib otherwise).
pip install requests
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/parlay_api_client.py
import os
from parlay_api_client import Client
client = Client(api_key=os.environ["PARLAY_API_KEY"])
odds = client.odds("baseball_mlb", regions="us", markets="h2h,spreads")
print(odds[0])
Node 18+ or any modern browser · zero dependencies · uses native fetch.
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/parlay_api_client.js
import { Client } from "./parlay_api_client.js";
const client = new Client({ apiKey: process.env.PARLAY_API_KEY });
const odds = await client.odds("baseball_mlb",
{ regions: "us", markets: "h2h,spreads" });
console.log(odds[0]);
1.21+ · single .go file · stdlib only (net/http + encoding/json + context).
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/parlay_api_client.go
# drop into your package; no go.mod entries required
package main
import (
"context"
"fmt"
"os"
)
func main() {
c, _ := NewClient(WithAPIKey(os.Getenv("PARLAY_API_KEY")))
odds, err := c.Odds(context.Background(), "baseball_mlb",
map[string]string{"regions": "us", "markets": "h2h,spreads"})
if err != nil { panic(err) }
fmt.Println(odds[0])
}
3.0+ · stdlib only (net/http + json + securerandom).
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/parlay_api_client.rb
require_relative 'parlay_api_client'
client = ParlayAPI::Client.new(api_key: ENV.fetch('PARLAY_API_KEY'))
odds = client.odds('baseball_mlb', regions: 'us', markets: 'h2h,spreads')
puts odds.first
17+ · stdlib only (java.net.http) · no Jackson/Gson.
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/ParlayAPIClient.java
import java.util.Map;
public class Main {
public static void main(String[] args) {
var client = ParlayAPIClient.builder()
.apiKey(System.getenv("PARLAY_API_KEY"))
.build();
String json = client.oddsJson("baseball_mlb",
Map.of("regions", "us", "markets", "h2h,spreads"));
System.out.println(json);
}
}
8.1+ · strict types · curl extension only · no Composer.
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/parlay_api_client.php
<?php
require_once __DIR__ . '/parlay_api_client.php';
$client = new ParlayAPI\Client(apiKey: getenv('PARLAY_API_KEY'));
$odds = $client->odds('baseball_mlb', regions: 'us',
markets: 'h2h,spreads');
print_r($odds[0] ?? $odds);
.NET 6+ · single file · System.Net.Http + System.Text.Json · no NuGet.
curl -O https://raw.githubusercontent.com/JacobiusMakes/ParlayAPI/main/examples/ParlayApiClient.cs
using ParlayApi;
using var client = ParlayApiClient.Builder()
.ApiKey(Environment.GetEnvironmentVariable("PARLAY_API_KEY"))
.Build();
string json = await client.OddsJsonAsync("baseball_mlb",
new Dictionary<string, string> {
["regions"] = "us", ["markets"] = "h2h,spreads"
});
Console.WriteLine(json);
1.75+ · async via tokio · reqwest + serde_json + thiserror + uuid.
# Cargo.toml
[dependencies]
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "time"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
uuid = { version = "1", features = ["v4"] }
thiserror = "1"
url = "2"
use parlay_api::Client;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::builder()
.api_key(std::env::var("PARLAY_API_KEY")?)
.build()?;
let odds = client.odds_json(
"baseball_mlb",
&[("regions", "us"), ("markets", "h2h,spreads")]
).await?;
println!("{}", odds);
Ok(())
}
Every client surfaces the same structured error: status (HTTP code), code (machine-readable string), message, request_id (X-Request-ID header value, include this when filing support issues), and docs_url (link to the relevant docs section). 429 responses are retried automatically with Retry-After. 502/503/504 use capped exponential backoff. 4xx other than 429 throw immediately with no retry.
Generate a client in any language directly from the OpenAPI spec:
openapi-generator-cli generate \
-i https://parlay-api.com/openapi.json \
-g $LANGUAGE -o ./parlay-api-$LANGUAGE
Or open an issue at github.com/JacobiusMakes/ParlayAPI/issues and we'll add it.