New JuneDevelopers
Core concepts

Rate limits

Three limits, the headers that report them, and how to back off on 429.

View .md

The three limits

LimitDefaultApplies toOver the limit
Per key60 requests per minute (sliding window)Each key on its own429 rate_limit_exceeded
Per account1,000 requests per UTC day, all keys togetherYour account429 daily_limit_exceeded
Failed authentication20 per minute per IP addressRequests with a missing or invalid key429 too_many_failed_attempts

The daily count resets at midnight UTC. Limits can differ per key or account; GET /v1/me returns the ones that apply to your key in limits.requests_per_minute and limits.requests_per_day. Every request counts, including requests that end in an error.

Headers

Successful authenticated responses report the per-key budget:

HeaderMeaning
RateLimit-LimitRequests allowed per minute for this key.
RateLimit-RemainingRequests left in the current window.
RateLimit-ResetSeconds until the window frees up.

A 429 carries the same three headers for the limit it hit, plus Retry-After: the number of seconds to wait before trying again. For daily_limit_exceeded, that is the time until midnight UTC.

HTTP/1.1 429 Too Many Requests
RateLimit-Limit: 60
RateLimit-Remaining: 0
RateLimit-Reset: 17
Retry-After: 17

Handle 429

Wait for Retry-After, then retry the same request. If the header is missing, back off exponentially. Stop after a few attempts instead of retrying forever.

# curl retries 429 and most 5xx responses on its own and honors Retry-After.
curl --retry 5 --retry-max-time 120 "https://data.newjune.co/v1/rounds?limit=100" \
  -H "Authorization: Bearer $NEW_JUNE_API_KEY"
// Node 20+. Retries 429 and 5xx; waits for Retry-After when present.
async function getWithRetry(url: string, attempts = 5): Promise<unknown> {
  for (let attempt = 0; ; attempt += 1) {
    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` },
    });
    const retryable = response.status === 429 || response.status >= 500;
    if (!retryable || attempt === attempts - 1) {
      if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
      return response.json();
    }
    const retryAfter = Number(response.headers.get('Retry-After'));
    const waitSeconds = Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter : 2 ** attempt;
    await new Promise(resolve => setTimeout(resolve, waitSeconds * 1000));
  }
}

console.log(await getWithRetry('https://data.newjune.co/v1/rounds?limit=100'));
import os
import time
import requests

session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}"


def get_with_retry(url, params=None, attempts=5):
    """GET that retries 429 and 5xx, waiting for Retry-After when present."""
    for attempt in range(attempts):
        response = session.get(url, params=params, timeout=30)
        retryable = response.status_code == 429 or response.status_code >= 500
        if not retryable or attempt == attempts - 1:
            response.raise_for_status()
            return response.json()
        retry_after = response.headers.get("Retry-After", "")
        time.sleep(int(retry_after) if retry_after.isdigit() else 2 ** attempt)


print(get_with_retry("https://data.newjune.co/v1/rounds", params={"limit": 100}))

Stay under the limits

  • Use limit=100 for bulk work. It costs the same as a page of 25.
  • Sync incrementally. Fetch only rounds that started since your last run, then refresh recent ones. See Sync to your own database.
  • Pace long walks. A full export of every round's hole scores and shots can take a few hundred requests. Watch RateLimit-Remaining and pause when it gets low.
  • Do not poll faster than you need. Rounds change only while you play and shortly after. Polling every 15 minutes is plenty for most integrations.
  • Fix bad keys first. Failed authentication is limited per IP address, and once it trips, requests from that address are refused for a short time even with a good key.