# Introduction Source: https://developers.newjune.co/introduction > What the New June Data API gives you, what it does not, and where to start. New June collects and analyzes the context of your game during a round, then turns it into a post-round report, priorities, and practice plans. The Data API gives you that same data as JSON, so you can use it in your own spreadsheets, dashboards, databases, and scripts. - Base URL: `https://data.newjune.co/v1` - Auth header: `Authorization: Bearer $NEW_JUNE_API_KEY` - Methods: GET only (read-only) - Format: JSON, snake_case fields, explicit nulls, ISO 8601 UTC timestamps - OpenAPI 3.1 document: https://developers.newjune.co/openapi.json ## What you can build - **A personal archive.** Export every round, hole score, and shot to CSV or your own database, and keep it in sync. - **Your own stats.** Chart score to par by month, fairways and greens in regulation, or putts per round. - **Club distances.** Compute carry and total distance by club from your shots, and compare them with the typical distances in your bag. - **Practice tracking.** Show how each plan is going across rounds, using the evaluation New June makes of every active plan after every round. - **Agents and automations.** Give a coding agent or a scheduled job a key with only the scopes it needs. ## What the API gives you | Area | Resources | Scope | | --- | --- | --- | | Rounds | [rounds](https://developers.newjune.co/api-reference/rounds), [hole_scores](https://developers.newjune.co/api-reference/hole-scores), [shots](https://developers.newjune.co/api-reference/shots) | `rounds:read` | | Analysis | [reports](https://developers.newjune.co/api-reference/reports) | `reports:read` | | Practice | [priorities](https://developers.newjune.co/api-reference/priorities), [plans](https://developers.newjune.co/api-reference/plans), [evaluations](https://developers.newjune.co/api-reference/evaluations), [focus_sets](https://developers.newjune.co/api-reference/focus-sets) | `plans:read` | | Bag | [clubs](https://developers.newjune.co/api-reference/clubs) | `clubs:read` | | Key | [me](https://developers.newjune.co/api-reference/me) | any key | ## What it does not do - **It is read-only.** Every endpoint is a `GET`. You cannot create, change, or delete anything through the API. - **It returns your data only.** A key belongs to one New June account and can only see that account's data. There is no way to request another player's data, and an id from another account returns `404`. - **It is for servers and scripts.** The API sends no CORS headers, so a web page cannot call it from the browser. Call it from your own backend, a script, a notebook, or a scheduled job, and keep the key there. - **It does not include everything in the app.** Audio, transcripts, chat history, and course maps are not available. Test rounds are left out of every resource. - **There are no webhooks yet.** To pick up new rounds, poll on a schedule. See [Sync to your own database](https://developers.newjune.co/guides/incremental-sync). > **Preview.** Version 1 is in preview. The contract is stable: changes to v1 are additive only. See [Versioning](https://developers.newjune.co/versioning). ## Where to start - [Quickstart](https://developers.newjune.co/quickstart): Create a key and make your first request in under two minutes. - [Data model](https://developers.newjune.co/data-model): How rounds, reports, priorities, plans, and evaluations connect. - [Guides](https://developers.newjune.co/guides/export-rounds-to-csv): Complete scripts for common jobs. - [API reference](https://developers.newjune.co/api-reference): Every endpoint, parameter, and field. --- # Quickstart Source: https://developers.newjune.co/quickstart > Create a key, confirm it works, list your rounds, and fetch the next page. About two minutes. You need a New June account with at least one round, and a terminal. The TypeScript samples run on Node 20 or later with the built-in `fetch`. Save them as `.mts` files and run them with `npx tsx file.mts`, so top-level `await` works. The Python samples need `requests` (`pip install requests`). ### Create a key Open the [Developer page](https://newjune.co/golf/developer) in the New June web portal, sign in, and create a key. Give it a name you will recognize later, and pick the scopes it needs. For this quickstart, `rounds:read` is enough. The key starts with `nj_live_` and is shown once. Copy it now and keep it in an environment variable, not in your code: ```bash export NEW_JUNE_API_KEY="nj_live_..." ``` ### Check the key `GET /v1/me` works with any valid key and returns no golf data. A `200` means the key is good. curl: ```bash curl https://data.newjune.co/v1/me \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/me', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); console.log(response.status, await response.json()); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/me", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.status_code, response.json()) ``` ```json title="200 OK" { "object": "api_key_context", "key": { "object": "api_key", "id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d", "name": "Spreadsheet sync", "prefix": "nj_live_3f9a", "scopes": ["rounds:read"], "expires_at": null }, "limits": { "requests_per_minute": 60, "requests_per_day": 1000 } } ``` A `401` means the key is missing, mistyped, revoked, or expired. The response's `error.code` says which. See [Authentication](https://developers.newjune.co/authentication). ### List your rounds `GET /v1/rounds` returns your rounds, newest first. `limit` sets the page size (1 to 100, default 25). curl: ```bash curl "https://data.newjune.co/v1/rounds?limit=2" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/rounds?limit=2', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const page = await response.json(); for (const round of page.data) { console.log(round.started_at, round.course?.name, round.total_strokes, round.score_to_par); } console.log('next_cursor:', page.next_cursor); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/rounds", params={"limit": 2}, headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) page = response.json() for round_ in page["data"]: course = round_["course"]["name"] if round_["course"] else None print(round_["started_at"], course, round_["total_strokes"], round_["score_to_par"]) print("next_cursor:", page["next_cursor"]) ``` Every list has the same envelope: ```json title="200 OK (shortened)" { "object": "list", "data": [ { "object": "round", "id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d", "status": "completed", "started_at": "2026-06-14T15:02:11.000Z", "total_strokes": 87, "score_to_par": 15 }, { "object": "round", "id": "0b5d7c1e-2f3a-4b6c-8d9e-1a2b3c4d5e6f", "status": "completed", "started_at": "2026-06-07T16:40:03.000Z", "total_strokes": 91, "score_to_par": 19 } ], "has_more": true, "next_cursor": "eyJ2IjoxLCJrIjpbIjIwMjYtMDYtMDdUMTY6NDA6MDMuMDAwMDAwWiIsIjBiNWQ3YzFlLTJmM2EtNGI2Yy04ZDllLTFhMmIzYzRkNWU2ZiJdfQ" } ``` ### Get the next page When `has_more` is true, send `next_cursor` back as `cursor`. Keep every other parameter the same. curl: ```bash curl "https://data.newjune.co/v1/rounds?limit=2&cursor=PASTE_NEXT_CURSOR_HERE" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const url = new URL('https://data.newjune.co/v1/rounds'); url.searchParams.set('limit', '2'); url.searchParams.set('cursor', process.argv[2] ?? ''); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); console.log(await response.json()); ``` Python: ```python import os import sys import requests response = requests.get( "https://data.newjune.co/v1/rounds", params={"limit": 2, "cursor": sys.argv[1]}, headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` On the last page, `has_more` is false and `next_cursor` is null. [Pagination](https://developers.newjune.co/pagination) has a complete loop in each language. ## Next - Learn how the objects connect in the [Data model](https://developers.newjune.co/data-model). - Pull every round into a file with [Export every round to CSV](https://developers.newjune.co/guides/export-rounds-to-csv). - Browse every endpoint in the [API reference](https://developers.newjune.co/api-reference). --- # Authentication Source: https://developers.newjune.co/authentication > Personal API keys, the header they go in, scopes, rotation, expiry, and what 401 and 403 mean. Every request except `GET /v1/openapi.json` needs a personal API key. A key belongs to one New June account and can only see that account's data. ## Create a key Any New June account can create keys on the [Developer page](https://newjune.co/golf/developer) of the web portal. When you create one you choose: - **A name**, 1 to 60 characters, so you can tell keys apart later (for example "Spreadsheet sync"). - **Scopes**, at least one. See [Scopes](#scopes). - **An expiry date**, optional. Without one, the key works until you revoke it. The full key is shown once, right after you create it. New June stores only a hash of it and cannot show it again. If you lose it, revoke it and create a new one. You can have up to **5 active keys** at a time. Revoked and expired keys do not count. ## Send the key Put the key in the `Authorization` header with the `Bearer` scheme: ```http Authorization: Bearer nj_live_3f9a... ``` curl: ```bash curl https://data.newjune.co/v1/me \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/me', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); console.log(await response.json()); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/me", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` The API looks for the key only in this header, never in query strings or cookies. Always use HTTPS. ## Key format A key is `nj_live_` followed by 54 lowercase hexadecimal characters, 62 characters in all. The last 6 characters are a checksum, so the API rejects a mistyped key with `401 invalid_api_key` without looking it up. The first 12 characters (`nj_live_3f9a`) are the key's **prefix**: it appears on the Developer page and in `GET /v1/me` so you can tell keys apart, and it is safe to log. ## Scopes A key can only call endpoints its scopes allow. Give each key the fewest scopes it needs. | Scope | Grants | Endpoints | | --- | --- | --- | | `rounds:read` | Your rounds, hole-by-hole scores, and shots | [rounds](https://developers.newjune.co/api-reference/rounds), [hole_scores](https://developers.newjune.co/api-reference/hole-scores), [shots](https://developers.newjune.co/api-reference/shots) | | `reports:read` | The report New June produces after each round | [reports](https://developers.newjune.co/api-reference/reports) | | `plans:read` | Priorities, practice plans, their evaluations, and focus sets | [priorities](https://developers.newjune.co/api-reference/priorities), [plans](https://developers.newjune.co/api-reference/plans), [evaluations](https://developers.newjune.co/api-reference/evaluations), [focus_sets](https://developers.newjune.co/api-reference/focus-sets) | | `clubs:read` | The clubs in your bag and their typical distances | [clubs](https://developers.newjune.co/api-reference/clubs) | | any key | The key itself, its scopes and limits | [me](https://developers.newjune.co/api-reference/me) | Calling an endpoint without its scope returns `403 insufficient_scope`. Scopes are fixed when the key is created. To change them, create a new key with the scopes you want and revoke the old one. ## 401 or 403 | Status | Meaning | Codes | | --- | --- | --- | | `401` | The API could not identify a usable key. Fix the key before retrying. | [`missing_api_key`](https://developers.newjune.co/errors#missing_api_key), [`invalid_api_key`](https://developers.newjune.co/errors#invalid_api_key), [`api_key_revoked`](https://developers.newjune.co/errors#api_key_revoked), [`api_key_expired`](https://developers.newjune.co/errors#api_key_expired) | | `403` | The key is valid, but it may not do this. | [`insufficient_scope`](https://developers.newjune.co/errors#insufficient_scope), [`account_suspended`](https://developers.newjune.co/errors#account_suspended) | Repeated requests with a missing or invalid key from one IP address are limited. After too many, the API answers `429 too_many_failed_attempts` for a short time, even for valid keys from that address. See [Rate limits](https://developers.newjune.co/rate-limits). ## Rotate a key Rotate without downtime: 1. Create a new key with the same scopes. 2. Deploy it to wherever the old key is used. 3. Call `GET /v1/me` with the new key to confirm it works. 4. Revoke the old key on the Developer page. A revoked key stops working right away and returns `401 api_key_revoked`. Revoking cannot be undone. ## Expiry If you set an expiry date, the key returns `401 api_key_expired` from that moment on. `GET /v1/me` shows the date in `key.expires_at` (null when the key does not expire). Rotate before that date. ## Keep keys safe - **Keep keys on servers.** The API sends no CORS headers, so browsers cannot call it, and a key in front-end code is a key anyone can copy. - **Use environment variables or a secret manager.** Every sample in these docs takes the key from `NEW_JUNE_API_KEY` in the environment. - **Never commit a key.** Add your `.env` file to `.gitignore`. If a key reaches a repository, a log, or a chat, revoke it. - **Use one key per integration**, so you can revoke one without breaking the others. - **Log the prefix, never the key.** --- # Data model Source: https://developers.newjune.co/data-model > How rounds, scores, shots, reports, priorities, plans, evaluations, focus sets, and clubs connect, and which id field links each pair. Your data has two halves. The **round** half is what happened on the course: rounds, the score on each hole, and each shot. The **practice** half is what New June made of it: a report after each round, the priorities those reports point to, a plan for each priority, and an evaluation of each active plan after every round. ## The objects | Object | What it is | Links | | --- | --- | --- | | [round](https://developers.newjune.co/api-reference/rounds) | One round of golf, scheduled, in progress, or finished. Carries totals (`total_strokes`, `par_total`, `score_to_par`), the course, and the tee. | The root. Other objects point to it with `round_id`. | | [hole_score](https://developers.newjune.co/api-reference/hole-scores) | Your score on one hole: strokes, putts, penalties, fairway, green in regulation, par, and yardage. | `round_id` | | [shot](https://developers.newjune.co/api-reference/shots) | One shot: club, lie, what you planned, what happened, and where it started and finished. | `round_id`, plus `hole_number` and `sequence_number` for its place in the round. `club` matches `club.club`. | | [report](https://developers.newjune.co/api-reference/reports) | The analysis of one round: a headline, the written analysis, per-hole notes, and the areas to work on. One per round. | `round_id` | | [priority](https://developers.newjune.co/api-reference/priorities) | A lasting area of your game that reports keep pointing to, such as lag putting. | `first_seen_report_id`, `last_seen_report_id` | | [plan](https://developers.newjune.co/api-reference/plans) | A practice plan for one priority, with ordered **steps** and one graduation **criterion**. | `priority_id`, `created_from_report_id` | | [evaluation](https://developers.newjune.co/api-reference/evaluations) | How one plan went in one round: `open`, `partial`, or `complete`, with a `confidence`. | `plan_id`, `round_id`, `report_id` | | [focus_set](https://developers.newjune.co/api-reference/focus-sets) | The lineup of plans in use for a period: one primary plan and up to two secondary plans. | `primary_plan_id`, `secondary_plan_ids`, `source_report_id` | | [club](https://developers.newjune.co/api-reference/clubs) | A club in your bag, with your typical carry and total distance. | Matched to shots by the `club` value, not by id. | ## How the practice loop works 1. You play a **round**. Hole scores and shots are recorded against it. 2. After the round, New June produces a **report**. Its `priorities` list names the areas to work on, most important first. 3. Areas that keep coming up become durable **priorities**. `first_seen_report_id` and `last_seen_report_id` show when a priority first appeared and when a report last raised it. 4. A priority gets a **plan**: practice **steps** (milestones such as a drill) and one **criterion** (what counts as done, measured from your rounds). 5. After every later round, New June writes an **evaluation** for each active plan. `status` says how far the plan got in that round: `open` (not met yet), `partial`, or `complete`. 6. The **focus set** names the plans you are working on right now. `GET /v1/focus_sets/current` returns it. > **Steps never graduate a plan.** Marking every step done does not finish a plan. Only the criterion does: a plan becomes `graduated` when your rounds meet its criterion, as recorded in its evaluations. Steps are milestones on the way. ## Finding related objects Relationships are query filters, never nested paths. To go from one object to its related objects, filter the related collection by the id: | You have | You want | Request | | --- | --- | --- | | A round | Its hole scores | `GET /v1/hole_scores?round_id=` | | A round | Its shots, in playing order | `GET /v1/shots?round_id=` | | A round | Its report | `GET /v1/reports?round_id=` | | A round | The evaluations made after it | `GET /v1/evaluations?round_id=` | | A priority | Its plans | `GET /v1/plans?priority_id=` | | A plan | Its evaluations, newest first | `GET /v1/evaluations?plan_id=` | | A plan | Its priority | `GET /v1/priorities/` | | A focus set | Its plans | `GET /v1/plans/` for `primary_plan_id` and each of `secondary_plan_ids` | There is no `expand` parameter. Fetch related objects with a second request, and cache what you can: priorities, plans, and clubs change far less often than rounds. ## Ids Every object has an `id` (a UUID) and an `object` field naming its type. Ids are stable: an object keeps its id for its whole life. A field that names another object ends in `_id` and holds that object's `id`. The round's id is always called `round_id`. --- # Conventions Source: https://developers.newjune.co/conventions > The rules every response keeps, so you can write one client for every resource. ## JSON shape - **snake_case everywhere.** Field names, enum values, and query parameters: `started_at`, `in_progress`, `round_id`. - **Every field is always present.** A value that is missing or unknown is `null`, never left out. You can rely on `"putts" in hole_score` and check for `null`. - **Flat objects.** Small value groups are nested (a shot's `start`, `end`, `lie`, `planned`, `result`; a round's `course` and `tee`), but other resources are never embedded. They are linked by `_id` fields. - **`object` names the type.** Every object has `"object": "round"`, `"object": "shot"`, and so on. Lists have `"object": "list"`. ## Ids Ids are UUIDs, stable for the life of the object. A reference to another object is `_id`. The round id is always `round_id`. An id that does not exist and an id that belongs to another account both return `404 resource_not_found`. See [Data model](https://developers.newjune.co/data-model#ids). ## Timestamps Timestamps are ISO 8601 in UTC with a `Z`, for example `2026-06-14T15:02:11.000Z`. A round also has `timezone`, the IANA zone where it was played (for example `America/Los_Angeles`), when known. Use it to show local tee times or to group rounds by local date. Timestamp query parameters such as `started_after` must include `Z` or an offset: `2026-06-01T00:00:00Z` or `2026-06-01T00:00:00-07:00`. A timestamp without one is `400 invalid_query_parameter`. ## Units Units are part of the field name, so you never have to guess: | Suffix | Unit | Examples | | --- | --- | --- | | `_yards` | yards | `yardage_yards`, `typical_carry_yards`, `result.distance_yards` | | `_meters` | meters | `start.altitude_meters` | | `_degrees` | degrees | `loft_degrees`, `rotation_degrees` | | `latitude`, `longitude` | decimal degrees, WGS 84 | `start.latitude`, `planned.target_longitude` | Counts (`strokes`, `putts`, `penalty_strokes`) are whole numbers. ## Enums and free text Fields with a fixed set of values are documented as enums and use lowercase snake_case, such as `status` (`scheduled`, `in_progress`, `paused`, `completed`, `cancelled`). New values may be added to an enum in v1 (see [Versioning](https://developers.newjune.co/versioning)), so treat unknown values gracefully. Some shot descriptors are **free text**, not enums: `lie.type`, `lie.quality`, `planned.shot_type`, `planned.curve`, `planned.trajectory`, `result.contact`, `result.curve`, `result.trajectory`, `result.quality`, and `penalty_type`. They come from how a shot was described, so the same idea can appear in different words (`"fairway"`, `"short grass"`). They are trimmed, and an empty value is `null`. Normalize them yourself if you group by them. `club` (on shots and clubs), a club's `type`, and an evaluation's `confidence` map known values to a fixed list and return `null` for anything else. ## Scores and par `hole_score.par` and `yardage_yards` come from the scorecard of the round when it has one, otherwise from the course data for the tee you played. On a round, `par_total` covers only the holes scored so far, and is `null` when any of them has no known par. `score_to_par` is `total_strokes - par_total`, and `null` when either is null. ## What is left out - **Test rounds** are excluded from rounds, hole scores, shots, and reports. - A **report** is the newest analysis of its round. If a round was analyzed more than once, older versions are not available. - **Casual rounds** (`play_mode: "casual"`) are played for fun and are not analyzed, so they have no report or evaluations. ## Query strings are strict Each endpoint accepts only the parameters in its reference. An unknown or misspelled parameter is `400 unknown_query_parameter`, never silently ignored, so a typo cannot return the wrong data. A parameter given twice is `400 invalid_query_parameter`. ## Headers | Header | On | Meaning | | --- | --- | --- | | `Request-Id` | every response | The request's id, `req_` plus 24 hex characters. Same as `error.request_id`. | | `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` | authenticated responses | Your per-minute budget. See [Rate limits](https://developers.newjune.co/rate-limits). | | `Retry-After` | `429` | Seconds to wait before retrying. | | `Cache-Control: private, no-store` | data responses | Do not cache responses in shared caches. | --- # Pagination Source: https://developers.newjune.co/pagination > Every list uses the same envelope and an opaque cursor. Here is a complete loop in each language. Every `GET /v1/` returns a page: ```json { "object": "list", "data": [{ "object": "round", "id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d" }], "has_more": true, "next_cursor": "eyJ2IjoxLCJrIjpbIjIwMjYtMDYtMDdUMTY6NDA6MDMuMDAwMDAwWiIsIjBiNWQ3YzFlLTJmM2EtNGI2Yy04ZDllLTFhMmIzYzRkNWU2ZiJdfQ" } ``` | Field | Meaning | | --- | --- | | `data` | The items on this page, in the list's order. | | `has_more` | True when more items come after this page. | | `next_cursor` | Pass it as `cursor` to get the next page. Null on the last page. | | Parameter | Meaning | | --- | --- | | `limit` | Items per page, 1 to 100. Default 25. | | `cursor` | The `next_cursor` from the previous page. Leave it out for the first page. | ## How cursors work Each list has a fixed order that ends with `id`, for example rounds by `started_at` then `id`, newest first. A cursor marks the position after the last item on a page, so: - **Pages never overlap or skip**, even when new rounds arrive while you page. - **Items added before the cursor's position do not appear** in later pages. Start a new walk to pick them up. - **Keep the same filters and order** for every page of a walk. Change a filter and you start a new walk. - **Cursors are opaque.** Do not parse or build them. A cursor that has been changed is `400 invalid_cursor`. Every list's order is in its reference page and in the OpenAPI description of the list operation. ## A complete loop Each sample fetches every round, 100 at a time, and prints how many it found. curl: ```bash #!/usr/bin/env bash # Needs curl and jq. set -euo pipefail cursor="" count=0 while :; do url="https://data.newjune.co/v1/rounds?limit=100" if [ -n "$cursor" ]; then url="$url&cursor=$cursor"; fi page=$(curl -sf "$url" -H "Authorization: Bearer $NEW_JUNE_API_KEY") count=$((count + $(echo "$page" | jq '.data | length'))) if [ "$(echo "$page" | jq -r '.has_more')" != "true" ]; then break; fi cursor=$(echo "$page" | jq -r '.next_cursor') done echo "Found $count rounds" ``` TypeScript: ```ts // Node 20+. Run with: npx tsx list-all-rounds.mts interface ListPage { object: 'list'; data: T[]; has_more: boolean; next_cursor: string | null; } async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as ListPage; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } let count = 0; for await (const _round of listAll('rounds')) count += 1; console.log(`Found ${count} rounds`); ``` Python: ```python import os import requests API = "https://data.newjune.co/v1" session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] count = sum(1 for _ in list_all("rounds")) print(f"Found {count} rounds") ``` The `listAll` and `list_all` helpers work for every collection. Pass filters as the second argument, for example `listAll('hole_scores', { round_id })` or `list_all("shots", round_id=round_id)`. The [guides](https://developers.newjune.co/guides/export-rounds-to-csv) reuse them. > **Large walks and rate limits.** At 100 items per page, 1,000 rounds take 10 requests. A full export with every round's hole scores and shots makes more requests than that: see [Rate limits](https://developers.newjune.co/rate-limits) for how to pace a long walk. --- # Rate limits Source: https://developers.newjune.co/rate-limits > Three limits, the headers that report them, and how to back off on 429. ## The three limits | Limit | Default | Applies to | Over the limit | | --- | --- | --- | --- | | Per key | 60 requests per minute (sliding window) | Each key on its own | `429` [`rate_limit_exceeded`](https://developers.newjune.co/errors#rate_limit_exceeded) | | Per account | 1,000 requests per UTC day, all keys together | Your account | `429` [`daily_limit_exceeded`](https://developers.newjune.co/errors#daily_limit_exceeded) | | Failed authentication | 20 per minute per IP address | Requests with a missing or invalid key | `429` [`too_many_failed_attempts`](https://developers.newjune.co/errors#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: | Header | Meaning | | --- | --- | | `RateLimit-Limit` | Requests allowed per minute for this key. | | `RateLimit-Remaining` | Requests left in the current window. | | `RateLimit-Reset` | Seconds 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 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: ```bash # 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" ``` TypeScript: ```ts // Node 20+. Retries 429 and 5xx; waits for Retry-After when present. async function getWithRetry(url: string, attempts = 5): Promise { 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')); ``` Python: ```python 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](https://developers.newjune.co/guides/incremental-sync). - **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. --- # Errors Source: https://developers.newjune.co/errors > Every error has the same JSON shape, a stable code, and a link back to this page. When a request fails, the API answers with an HTTP status from the 4xx or 5xx range and a JSON body with one `error` object. Branch on `error.code`, not on the message: codes are stable, messages may be reworded. ```json title="401 Unauthorized" { "error": { "type": "authentication_error", "code": "invalid_api_key", "message": "The API key is not valid.", "param": null, "request_id": "req_6f1c2b8e3d4a4f5b9c6d7e8f", "doc_url": "https://developers.newjune.co/errors#invalid_api_key" } } ``` | Field | Description | | --- | --- | | `type` | The broad category. See [error types](#error-types). | | `code` | A stable, specific code. Every code is listed below. | | `message` | A sentence for people. Safe to log, not meant for program logic. | | `param` | The query parameter at fault, when there is one. Otherwise null. | | `request_id` | The id of this request, also sent as the `Request-Id` header. Include it when you contact support. | | `doc_url` | A link to this code's entry on this page. | ## Handling errors Retry only what can succeed on retry: `429` after waiting for `Retry-After`, and `500` or `503` with exponential backoff. Every `400`, `401`, `403`, and `404` needs a change to the request or the key first. curl: ```bash curl -s "https://data.newjune.co/v1/rounds?limit=500" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" # {"error":{"type":"invalid_request_error","code":"invalid_query_parameter","param":"limit",...}} ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/rounds?limit=25', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) { const { error } = await response.json(); switch (error.type) { case 'rate_limit_error': // Wait for Retry-After seconds, then retry. break; case 'api_error': // Retry with exponential backoff. break; default: // Fix the request or the key; retrying will fail the same way. throw new Error(`${error.code}: ${error.message} (${error.request_id})`); } } ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/rounds", params={"limit": 25}, headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) if not response.ok: error = response.json()["error"] if error["type"] == "rate_limit_error": pass # Wait for Retry-After seconds, then retry. elif error["type"] == "api_error": pass # Retry with exponential backoff. else: raise RuntimeError(f"{error['code']}: {error['message']} ({error['request_id']})") ``` A few rules hold for every endpoint: - An id that belongs to another account returns the same `404 resource_not_found` as an id that does not exist, so ids reveal nothing about other players. - Unknown paths under `/v1` return `401` until you send a valid key, then `404 route_not_found`. - Methods other than `GET`, `HEAD`, and `OPTIONS` return `405 method_not_allowed` with an `Allow` header. - Internal details never appear in a response. A `500` carries only a `request_id`. ## Error types | Type | Meaning | | --- | --- | | `invalid_request_error` | The request is wrong in a way you can fix before retrying. | | `authentication_error` | The API key is missing or cannot be used. | | `permission_error` | The key is valid but may not do this. | | `not_found_error` | Nothing exists at this id or path for your account. | | `rate_limit_error` | You sent too many requests. Wait, then retry. | | `api_error` | Something failed on our side. Retry with backoff. | ## Error codes Every code the API can return. Codes are stable: new ones may be added, existing ones are never renamed or reused. ### invalid_query_parameter HTTP 400, type `invalid_request_error`. **Message:** A query parameter has an invalid value. **What to do:** Check `param` for the parameter name and fix its value. Timestamps need a Z or an offset; ids are UUIDs; `limit` is 1 to 100. ### unknown_query_parameter HTTP 400, type `invalid_request_error`. **Message:** This endpoint does not accept that query parameter. **What to do:** Remove the parameter or fix its spelling. Each endpoint accepts only the parameters listed on its reference page. ### invalid_cursor HTTP 400, type `invalid_request_error`. **Message:** The cursor is not valid. Use the next_cursor value from a previous response. **What to do:** Pass `next_cursor` from the previous page exactly as returned, with the same filters. Do not build or edit cursors. ### method_not_allowed HTTP 405, type `invalid_request_error`. **Message:** This API is read only. Use GET. **What to do:** Use GET. The API is read only. ### missing_api_key HTTP 401, type `authentication_error`. **Message:** No API key was provided. Send it as "Authorization: Bearer <key>". **What to do:** Send the key in the `Authorization` header as `Bearer <key>`. ### invalid_api_key HTTP 401, type `authentication_error`. **Message:** The API key is not valid. **What to do:** Check that you copied the whole key, including the `nj_live_` prefix. If it is lost, create a new key. ### api_key_revoked HTTP 401, type `authentication_error`. **Message:** This API key has been revoked. Create a new key on the Developer page at newjune.co/golf/developer. **What to do:** Create a new key on the Developer page and update your secret store. ### api_key_expired HTTP 401, type `authentication_error`. **Message:** This API key has expired. Create a new key on the Developer page at newjune.co/golf/developer. **What to do:** Create a new key on the Developer page and update your secret store. ### account_suspended HTTP 403, type `permission_error`. **Message:** API access is suspended for this account. **What to do:** Contact New June support. Retrying will not help. ### insufficient_scope HTTP 403, type `permission_error`. **Message:** This API key does not have the scope this endpoint needs. **What to do:** Create a key that includes the scope listed on the endpoint’s reference page. Scopes cannot be added to an existing key. ### resource_not_found HTTP 404, type `not_found_error`. **Message:** No such resource. **What to do:** Check the id. An id that belongs to another account returns this same error, by design. ### no_current_focus_set HTTP 404, type `not_found_error`. **Message:** There is no current focus set for this account. **What to do:** There is no focus set in use right now. List focus sets to see past ones. ### route_not_found HTTP 404, type `not_found_error`. **Message:** No such endpoint. **What to do:** Check the path against the API reference. Paths start with `/v1/`. ### rate_limit_exceeded HTTP 429, type `rate_limit_error`. **Message:** Too many requests. Wait until the time in Retry-After, then try again. **What to do:** Wait for the number of seconds in `Retry-After`, then retry. Spread requests out to stay under your per-minute limit. ### daily_limit_exceeded HTTP 429, type `rate_limit_error`. **Message:** This account has reached its daily request limit. It resets at midnight UTC. **What to do:** Stop until midnight UTC, when the daily count resets. `Retry-After` gives the seconds until then. ### too_many_failed_attempts HTTP 429, type `rate_limit_error`. **Message:** Too many requests with a missing or invalid API key. Try again shortly. **What to do:** Fix the key you are sending, then wait for `Retry-After` before trying again. ### internal_error HTTP 500, type `api_error`. **Message:** Something went wrong on our side. Try again later. **What to do:** Retry with exponential backoff. If it persists, contact support with the `request_id`. ### service_unavailable HTTP 503, type `api_error`. **Message:** The API is temporarily unavailable. Try again later. **What to do:** Retry with exponential backoff. The API is down or paused for a short time. --- # Versioning Source: https://developers.newjune.co/versioning > What v1 promises, what can change without notice, and how breaking changes will arrive. The version is in the path: every endpoint lives under `/v1`. Version 1 is in **preview** while the first integrations come online, but its contract already holds. ## What v1 promises Within v1 we only make **additive** changes, and we may make them without notice: - New endpoints and new resources. - New optional query parameters. - New fields on existing objects. - New values in enums (for example a new round `status`). - New error codes. - Longer or reworded descriptions and error messages. Write clients that tolerate these: - Ignore fields you do not recognize. - Handle enum values you do not recognize, for example by treating them as "other". - Branch on `error.type` as a fallback when `error.code` is new to you. - Never depend on the order of fields in an object. ## What would be breaking These changes never happen within v1: - Removing or renaming an endpoint, field, query parameter, or error code. - Changing a field's type, its unit, or whether it can be null. - Changing what an existing enum value or error code means. - Changing the order of a list, the list envelope, or the error envelope. - Making an optional parameter required, or narrowing the values a parameter accepts. A breaking change ships as a new version (`/v2`). v1 keeps working alongside it, and the [changelog](https://developers.newjune.co/changelog) will announce the new version and the date v1 stops working, with time to migrate. ## Staying current - The [changelog](https://developers.newjune.co/changelog) lists every change to the API. - The OpenAPI document at [`/openapi.json`](https://developers.newjune.co/openapi.json) always describes the current API. Diff it to spot additions. --- # Changelog Source: https://developers.newjune.co/changelog > Every change to the New June Data API, newest first. ## 2026-11-24: v1 preview **Preview** The first release of the New June Data API, version `1.0.0-preview`. - Read-only access to your own data with personal API keys (`nj_live_...`), created on the [Developer page](https://newjune.co/golf/developer), and four scopes: `rounds:read`, `reports:read`, `plans:read`, `clubs:read`. Every operation lists the scope it needs. - Resources: `me`, `rounds`, `hole_scores`, `shots`, `reports`, `priorities`, `plans`, `evaluations`, `focus_sets` (including `/v1/focus_sets/current`), and `clubs`. - Cursor pagination on every list (`limit` 1 to 100, `next_cursor`). - Filters: - rounds: `status`, `started_after`, `started_before`, `updated_after` - hole scores: `round_id`, `updated_after` (at least one is required) - shots: `round_id`, `hole_number` (with `round_id`), `club`, `played_after`, `played_before`, `updated_after` - reports: `round_id` - priorities: `status`, `updated_after` - plans: `status`, `priority_id`, `updated_after` - evaluations: `plan_id`, `round_id` - `updated_after` keeps items whose own `updated_at` is strictly later, for [incremental sync](https://developers.newjune.co/guides/incremental-sync). - Test rounds are left out everywhere, including evaluations of a test round. - Rate limits per key (per minute), per account (per UTC day), and per IP for failed authentication, reported in `RateLimit-*` headers, with `Retry-After` on 429. Every response has a `Request-Id` header. - One error envelope with stable codes, each documented on [Errors](https://developers.newjune.co/errors). - OpenAPI 3.1 document at `https://data.newjune.co/v1/openapi.json`, with an example for every object. --- # Export every round to CSV Source: https://developers.newjune.co/guides/export-rounds-to-csv > Walk every page of your rounds and write one CSV row per round, ready for a spreadsheet. This script pages through `GET /v1/rounds` and writes `rounds.csv` with one row per round: date, course, tee, holes, strokes, par, and score to par. **Needs:** a key with `rounds:read`, exported as `NEW_JUNE_API_KEY`. curl: ```bash #!/usr/bin/env bash # export-rounds.sh: needs curl and jq. set -euo pipefail out="rounds.csv" echo "id,started_at,timezone,status,play_mode,course,facility,tee,holes_scored,total_strokes,par_total,score_to_par" > "$out" cursor="" while :; do url="https://data.newjune.co/v1/rounds?limit=100" if [ -n "$cursor" ]; then url="$url&cursor=$cursor"; fi page=$(curl -sf "$url" -H "Authorization: Bearer $NEW_JUNE_API_KEY") echo "$page" | jq -r '.data[] | [ .id, .started_at, .timezone, .status, .play_mode, .course.name, .course.facility_name, .tee.name, .holes_scored, .total_strokes, .par_total, .score_to_par ] | @csv' >> "$out" if [ "$(echo "$page" | jq -r '.has_more')" != "true" ]; then break; fi cursor=$(echo "$page" | jq -r '.next_cursor') done echo "Wrote $(($(wc -l < "$out") - 1)) rounds to $out" ``` TypeScript: ```ts // export-rounds.mts: Node 20+, no dependencies. Run with: npx tsx export-rounds.mts import { writeFileSync } from 'node:fs'; interface Round { id: string; started_at: string; timezone: string | null; status: string; play_mode: string; course: { name: string; facility_name: string } | null; tee: { name: string } | null; holes_scored: number; total_strokes: number | null; par_total: number | null; score_to_par: number | null; } async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null }; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } function csvCell(value: string | number | null | undefined): string { if (value === null || value === undefined) return ''; const text = String(value); return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text; } const header = [ 'id', 'started_at', 'timezone', 'status', 'play_mode', 'course', 'facility', 'tee', 'holes_scored', 'total_strokes', 'par_total', 'score_to_par', ]; const rows = [header.join(',')]; for await (const round of listAll('rounds')) { rows.push( [ round.id, round.started_at, round.timezone, round.status, round.play_mode, round.course?.name, round.course?.facility_name, round.tee?.name, round.holes_scored, round.total_strokes, round.par_total, round.score_to_par, ].map(csvCell).join(',') ); } writeFileSync('rounds.csv', `${rows.join('\n')}\n`); console.log(`Wrote ${rows.length - 1} rounds to rounds.csv`); ``` Python: ```python # export_rounds.py: needs requests (pip install requests). import csv import os import requests API = "https://data.newjune.co/v1" session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] fields = [ "id", "started_at", "timezone", "status", "play_mode", "course", "facility", "tee", "holes_scored", "total_strokes", "par_total", "score_to_par", ] count = 0 with open("rounds.csv", "w", newline="") as file: writer = csv.DictWriter(file, fieldnames=fields) writer.writeheader() for round_ in list_all("rounds"): course = round_["course"] or {} tee = round_["tee"] or {} writer.writerow({ "id": round_["id"], "started_at": round_["started_at"], "timezone": round_["timezone"], "status": round_["status"], "play_mode": round_["play_mode"], "course": course.get("name"), "facility": course.get("facility_name"), "tee": tee.get("name"), "holes_scored": round_["holes_scored"], "total_strokes": round_["total_strokes"], "par_total": round_["par_total"], "score_to_par": round_["score_to_par"], }) count += 1 print(f"Wrote {count} rounds to rounds.csv") ``` ## Notes - **Only finished rounds:** add `status=completed` to the request (`listAll('rounds', { status: 'completed' })`, `list_all("rounds", status="completed")`, or `&status=completed` in the URL). - **A date range:** add `started_after` and `started_before`, for example `started_after=2026-01-01T00:00:00Z`. - **Empty cells** are `null` values: a round with no course data, or no holes scored yet. - **Hole by hole:** for each round, list `GET /v1/hole_scores?round_id=` and write one row per hole. That is one extra request per round, so see [Rate limits](https://developers.newjune.co/rate-limits) before exporting years of rounds. --- # Scoring trends over time Source: https://developers.newjune.co/guides/scoring-trends > Average score to par by month from your completed rounds. `score_to_par` on each round is `total_strokes - par_total` for the holes you scored. This script fetches your completed rounds, keeps the 18-hole ones so months compare fairly, and prints the average score to par for each month. **Needs:** a key with `rounds:read`, exported as `NEW_JUNE_API_KEY`. curl: ```bash #!/usr/bin/env bash # scoring-trends.sh: needs curl and jq. set -euo pipefail all="[]" cursor="" while :; do url="https://data.newjune.co/v1/rounds?status=completed&limit=100" if [ -n "$cursor" ]; then url="$url&cursor=$cursor"; fi page=$(curl -sf "$url" -H "Authorization: Bearer $NEW_JUNE_API_KEY") all=$(jq -s '.[0] + .[1].data' <(echo "$all") <(echo "$page")) if [ "$(echo "$page" | jq -r '.has_more')" != "true" ]; then break; fi cursor=$(echo "$page" | jq -r '.next_cursor') done echo "$all" | jq -r ' map(select(.holes_scored == 18 and .score_to_par != null)) | group_by(.started_at[0:7]) | .[] | "\(.[0].started_at[0:7]) rounds: \(length) avg to par: \((map(.score_to_par) | add / length * 10 | round / 10))"' ``` TypeScript: ```ts // scoring-trends.mts: Node 20+, no dependencies. Run with: npx tsx scoring-trends.mts interface Round { started_at: string; holes_scored: number; score_to_par: number | null; } async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null }; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } const byMonth = new Map(); for await (const round of listAll('rounds', { status: 'completed' })) { if (round.holes_scored !== 18 || round.score_to_par === null) continue; const month = round.started_at.slice(0, 7); // UTC month, e.g. "2026-06" byMonth.set(month, [...(byMonth.get(month) ?? []), round.score_to_par]); } for (const month of [...byMonth.keys()].sort()) { const scores = byMonth.get(month)!; const average = scores.reduce((sum, score) => sum + score, 0) / scores.length; const sign = average > 0 ? '+' : ''; console.log(`${month} rounds: ${scores.length} avg to par: ${sign}${average.toFixed(1)}`); } ``` Python: ```python # scoring_trends.py: needs requests (pip install requests). import os from collections import defaultdict import requests API = "https://data.newjune.co/v1" session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] by_month = defaultdict(list) for round_ in list_all("rounds", status="completed"): if round_["holes_scored"] != 18 or round_["score_to_par"] is None: continue by_month[round_["started_at"][:7]].append(round_["score_to_par"]) # UTC month for month in sorted(by_month): scores = by_month[month] average = sum(scores) / len(scores) print(f"{month} rounds: {len(scores)} avg to par: {average:+.1f}") ``` ```text title="Example output" 2026-04 rounds: 3 avg to par: +18.3 2026-05 rounds: 5 avg to par: +16.0 2026-06 rounds: 4 avg to par: +14.5 ``` ## Notes - **Months are UTC.** A round that starts late in the evening can fall into the next UTC day or month. To group by local date, convert `started_at` with the round's `timezone` (an IANA name such as `America/Los_Angeles`) first. - **Nine-hole rounds** are left out so a month with short rounds does not look better than it was. To include them, compare `score_to_par` per hole (`score_to_par / holes_scored`) instead. - **`score_to_par` is null** when par is unknown for any scored hole, for example on a course without par data. Those rounds are skipped. - **One year only:** add `started_after`, for example `{ status: 'completed', started_after: '2026-01-01T00:00:00Z' }`. --- # Distance by club from shots Source: https://developers.newjune.co/guides/distance-by-club > Median distance for each club from a year of shots, next to the typical distance in your bag. Each shot has the `club` it was played with and `result.distance_yards`, how far the ball went. This script collects a year of shots, takes the median distance per club, and prints it next to `typical_total_yards` from your bag. **Needs:** a key with `rounds:read` and `clubs:read`, exported as `NEW_JUNE_API_KEY`. curl: ```bash #!/usr/bin/env bash # distance-by-club.sh: needs curl, jq, and GNU or BSD date. set -euo pipefail since=$(date -u -v-365d +%Y-%m-%dT00:00:00Z 2>/dev/null || date -u -d '365 days ago' +%Y-%m-%dT00:00:00Z) fetch_all() { local base="$1" cursor="" page all="[]" while :; do local url="$base" if [ -n "$cursor" ]; then url="$url&cursor=$cursor"; fi page=$(curl -sf "$url" -H "Authorization: Bearer $NEW_JUNE_API_KEY") all=$(jq -s '.[0] + .[1].data' <(echo "$all") <(echo "$page")) if [ "$(echo "$page" | jq -r '.has_more')" != "true" ]; then break; fi cursor=$(echo "$page" | jq -r '.next_cursor') done echo "$all" } shots=$(fetch_all "https://data.newjune.co/v1/shots?played_after=$since&limit=100") clubs=$(fetch_all "https://data.newjune.co/v1/clubs?limit=100") jq -rn --argjson shots "$shots" --argjson clubs "$clubs" ' ($clubs | map({ (.club // "") : .typical_total_yards }) | add // {}) as $bag | $shots | map(select(.club != null and .club != "putter" and .is_provisional != true and .result.distance_yards != null)) | group_by(.club) | map({ club: .[0].club, n: length, d: (map(.result.distance_yards) | sort) }) | sort_by(-(.d[(.n / 2 | floor)])) | .[] | "\(.club)\tshots: \(.n)\tmedian: \(.d[(.n / 2 | floor)] | round) yd\tbag: \($bag[.club] // "n/a")"' ``` TypeScript: ```ts // distance-by-club.mts: Node 20+, no dependencies. Run with: npx tsx distance-by-club.mts interface Shot { club: string | null; is_provisional: boolean | null; result: { distance_yards: number | null }; } interface Club { club: string | null; display_name: string; typical_total_yards: number | null; } async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null }; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } function median(values: number[]): number { const sorted = [...values].sort((a, b) => a - b); const middle = Math.floor(sorted.length / 2); return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2; } const since = new Date(Date.now() - 365 * 24 * 60 * 60 * 1000).toISOString(); const distances = new Map(); for await (const shot of listAll('shots', { played_after: since })) { const yards = shot.result.distance_yards; if (!shot.club || shot.club === 'putter' || shot.is_provisional || yards === null) continue; distances.set(shot.club, [...(distances.get(shot.club) ?? []), yards]); } const bag = new Map(); for await (const club of listAll('clubs')) if (club.club) bag.set(club.club, club); const rows = [...distances].map(([club, yards]) => ({ club, shots: yards.length, median: median(yards) })); for (const row of rows.sort((a, b) => b.median - a.median)) { const typical = bag.get(row.club)?.typical_total_yards ?? 'n/a'; console.log(`${row.club.padEnd(16)} shots: ${String(row.shots).padStart(3)} median: ${Math.round(row.median)} yd bag: ${typical}`); } ``` Python: ```python # distance_by_club.py: needs requests (pip install requests). import os from collections import defaultdict from datetime import datetime, timedelta, timezone from statistics import median import requests API = "https://data.newjune.co/v1" session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] since = (datetime.now(timezone.utc) - timedelta(days=365)).strftime("%Y-%m-%dT%H:%M:%SZ") distances = defaultdict(list) for shot in list_all("shots", played_after=since): yards = shot["result"]["distance_yards"] if not shot["club"] or shot["club"] == "putter" or shot["is_provisional"] or yards is None: continue distances[shot["club"]].append(yards) bag = {club["club"]: club for club in list_all("clubs") if club["club"]} rows = sorted( ((club, len(yards), median(yards)) for club, yards in distances.items()), key=lambda row: row[2], reverse=True, ) for club, count, middle in rows: typical = bag.get(club, {}).get("typical_total_yards") or "n/a" print(f"{club:<16} shots: {count:>3} median: {round(middle)} yd bag: {typical}") ``` ```text title="Example output" driver shots: 84 median: 238 yd bag: 245 3_wood shots: 19 median: 214 yd bag: 220 7_iron shots: 46 median: 151 yd bag: 155 pitching_wedge shots: 38 median: 118 yd bag: 120 ``` ## Notes - **Median, not mean.** One topped drive or one flier pulls an average a long way. The median shows your stock distance. - **One club only:** filter on the server with `club`, for example `listAll('shots', { club: '7_iron', played_after: since })`. The values are the `club` enum in the [shots reference](https://developers.newjune.co/api-reference/shots). - **Carry vs total:** `result.distance_yards` is how far the ball traveled in total. Your bag's `typical_carry_yards` is carry only, so compare with `typical_total_yards`. - **Free-text context:** `lie.type`, `planned.shot_type`, and `result.quality` are free text (see [Conventions](https://developers.newjune.co/conventions#enums-and-free-text)). Group by them only after normalizing the values you care about, for example only shots whose `lie.type` mentions `fairway`. - **Volume:** a year of shots can be a few thousand items, which is a few dozen requests at `limit=100`. --- # Track a plan's progress across rounds Source: https://developers.newjune.co/guides/plan-progress > For each active plan, list its criterion and how each round's evaluation went, oldest first. After every round, New June evaluates each active plan against that round. An evaluation's `status` is `open` (the criterion is not met yet), `partial`, or `complete`, with a `confidence` and a short `summary`. Lined up in order, a plan's evaluations show whether it is moving. Remember that a plan graduates on its **criterion**, never on its steps. This script prints the criterion first, then the evaluations. **Needs:** a key with `plans:read`, exported as `NEW_JUNE_API_KEY`. curl: ```bash #!/usr/bin/env bash # plan-progress.sh: needs curl and jq. set -euo pipefail auth="Authorization: Bearer $NEW_JUNE_API_KEY" plans=$(curl -sf "https://data.newjune.co/v1/plans?status=active&limit=100" -H "$auth") echo "$plans" | jq -c '.data[]' | while read -r plan; do plan_id=$(echo "$plan" | jq -r '.id') echo "$plan" | jq -r '"\nPlan \(.id)\n Done when: \(.criterion.threshold // "not set") (\(.criterion.measurable_signal // "no signal"))\n Steps done: \([.steps[] | select(.status == "done")] | length) of \(.steps | length)"' curl -sf "https://data.newjune.co/v1/evaluations?plan_id=$plan_id&limit=100" -H "$auth" \ | jq -r '.data | reverse | .[] | " \(.evaluated_at[0:10]) \(.status)\t\(.confidence // "-")\t\(.summary // "")"' done ``` TypeScript: ```ts // plan-progress.mts: Node 20+, no dependencies. Run with: npx tsx plan-progress.mts interface Plan { id: string; criterion: { measurable_signal: string | null; threshold: string | null } | null; steps: { title: string; status: 'open' | 'done' }[]; } interface Evaluation { evaluated_at: string; status: 'open' | 'partial' | 'complete' | 'cancelled'; confidence: 'high' | 'medium' | 'low' | null; summary: string | null; } async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null }; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } for await (const plan of listAll('plans', { status: 'active' })) { const done = plan.steps.filter(step => step.status === 'done').length; console.log(`\nPlan ${plan.id}`); console.log(` Done when: ${plan.criterion?.threshold ?? 'not set'} (${plan.criterion?.measurable_signal ?? 'no signal'})`); console.log(` Steps done: ${done} of ${plan.steps.length}`); const evaluations: Evaluation[] = []; for await (const evaluation of listAll('evaluations', { plan_id: plan.id })) { evaluations.push(evaluation); } for (const evaluation of evaluations.reverse()) { const day = evaluation.evaluated_at.slice(0, 10); console.log(` ${day} ${evaluation.status.padEnd(8)} ${(evaluation.confidence ?? '-').padEnd(6)} ${evaluation.summary ?? ''}`); } } ``` Python: ```python # plan_progress.py: needs requests (pip install requests). import os import requests API = "https://data.newjune.co/v1" session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] for plan in list_all("plans", status="active"): criterion = plan["criterion"] or {} done = sum(1 for step in plan["steps"] if step["status"] == "done") print(f"\nPlan {plan['id']}") print(f" Done when: {criterion.get('threshold') or 'not set'} ({criterion.get('measurable_signal') or 'no signal'})") print(f" Steps done: {done} of {len(plan['steps'])}") evaluations = list(list_all("evaluations", plan_id=plan["id"])) for evaluation in reversed(evaluations): # the API returns newest first day = evaluation["evaluated_at"][:10] confidence = evaluation["confidence"] or "-" print(f" {day} {evaluation['status']:<8} {confidence:<6} {evaluation['summary'] or ''}") ``` ```text title="Example output" Plan 6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d Done when: One or fewer in two straight rounds. (Three-putts per round from outside 30 feet.) Steps done: 2 of 3 2026-06-01 open high Four three-putts from long range. 2026-06-07 partial medium Two three-putts from long range, down from four last round. 2026-06-14 complete high One three-putt, the second straight round at or under the threshold. ``` ## Notes - **Plan names** live on the priority. Fetch `GET /v1/priorities/` and use its `title` for a readable heading. - **Which round:** each evaluation has `round_id`. Fetch the round to show the course and score next to the status. - **The current lineup:** `GET /v1/focus_sets/current` names the primary plan and up to two secondary plans you are working on now. It returns `404 no_current_focus_set` when there is none. - **Graduated plans:** list them with `status=graduated`. `graduated_at` is when the criterion was met. - **`cancelled` evaluations** appear only on older data. Skip them when charting. --- # Sync to your own database incrementally Source: https://developers.newjune.co/guides/incremental-sync > Keep a copy of your rounds, hole scores, and shots up to date with updated_after and a stored watermark. A sync job keeps a copy of your rounds, hole scores, and shots in your own store and refreshes it on a schedule. Each run asks only for what changed since the last one. The pattern: 1. **Keep one watermark per resource:** the newest `updated_at` you have stored for rounds, for hole scores, and for shots. Before the first run there is none. 2. **Each run, for each resource:** list with `updated_after` set to the watermark minus a five-minute overlap (or `1970-01-01T00:00:00Z` on the first run), walk every page, and upsert each item by `id`. 3. **Move the watermark** to the newest `updated_at` you saw, and only after every page came back. If a run fails halfway, the next run starts from the old watermark and picks up the rest. ## The filters this uses | Need | Request | Notes | | --- | --- | --- | | Rounds that changed | `GET /v1/rounds?updated_after=...` | Compares the round's own `updated_at`, strictly after the value. | | Hole scores that changed, across every round | `GET /v1/hole_scores?updated_after=...` | Hole scores need `round_id`, `updated_after`, or both. | | Shots that changed | `GET /v1/shots?updated_after=...` | Also works together with `round_id`. | `updated_after` takes an ISO 8601 time with `Z` or an offset and keeps items whose own `updated_at` is strictly later. It does not change the list order or how cursors work, so walk every page before you move the watermark. The same filter works on `priorities`, `plans`, and `clubs`. Each resource has its own watermark because each `updated_at` moves on its own: - **A round's `updated_at` does not move when its hole scores change.** Entering or editing a score changes the round's `holes_scored`, `total_strokes`, `par_total`, and `score_to_par`, but not its `updated_at`. Sync hole scores with their own `updated_after`, and recompute those totals from your stored hole scores, or re-read the round when one of its hole scores changes. - **A hole score's `updated_at` does not move when par or yardage change.** Those come from the round's scorecard or the course. - **A plan's `updated_at` does not move when a step is marked done or open.** If you sync plans, compare their steps. **Needs:** a key with `rounds:read`, exported as `NEW_JUNE_API_KEY`. curl: ```bash #!/usr/bin/env bash # sync.sh: needs curl and jq. Stores one JSON file per item under ./newjune/. set -euo pipefail dir="newjune" auth="Authorization: Bearer $NEW_JUNE_API_KEY" overlap=300 # seconds of overlap; items seen twice are upserted twice, which is harmless fetch_all() { local base="$1" cursor="" page while :; do local url="$base" if [ -n "$cursor" ]; then url="$url&cursor=$cursor"; fi page=$(curl -sf "$url" -H "$auth") echo "$page" | jq -c '.data[]' if [ "$(echo "$page" | jq -r '.has_more')" != "true" ]; then break; fi cursor=$(echo "$page" | jq -r '.next_cursor') done } # sync_resource sync_resource() { local name="$1" base="$2" mark="$dir/$1.watermark" since="1970-01-01T00:00:00Z" newest="" mkdir -p "$dir/$name" if [ -f "$mark" ]; then newest=$(cat "$mark") since=$(jq -rn --arg t "$newest" --argjson o "$overlap" \ '($t | sub("\\.[0-9]+Z$"; "Z") | fromdateiso8601) - $o | todateiso8601') fi # Fetch every page first: if a request fails, the script stops before # anything is stored and the watermark stays where it was. local items count=0 items=$(mktemp) fetch_all "$base$since" > "$items" while read -r item; do echo "$item" > "$dir/$name/$(echo "$item" | jq -r '.id').json" # upsert by id updated=$(echo "$item" | jq -r '.updated_at') if [[ "$updated" > "$newest" ]]; then newest="$updated"; fi count=$((count + 1)) done < "$items" rm -f "$items" if [ -n "$newest" ]; then echo "$newest" > "$mark"; fi echo "$name: $count new or changed" } sync_resource rounds "https://data.newjune.co/v1/rounds?limit=100&updated_after=" sync_resource hole_scores "https://data.newjune.co/v1/hole_scores?limit=100&updated_after=" sync_resource shots "https://data.newjune.co/v1/shots?limit=100&updated_after=" ``` TypeScript: ```ts // sync.mts: Node 20+, no dependencies. Run with: npx tsx sync.mts // Stores everything in newjune.json; replace load/save with your database. import { existsSync, readFileSync, writeFileSync } from 'node:fs'; type Resource = 'rounds' | 'hole_scores' | 'shots'; interface Item { id: string; updated_at: string } interface Store { watermarks: Partial>; items: Record>; } const STORE_FILE = 'newjune.json'; // Overlap: items seen twice are upserted twice, which is harmless. const OVERLAP_MS = 5 * 60 * 1000; async function* listAll(path: string, params: Record = {}) { let cursor: string | null = null; do { const url = new URL(`https://data.newjune.co/v1/${path}`); url.searchParams.set('limit', '100'); for (const [name, value] of Object.entries(params)) url.searchParams.set(name, value); if (cursor) url.searchParams.set('cursor', cursor); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`); const page = (await response.json()) as { data: T[]; has_more: boolean; next_cursor: string | null }; yield* page.data; cursor = page.has_more ? page.next_cursor : null; } while (cursor); } const store: Store = existsSync(STORE_FILE) ? JSON.parse(readFileSync(STORE_FILE, 'utf8')) : { watermarks: {}, items: { rounds: {}, hole_scores: {}, shots: {} } }; function since(resource: Resource): string { const watermark = store.watermarks[resource]; return watermark ? new Date(Date.parse(watermark) - OVERLAP_MS).toISOString() : '1970-01-01T00:00:00Z'; } async function sync(resource: Resource, items: AsyncIterable): Promise { let newest = store.watermarks[resource]; let count = 0; for await (const item of items) { store.items[resource][item.id] = item; // upsert by id if (!newest || item.updated_at > newest) newest = item.updated_at; count += 1; } if (newest) store.watermarks[resource] = newest; console.log(`${resource}: ${count} new or changed`); } await sync('rounds', listAll('rounds', { updated_after: since('rounds') })); await sync('hole_scores', listAll('hole_scores', { updated_after: since('hole_scores') })); await sync('shots', listAll('shots', { updated_after: since('shots') })); // Saved only when every page of every resource came back, so a failed run // leaves the old watermarks and the next run picks up the rest. writeFileSync(STORE_FILE, JSON.stringify(store)); ``` Python: ```python # sync.py: needs requests (pip install requests). Uses SQLite from the standard library. import json import os import sqlite3 from datetime import datetime, timedelta import requests API = "https://data.newjune.co/v1" OVERLAP = timedelta(minutes=5) # items seen twice are upserted twice, which is harmless session = requests.Session() session.headers["Authorization"] = f"Bearer {os.environ['NEW_JUNE_API_KEY']}" def list_all(path, **params): params = {"limit": 100, **params} while True: response = session.get(f"{API}/{path}", params=params, timeout=30) response.raise_for_status() page = response.json() yield from page["data"] if not page["has_more"]: return params["cursor"] = page["next_cursor"] db = sqlite3.connect("newjune.db") db.executescript(""" create table if not exists watermarks (resource text primary key, updated_at text); create table if not exists rounds (id text primary key, updated_at text, body text); create table if not exists hole_scores (id text primary key, updated_at text, body text); create table if not exists shots (id text primary key, updated_at text, body text); """) def since(resource): row = db.execute("select updated_at from watermarks where resource = ?", (resource,)).fetchone() if row is None: return "1970-01-01T00:00:00Z" start = datetime.fromisoformat(row[0].replace("Z", "+00:00")) - OVERLAP return start.strftime("%Y-%m-%dT%H:%M:%S.%fZ") def sync(resource, items): newest, count = None, 0 # One transaction per resource: if any page fails, nothing is stored # and the watermark stays where it was. with db: for item in items: db.execute( f"insert into {resource} values (?, ?, ?) on conflict(id) do update set " "updated_at = excluded.updated_at, body = excluded.body", (item["id"], item["updated_at"], json.dumps(item)), ) newest = max(newest or item["updated_at"], item["updated_at"]) count += 1 if newest: db.execute( "insert into watermarks values (?, ?) on conflict(resource) do update set " "updated_at = max(watermarks.updated_at, excluded.updated_at)", (resource, newest), ) print(f"{resource}: {count} new or changed") sync("rounds", list_all("rounds", updated_after=since("rounds"))) sync("hole_scores", list_all("hole_scores", updated_after=since("hole_scores"))) sync("shots", list_all("shots", updated_after=since("shots"))) ``` ## Why the overlap Each run asks for items changed after the watermark minus five minutes, not after the watermark itself: - A change saved in a database transaction that started earlier can carry an `updated_at` slightly older than one you already stored. Without an overlap, a run that happens at that moment would skip it. - `updated_at` is published to the millisecond. Asking for exactly the stored value can return that same item again. Both only mean that some items come back twice. Upserting by `id` makes a repeat harmless, so err on the side of a wider overlap, not a narrower one. ## Run it on a schedule Run the script from cron, a CI schedule, or a serverless cron job. Every 15 minutes to every hour is plenty: rounds change while you play and shortly after. ```bash # crontab: every 30 minutes. secrets.env holds: export NEW_JUNE_API_KEY=... */30 * * * * cd /path/to/sync && . ./secrets.env && python3 sync.py >> sync.log 2>&1 ``` Keep `secrets.env` readable only by the job's user (`chmod 600`), or use your scheduler's secret store. ## Notes - **Cost per run:** one request per page of changed items for each resource. When nothing changed, a run is three requests. The first run lists everything once. - **Deletions:** the API has no deleted-object feed, and a deleted item simply stops appearing, so `updated_after` never reports it. Once a week, list every round without filters, then each round's `GET /v1/hole_scores?round_id=...` and `GET /v1/shots?round_id=...`, and delete stored items that did not come back. - **Test rounds** are never returned, so they never reach your store. - **Priorities, plans, and clubs** take `updated_after` too: add them with the same function and their own watermarks (scopes `plans:read` and `clubs:read`). - **Reports, evaluations, and focus sets** have no `updated_at`. Reports and evaluations are listed newest first (`created_at` and `evaluated_at`), so read pages until you reach ones you already have. Focus sets are few; list them all on each run, since `effective_until` is set when a set is replaced. --- # API reference Source: https://developers.newjune.co/api-reference > Every resource, field, endpoint, and parameter in the New June Data API v1. The reference is generated from the API's OpenAPI 3.1 document, the same file the API serves. When the two ever disagree, the document wins: [download it](https://developers.newjune.co/openapi.json) or fetch it from the API at `https://data.newjune.co/v1/openapi.json`. - Base URL: `https://data.newjune.co/v1` - Auth header: `Authorization: Bearer $NEW_JUNE_API_KEY` - Methods: GET only (read-only) - Format: JSON, snake_case fields, explicit nulls, ISO 8601 UTC timestamps - OpenAPI 3.1 document: https://developers.newjune.co/openapi.json Every endpoint is a `GET` on a flat collection, `/v1/` or `/v1//{id}`. Related resources are linked by `_id` fields and query filters such as `?round_id=`, never by nested paths. Lists share one [envelope and cursor](https://developers.newjune.co/pagination), errors share one [shape](https://developers.newjune.co/errors), and every response uses the same [conventions](https://developers.newjune.co/conventions). ## Resources - [me](https://developers.newjune.co/api-reference/me): The API key making the request, and its limits. - [rounds](https://developers.newjune.co/api-reference/rounds): A round of golf you played or set up. - [hole_scores](https://developers.newjune.co/api-reference/hole-scores): Your score on one hole of a round. - [shots](https://developers.newjune.co/api-reference/shots): One shot from one of your rounds. - [reports](https://developers.newjune.co/api-reference/reports): Analysis of one of your rounds. When a round was analyzed more than once, only the newest report is available. - [priorities](https://developers.newjune.co/api-reference/priorities): An area of your game that your rounds point to. - [plans](https://developers.newjune.co/api-reference/plans): A practice plan for one of your priorities. - [evaluations](https://developers.newjune.co/api-reference/evaluations): A check of how a plan went in one of your rounds. - [focus_sets](https://developers.newjune.co/api-reference/focus-sets): The plans you were focusing on for a period of time. - [clubs](https://developers.newjune.co/api-reference/clubs): A club in your bag. ## Every endpoint | Method | Path | Summary | Scope | | --- | --- | --- | --- | | `GET` | [`/v1/me`](https://developers.newjune.co/api-reference/me) | Get the current API key | any key | | `GET` | [`/v1/rounds`](https://developers.newjune.co/api-reference/rounds) | List rounds | `rounds:read` | | `GET` | [`/v1/rounds/{id}`](https://developers.newjune.co/api-reference/rounds) | Get a round | `rounds:read` | | `GET` | [`/v1/hole_scores`](https://developers.newjune.co/api-reference/hole-scores) | List hole scores | `rounds:read` | | `GET` | [`/v1/hole_scores/{id}`](https://developers.newjune.co/api-reference/hole-scores) | Get a hole score | `rounds:read` | | `GET` | [`/v1/shots`](https://developers.newjune.co/api-reference/shots) | List shots | `rounds:read` | | `GET` | [`/v1/shots/{id}`](https://developers.newjune.co/api-reference/shots) | Get a shot | `rounds:read` | | `GET` | [`/v1/reports`](https://developers.newjune.co/api-reference/reports) | List reports | `reports:read` | | `GET` | [`/v1/reports/{id}`](https://developers.newjune.co/api-reference/reports) | Get a report | `reports:read` | | `GET` | [`/v1/priorities`](https://developers.newjune.co/api-reference/priorities) | List priorities | `plans:read` | | `GET` | [`/v1/priorities/{id}`](https://developers.newjune.co/api-reference/priorities) | Get a priority | `plans:read` | | `GET` | [`/v1/plans`](https://developers.newjune.co/api-reference/plans) | List plans | `plans:read` | | `GET` | [`/v1/plans/{id}`](https://developers.newjune.co/api-reference/plans) | Get a plan | `plans:read` | | `GET` | [`/v1/evaluations`](https://developers.newjune.co/api-reference/evaluations) | List evaluations | `plans:read` | | `GET` | [`/v1/evaluations/{id}`](https://developers.newjune.co/api-reference/evaluations) | Get an evaluation | `plans:read` | | `GET` | [`/v1/focus_sets`](https://developers.newjune.co/api-reference/focus-sets) | List focus sets | `plans:read` | | `GET` | [`/v1/focus_sets/current`](https://developers.newjune.co/api-reference/focus-sets) | Get the current focus set | `plans:read` | | `GET` | [`/v1/focus_sets/{id}`](https://developers.newjune.co/api-reference/focus-sets) | Get a focus set | `plans:read` | | `GET` | [`/v1/clubs`](https://developers.newjune.co/api-reference/clubs) | List clubs | `clubs:read` | | `GET` | [`/v1/clubs/{id}`](https://developers.newjune.co/api-reference/clubs) | Get a club | `clubs:read` | For example, the first request most integrations make is `GET https://data.newjune.co/v1/me`. --- # me Source: https://developers.newjune.co/api-reference/me > The API key making the request, and its limits. The API key making the request, and its limits. Scope: any valid key. Base URL: `https://data.newjune.co`. The key making the request. Use it to check that a key works, which scopes it has, and the limits that apply to it. It returns no golf data. ## Endpoints - `GET /v1/me`: Get the current API key Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The key context object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "api_key_context". | | `key` | object | The key used for this request. | | `key.object` | string | Always "api_key". | | `key.id` | string | Unique id of the API key. | | `key.name` | string | The name you gave the key. | | `key.prefix` | string | The first characters of the key, for telling keys apart. | | `key.scopes` | array of strings | What the key may read. | | `key.expires_at` | string (timestamp) or null | When the key stops working. Null when it does not expire. | | `limits` | object | Rate limits that apply to this key. | | `limits.requests_per_minute` | integer | Requests this key may make per minute. | | `limits.requests_per_day` | integer | Requests per UTC day, shared by all of your keys. Resets at midnight UTC. | Example key context: ```json { "object": "api_key_context", "key": { "object": "api_key", "id": "53e13cb8-f578-4bf4-958c-3c3faea4c7d4", "name": "Spreadsheet sync", "prefix": "nj_live_3f9a", "scopes": [ "plans:read", "rounds:read" ], "expires_at": "2027-06-01T00:00:00.000Z" }, "limits": { "requests_per_minute": 60, "requests_per_day": 1000 } } ``` ### Get the current API key `GET /v1/me` The key used for this request, its scopes, and its limits. Works with any valid key. Scope: any valid key. Operation id: `getMe`. #### Example request curl: ```bash curl "https://data.newjune.co/v1/me" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/me', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/me", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The key context. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # rounds Source: https://developers.newjune.co/api-reference/rounds > A round of golf you played or set up. A round of golf you played or set up. Scope: `rounds:read`. Base URL: `https://data.newjune.co`. A round is the root of your data. Hole scores, shots, reports, and evaluations point back to it with round_id. ## Endpoints - `GET /v1/rounds`: List rounds - `GET /v1/rounds/{id}`: Get a round Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The round object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "round". | | `id` | string | Unique id of the round. | | `status` | string | Where the round is in its life. One of: `scheduled`, `in_progress`, `paused`, `completed`, `cancelled`. | | `started_at` | string (timestamp) | When the round started. | | `ended_at` | string (timestamp) or null | When the round ended. Null while it is still going. | | `timezone` | string or null | IANA time zone where the round was played, when known. | | `play_mode` | string | Standard rounds are analyzed after you play. Casual rounds are played for fun and are not analyzed. One of: `standard`, `casual`. | | `holes_planned` | integer or null | How many holes the round was set up for (9 or 18), when known. | | `holes_scored` | integer | Holes with a score entered. | | `total_strokes` | integer or null | Sum of hole scores entered so far. Null when no hole has a score. | | `par_total` | integer or null | Par of the holes scored so far, from the round scorecard or the course. Null when no hole has a score or any scored hole has no known par. | | `score_to_par` | integer or null | The total_strokes value minus par_total. Null when either is null. | | `course` | object or null | The course the round was played on. Null when the course is not available to you. | | `course.id` | string | Unique id of the course. | | `course.name` | string | Course name. | | `course.facility_name` | string | Name of the club or facility. | | `course.city` | string or null | City, when known. | | `course.state_province` | string or null | State or province, when known. | | `course.country` | string or null | Country, when known. | | `tee` | object or null | The tee played from. Null when not chosen. | | `tee.id` | string | Unique id of the tee. | | `tee.name` | string | Tee name as shown on the card. | | `created_at` | string (timestamp) | When the round was created. | | `updated_at` | string (timestamp) | When the round itself was last changed: its status, times, course, tee, scorecard, or other round details, including some the API does not show. Entering or editing hole scores does not change it, even though holes_scored, total_strokes, par_total, and score_to_par change with them. | Example round: ```json { "object": "round", "id": "498fe851-9796-4fcb-abbe-95e3a176e444", "status": "completed", "started_at": "2026-06-14T15:02:11.000Z", "ended_at": "2026-06-14T19:08:40.000Z", "timezone": "America/Los_Angeles", "play_mode": "standard", "holes_planned": 18, "holes_scored": 18, "total_strokes": 87, "par_total": 72, "score_to_par": 15, "course": { "id": "f5a90a93-88b7-4aea-99a4-8aee6cbe414f", "name": "Ridge Course", "facility_name": "Larkspur Ridge Golf Club", "city": "Bend", "state_province": "OR", "country": "US" }, "tee": { "id": "c92eb9f5-2a8c-4c12-b470-b87d90a6bcd3", "name": "Blue" }, "created_at": "2026-06-14T14:58:30.000Z", "updated_at": "2026-06-14T19:21:05.000Z" } ``` ### List rounds `GET /v1/rounds` Your rounds, newest first: ordered by started_at descending, then id descending. Test rounds are not included. With updated_after, only rounds whose own updated_at is later; hole score changes do not move a round's updated_at. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `listRounds`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `status` | string | no | Only rounds with this status. One of: `scheduled`, `in_progress`, `paused`, `completed`, `cancelled`. | | `started_after` | string (timestamp) | no | Only rounds that started at or after this time (ISO 8601, with Z or an offset). | | `started_before` | string (timestamp) | no | Only rounds that started before this time (ISO 8601, with Z or an offset). | | `updated_after` | string (timestamp) | no | Only rounds whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. A round's updated_at does not move when its hole scores change, so sync hole scores with their own updated_after filter. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/rounds" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/rounds', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/rounds", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a round `GET /v1/rounds/{id}` One of your rounds by id. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `getRound`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The round's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/rounds/498fe851-9796-4fcb-abbe-95e3a176e444" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/rounds/498fe851-9796-4fcb-abbe-95e3a176e444', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/rounds/498fe851-9796-4fcb-abbe-95e3a176e444", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # hole_scores Source: https://developers.newjune.co/api-reference/hole-scores > Your score on one hole of a round. Your score on one hole of a round. Scope: `rounds:read`. Base URL: `https://data.newjune.co`. Each hole score belongs to one round. List them for one round with round_id, or across rounds with updated_after. ## Endpoints - `GET /v1/hole_scores`: List hole scores - `GET /v1/hole_scores/{id}`: Get a hole score Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The hole score object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "hole_score". | | `id` | string | Unique id of the hole score. | | `round_id` | string | The round this score belongs to. | | `hole_number` | integer | Hole number on the course, from 1. | | `strokes` | integer or null | Strokes taken on the hole. Null when not entered yet. | | `putts` | integer or null | Putts taken, when entered. | | `fairway_hit` | boolean or null | Whether the tee shot finished in the fairway. Null when not recorded or on a par 3. | | `green_in_regulation` | boolean or null | Whether the green was reached in regulation, when recorded. | | `penalty_strokes` | integer or null | Penalty strokes on the hole, when entered. | | `par` | integer or null | Par of the hole, from the round scorecard when it has one, otherwise the course. Null when unknown. | | `yardage_yards` | integer or null | Length of the hole from the tee the round was played from, in yards. Null when unknown. | | `created_at` | string (timestamp) | When the score was first entered. | | `updated_at` | string (timestamp) | When the score was last changed. Par and yardage come from the scorecard or course, so a change to them does not move it. | Example hole score: ```json { "object": "hole_score", "id": "aa311280-73b2-4a0b-8458-ced896a87627", "round_id": "498fe851-9796-4fcb-abbe-95e3a176e444", "hole_number": 7, "strokes": 5, "putts": 2, "fairway_hit": true, "green_in_regulation": false, "penalty_strokes": 0, "par": 4, "yardage_yards": 385, "created_at": "2026-06-14T16:41:27.000Z", "updated_at": "2026-06-14T19:12:09.000Z" } ``` ### List hole scores `GET /v1/hole_scores` The scores you entered, ordered by hole_number ascending, then id ascending. Pass round_id for one round, updated_after for scores changed since a time, or both; at least one is required. Scores from test rounds are not included. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `listHoleScores`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `round_id` | string | no | Only hole scores from this round. Either round_id or updated_after is required. | | `updated_after` | string (timestamp) | no | Only hole scores whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. Either round_id or updated_after is required. Without round_id, scores from every round come back in the same order (hole_number, then id). | #### Example request curl: ```bash curl "https://data.newjune.co/v1/hole_scores" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/hole_scores', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/hole_scores", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a hole score `GET /v1/hole_scores/{id}` One hole score by id. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `getHoleScore`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The hole score's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/hole_scores/aa311280-73b2-4a0b-8458-ced896a87627" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/hole_scores/aa311280-73b2-4a0b-8458-ced896a87627', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/hole_scores/aa311280-73b2-4a0b-8458-ced896a87627", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # shots Source: https://developers.newjune.co/api-reference/shots > One shot from one of your rounds. One shot from one of your rounds. Scope: `rounds:read`. Base URL: `https://data.newjune.co`. Each shot belongs to one round and one hole. List them across every round or for a single round in playing order. ## Endpoints - `GET /v1/shots`: List shots - `GET /v1/shots/{id}`: Get a shot Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The shot object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "shot". | | `id` | string | Unique id of the shot. | | `round_id` | string | The round the shot was played in. | | `hole_number` | integer | Hole number, from 1. | | `sequence_number` | integer | Order of the shot on the hole, from 1. | | `played_at` | string (timestamp) | When the shot was played. | | `club` | string or null | Club used. Null when not known. See the enum in openapi.json for every value. | | `is_provisional` | boolean or null | Whether this was a provisional ball. | | `penalty_strokes` | integer or null | Penalty strokes from this shot, when any. | | `penalty_type` | string or null | Kind of penalty, for example water or out of bounds. Null when there was none. Free text, not a fixed list. | | `start` | object | Where the shot was played from: latitude, longitude, and altitude. | | `start.latitude` | number or null | Latitude where the shot was played from, in degrees. | | `start.longitude` | number or null | Longitude where the shot was played from, in degrees. | | `start.altitude_meters` | number or null | Altitude where the shot was played from, in meters. | | `end` | object | Where the ball finished: latitude, longitude, and altitude. | | `end.latitude` | number or null | Latitude where the ball finished, in degrees. | | `end.longitude` | number or null | Longitude where the ball finished, in degrees. | | `end.altitude_meters` | number or null | Altitude where the ball finished, in meters. | | `lie` | object | The lie the shot was played from. | | `lie.type` | string or null | Where the ball lay. Free text, not a fixed list. | | `lie.quality` | string or null | How good the lie was. Free text, not a fixed list. | | `lie.description` | string or null | More detail about the lie. | | `planned` | object | What the shot was meant to do: distance, shape, and target. | | `planned.distance_yards` | number or null | Intended distance, in yards. | | `planned.curve` | string or null | Intended curve. Free text, not a fixed list. | | `planned.trajectory` | string or null | Intended trajectory. Free text, not a fixed list. | | `planned.shot_type` | string or null | Kind of shot. Free text, not a fixed list. | | `planned.target_latitude` | number or null | Latitude of the target, in degrees. | | `planned.target_longitude` | number or null | Longitude of the target, in degrees. | | `planned.notes` | string or null | Notes about the plan. | | `result` | object | What the shot did: distance, shape, contact, and outcome. | | `result.distance_yards` | number or null | Distance the ball traveled, in yards. | | `result.curve` | string or null | Actual curve. Free text, not a fixed list. | | `result.trajectory` | string or null | Actual trajectory. Free text, not a fixed list. | | `result.contact` | string or null | Quality of contact. Free text, not a fixed list. | | `result.quality` | string or null | Overall outcome. Free text, not a fixed list. | | `notes` | string or null | Notes about the shot. | | `confidence` | number or null | Confidence in the shot details, from 0 to 1. | | `created_at` | string (timestamp) | When the shot was recorded. | | `updated_at` | string (timestamp) | When the shot was last changed. | Example shot: ```json { "object": "shot", "id": "02cd3b84-a264-40b0-9af7-466c3874c512", "round_id": "498fe851-9796-4fcb-abbe-95e3a176e444", "hole_number": 7, "sequence_number": 2, "played_at": "2026-06-14T16:35:48.000Z", "club": "7_iron", "is_provisional": false, "penalty_strokes": 0, "penalty_type": null, "start": { "latitude": 44.04712, "longitude": -121.35218, "altitude_meters": 1102.4 }, "end": { "latitude": 44.04825, "longitude": -121.35161, "altitude_meters": 1104.1 }, "lie": { "type": "fairway", "quality": "good", "description": "Ball sitting cleanly in the fairway." }, "planned": { "distance_yards": 150, "curve": "draw", "trajectory": "mid", "shot_type": "approach", "target_latitude": 44.04829, "target_longitude": -121.35166, "notes": "Aim at the center of the green." }, "result": { "distance_yards": 146, "curve": "straight", "trajectory": "low", "contact": "thin", "quality": "missed green" }, "notes": "Wind into the face.", "confidence": 0.82, "created_at": "2026-06-14T19:34:56.000Z", "updated_at": "2026-06-14T19:34:56.000Z" } ``` ### List shots `GET /v1/shots` Your shots. Without round_id: newest first, ordered by played_at descending, then id descending. With round_id: in playing order, by hole_number, sequence_number, then id, all ascending. Shots from test rounds are not included. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `listShots`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `round_id` | string | no | Only shots from this round. | | `hole_number` | integer | no | Only shots on this hole. Requires round_id. | | `club` | string | no | Only shots played with this club. | | `played_after` | string (timestamp) | no | Only shots played at or after this time (ISO 8601, with Z or an offset). | | `played_before` | string (timestamp) | no | Only shots played before this time (ISO 8601, with Z or an offset). | | `updated_after` | string (timestamp) | no | Only shots whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/shots" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/shots', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/shots", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a shot `GET /v1/shots/{id}` One shot by id. Needs a key with the rounds:read scope. Scope: `rounds:read`. Operation id: `getShot`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The shot's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/shots/02cd3b84-a264-40b0-9af7-466c3874c512" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/shots/02cd3b84-a264-40b0-9af7-466c3874c512', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/shots/02cd3b84-a264-40b0-9af7-466c3874c512", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # reports Source: https://developers.newjune.co/api-reference/reports > Analysis of one of your rounds. When a round was analyzed more than once, only the newest report is available. Analysis of one of your rounds. When a round was analyzed more than once, only the newest report is available. Scope: `reports:read`. Base URL: `https://data.newjune.co`. A report is the analysis New June produces after a round. It names the areas to work on, which feed your priorities. ## Endpoints - `GET /v1/reports`: List reports - `GET /v1/reports/{id}`: Get a report Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The report object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "report". | | `id` | string | Unique id of the report. | | `round_id` | string | The round this report analyzes. | | `headline` | string or null | One-line takeaway, when the report has one. | | `narrative` | string or null | The written analysis of the round. Paragraphs are separated by a blank line. | | `priorities` | array of objects | Areas to work on, most important first. May be empty. | | `priorities[].title` | string or null | Short name of the area to work on. | | `priorities[].description` | string or null | Why it matters in this round. | | `holes` | array of objects | Per-hole analysis, by hole number. May be empty. | | `holes[].hole_number` | integer | Hole number, from 1. | | `holes[].summary` | string or null | What happened on the hole. | | `holes[].key_insight` | string or null | The main thing to take from the hole. | | `holes[].weight` | string or null | How much the hole mattered to the analysis. Null when not given. One of: `high`, `medium`, `low`. | | `created_at` | string (timestamp) | When the report was written. | Example report: ```json { "object": "report", "id": "791a868a-8cfc-48db-8690-70421a68ee7c", "round_id": "498fe851-9796-4fcb-abbe-95e3a176e444", "headline": "Solid ball striking, costly putting", "narrative": "You hit 9 of 14 fairways and gave most of the strokes back on the greens.\n\nThree of your four three-putts started outside 30 feet.", "priorities": [ { "title": "Lag putting from long range", "description": "Three of your four three-putts started outside 30 feet." } ], "holes": [ { "hole_number": 7, "summary": "Found the fairway, then left the 7 iron approach short of the green.", "key_insight": "Club up when the wind is in your face.", "weight": "medium" } ], "created_at": "2026-06-14T20:02:37.000Z" } ``` ### List reports `GET /v1/reports` The analysis of each of your rounds, newest first: ordered by created_at descending, then id descending. One report per round. Needs a key with the reports:read scope. Scope: `reports:read`. Operation id: `listReports`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `round_id` | string | no | Only the report for this round. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/reports" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/reports', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/reports", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a report `GET /v1/reports/{id}` One report by id. An older version of a round report is not found. Needs a key with the reports:read scope. Scope: `reports:read`. Operation id: `getReport`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The report's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/reports/791a868a-8cfc-48db-8690-70421a68ee7c" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/reports/791a868a-8cfc-48db-8690-70421a68ee7c', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/reports/791a868a-8cfc-48db-8690-70421a68ee7c", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # priorities Source: https://developers.newjune.co/api-reference/priorities > An area of your game that your rounds point to. An area of your game that your rounds point to. Scope: `plans:read`. Base URL: `https://data.newjune.co`. A priority is a lasting theme across reports. Plans point to a priority with priority_id. ## Endpoints - `GET /v1/priorities`: List priorities - `GET /v1/priorities/{id}`: Get a priority Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The prioritie object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "priority". | | `id` | string | Unique id of the priority. | | `title` | string | Short name of the area to work on. | | `description` | string or null | What the priority is about. | | `status` | string | Active while it is still a focus; inactive once set aside. One of: `active`, `inactive`. | | `first_seen_report_id` | string or null | The report that first raised this priority. | | `last_seen_report_id` | string or null | The most recent report that raised this priority. | | `created_at` | string (timestamp) | When the priority was created. | | `updated_at` | string (timestamp) | When the priority was last changed. | Example prioritie: ```json { "object": "priority", "id": "ecbf0900-77cd-472a-b692-76faa0b4f462", "title": "Lag putting", "description": "Leave long putts inside three feet to cut three-putts.", "status": "active", "first_seen_report_id": "03d09dc8-617f-45e0-92fd-a76822838da0", "last_seen_report_id": "791a868a-8cfc-48db-8690-70421a68ee7c", "created_at": "2026-05-17T21:10:44.000Z", "updated_at": "2026-06-14T20:02:51.000Z" } ``` ### List priorities `GET /v1/priorities` Your priorities, newest first: ordered by created_at descending, then id descending. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `listPriorities`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `status` | string | no | Only priorities with this status. One of: `active`, `inactive`. | | `updated_after` | string (timestamp) | no | Only priorities whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/priorities" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/priorities', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/priorities", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a priority `GET /v1/priorities/{id}` One priority by id. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `getPriority`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The priority's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/priorities/ecbf0900-77cd-472a-b692-76faa0b4f462" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/priorities/ecbf0900-77cd-472a-b692-76faa0b4f462', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/priorities/ecbf0900-77cd-472a-b692-76faa0b4f462", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # plans Source: https://developers.newjune.co/api-reference/plans > A practice plan for one of your priorities. A practice plan for one of your priorities. Scope: `plans:read`. Base URL: `https://data.newjune.co`. A plan works on one priority. Its steps are practice milestones; only its criterion decides when the plan graduates. ## Endpoints - `GET /v1/plans`: List plans - `GET /v1/plans/{id}`: Get a plan Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The plan object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "plan". | | `id` | string | Unique id of the plan. | | `priority_id` | string | The priority this plan works on. | | `status` | string | Candidate (proposed), active (being worked on), graduated (done), or cancelled. One of: `candidate`, `active`, `graduated`, `cancelled`. | | `criterion` | object or null | How the plan is judged complete. Null while the plan is still being drafted. | | `criterion.rubric` | string or null | What finishing the plan looks like. | | `criterion.measurable_signal` | string or null | What is measured from your rounds. | | `criterion.threshold` | string or null | The level that counts as done. | | `steps` | array of objects | Steps in order. Archived steps are not included. | | `steps[].id` | string | Unique id of the step. | | `steps[].title` | string | What to do. | | `steps[].description` | string or null | More detail about the step. | | `steps[].status` | string | Open until you mark it done. One of: `open`, `done`. | | `steps[].position` | integer | Order within the plan, ascending. | | `steps[].completed_at` | string (timestamp) or null | When the step was marked done. Null while open. | | `created_from_report_id` | string or null | The report the plan came from, when any. | | `graduated_at` | string (timestamp) or null | When the plan was completed. Null otherwise. | | `cancelled_at` | string (timestamp) or null | When the plan was cancelled. Null otherwise. | | `cancel_reason` | string or null | Why the plan was cancelled, when it was. | | `created_at` | string (timestamp) | When the plan was created. | | `updated_at` | string (timestamp) | When the plan itself was last changed. Marking a step done or open does not change it, so compare steps to catch step progress. | Example plan: ```json { "object": "plan", "id": "245f4a1a-cbd7-4444-9d09-4752871cfeb6", "priority_id": "ecbf0900-77cd-472a-b692-76faa0b4f462", "status": "active", "criterion": { "rubric": "Two-putt or better from outside 30 feet on most holes.", "measurable_signal": "Three-putts per round from outside 30 feet.", "threshold": "One or fewer in two straight rounds." }, "steps": [ { "id": "fb2f2182-69fd-432a-8625-feff4a555c7f", "title": "Ladder drill, 20 balls", "description": "Putt to 20, 30, and 40 feet, stopping each ball past the hole.", "status": "done", "position": 1, "completed_at": "2026-05-24T16:20:05.000Z" }, { "id": "2f9ad778-7c24-431d-85e9-5b2e60343d86", "title": "Lag to a tee from 40 feet", "description": "Ten putts from 40 feet; count how many finish inside three feet.", "status": "done", "position": 2, "completed_at": "2026-06-02T17:45:10.000Z" }, { "id": "345f8094-b1a6-4232-af1d-cfe8077c059b", "title": "Play nine holes counting three-putts", "description": "On the course, note the length of every first putt and every three-putt.", "status": "open", "position": 3, "completed_at": null } ], "created_from_report_id": "03d09dc8-617f-45e0-92fd-a76822838da0", "graduated_at": null, "cancelled_at": null, "cancel_reason": null, "created_at": "2026-05-17T21:12:03.000Z", "updated_at": "2026-05-17T21:14:40.000Z" } ``` ### List plans `GET /v1/plans` Your practice plans with their steps, newest first: ordered by created_at descending, then id descending. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `listPlans`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `status` | string | no | Only plans with this status. One of: `candidate`, `active`, `graduated`, `cancelled`. | | `priority_id` | string | no | Only plans for this priority. | | `updated_after` | string (timestamp) | no | Only plans whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. Marking a step done or open does not change it, so compare steps to catch step progress. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/plans" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/plans', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/plans", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a plan `GET /v1/plans/{id}` One plan by id, with its steps. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `getPlan`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The plan's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/plans/245f4a1a-cbd7-4444-9d09-4752871cfeb6" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/plans/245f4a1a-cbd7-4444-9d09-4752871cfeb6', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/plans/245f4a1a-cbd7-4444-9d09-4752871cfeb6", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # evaluations Source: https://developers.newjune.co/api-reference/evaluations > A check of how a plan went in one of your rounds. A check of how a plan went in one of your rounds. Scope: `plans:read`. Base URL: `https://data.newjune.co`. After each round, New June evaluates every active plan against that round. Evaluations link a plan_id to a round_id. ## Endpoints - `GET /v1/evaluations`: List evaluations - `GET /v1/evaluations/{id}`: Get an evaluation Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The evaluation object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "evaluation". | | `id` | string | Unique id of the evaluation. | | `plan_id` | string | The plan that was evaluated. | | `round_id` | string or null | The round the evaluation looked at, when there was one. | | `report_id` | string or null | The report the evaluation used, when there was one. | | `status` | string | How far the plan got: open (not met yet), partial, or complete. The cancelled value appears only on older evaluations. One of: `open`, `partial`, `complete`, `cancelled`. | | `confidence` | string or null | How sure the evaluation is. Null when not given. One of: `high`, `medium`, `low`. | | `summary` | string or null | Why the evaluation reached its status. | | `notes` | string or null | More detail from the evaluation. | | `data_quality_notes` | string or null | Anything about the round data that limited the evaluation. | | `evaluated_at` | string (timestamp) | When the evaluation was made. | | `created_at` | string (timestamp) | When the evaluation was saved. | Example evaluation: ```json { "object": "evaluation", "id": "bfedb770-42df-40b6-b523-812e260ec713", "plan_id": "245f4a1a-cbd7-4444-9d09-4752871cfeb6", "round_id": "498fe851-9796-4fcb-abbe-95e3a176e444", "report_id": "791a868a-8cfc-48db-8690-70421a68ee7c", "status": "partial", "confidence": "medium", "summary": "Two three-putts from long range, down from five last round.", "notes": "Pace control improved on the back nine.", "data_quality_notes": "Putts were not entered on holes 3 and 4.", "evaluated_at": "2026-06-14T20:03:40.000Z", "created_at": "2026-06-14T20:03:41.000Z" } ``` ### List evaluations `GET /v1/evaluations` Evaluations of your plans, newest first: ordered by evaluated_at descending, then id descending. Evaluations of test rounds are not included. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `listEvaluations`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `plan_id` | string | no | Only evaluations of this plan. | | `round_id` | string | no | Only evaluations of this round. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/evaluations" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/evaluations', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/evaluations", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get an evaluation `GET /v1/evaluations/{id}` One evaluation by id. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `getEvaluation`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The evaluation's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/evaluations/bfedb770-42df-40b6-b523-812e260ec713" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/evaluations/bfedb770-42df-40b6-b523-812e260ec713', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/evaluations/bfedb770-42df-40b6-b523-812e260ec713", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # focus_sets Source: https://developers.newjune.co/api-reference/focus-sets > The plans you were focusing on for a period of time. The plans you were focusing on for a period of time. Scope: `plans:read`. Base URL: `https://data.newjune.co`. A focus set is the lineup of plans in use for a period: one primary plan and up to two secondary plans. ## Endpoints - `GET /v1/focus_sets`: List focus sets - `GET /v1/focus_sets/current`: Get the current focus set - `GET /v1/focus_sets/{id}`: Get a focus set Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The focus set object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "focus_set". | | `id` | string | Unique id of the focus set. | | `primary_plan_id` | string or null | The main plan to work on. Null when none was chosen. | | `secondary_plan_ids` | array of strings | Other plans in the set, in order. Empty when there are none. | | `source_report_id` | string or null | The report the focus set came from, when any. | | `effective_from` | string (timestamp) | When the focus set started. | | `effective_until` | string (timestamp) or null | When it was replaced. Null for the current set. | | `is_current` | boolean | True for the focus set in use now. | | `created_at` | string (timestamp) | When the focus set was created. | Example focus set: ```json { "object": "focus_set", "id": "bc389c05-89d8-4afb-bd9d-f3979b56236e", "primary_plan_id": "245f4a1a-cbd7-4444-9d09-4752871cfeb6", "secondary_plan_ids": [ "f7a9731f-f737-4e63-affb-db411b42bc0a" ], "source_report_id": "03d09dc8-617f-45e0-92fd-a76822838da0", "effective_from": "2026-05-17T21:14:40.000Z", "effective_until": null, "is_current": true, "created_at": "2026-05-17T21:14:40.000Z" } ``` ### List focus sets `GET /v1/focus_sets` Your focus sets, newest first: ordered by effective_from descending, then id descending. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `listFocusSets`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/focus_sets" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/focus_sets', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/focus_sets", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get the current focus set `GET /v1/focus_sets/current` The focus set in use now. Returns 404 with code no_current_focus_set when there is none. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `getCurrentFocusSet`. #### Example request curl: ```bash curl "https://data.newjune.co/v1/focus_sets/current" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/focus_sets/current', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/focus_sets/current", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The current focus set. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: There is no current focus set for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a focus set `GET /v1/focus_sets/{id}` One focus set by id. Needs a key with the plans:read scope. Scope: `plans:read`. Operation id: `getFocusSet`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The focus set's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/focus_sets/bc389c05-89d8-4afb-bd9d-f3979b56236e" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/focus_sets/bc389c05-89d8-4afb-bd9d-f3979b56236e', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/focus_sets/bc389c05-89d8-4afb-bd9d-f3979b56236e", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # clubs Source: https://developers.newjune.co/api-reference/clubs > A club in your bag. A club in your bag. Scope: `clubs:read`. Base URL: `https://data.newjune.co`. Your bag, in bag order, with your typical distances for each club. ## Endpoints - `GET /v1/clubs`: List clubs - `GET /v1/clubs/{id}`: Get a club Responses carry `Request-Id`, `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and a `429` adds `Retry-After`. See [Headers](https://developers.newjune.co/conventions#headers). ## The club object | Field | Type | Description | | --- | --- | --- | | `object` | string | Always "club". | | `id` | string | Unique id of the club. | | `club` | string or null | Which club this is. Null when it does not match a known club. See the enum in openapi.json for every value. | | `type` | string or null | Kind of club. Null when not recognized. One of: `driver`, `wood`, `hybrid`, `iron`, `wedge`, `putter`. | | `display_name` | string | Name shown in the app. | | `position` | integer | Order in your bag, ascending. | | `typical_total_yards` | integer or null | Your usual total distance with this club, in yards. | | `typical_carry_yards` | integer or null | Your usual carry distance, in yards, when known. | | `loft_degrees` | number or null | Loft, in degrees, when known. | | `dispersion` | object or null | Shot pattern for this club. Null until there is enough data. | | `dispersion.center_long_yards` | number | How far the center of your shots lands past (+) or short of (-) the target, in yards. | | `dispersion.center_lateral_yards` | number | How far the center of your shots lands right (+) or left (-) of the target, in yards. | | `dispersion.forward_yards` | number | Spread past the center, in yards. | | `dispersion.backward_yards` | number | Spread short of the center, in yards. | | `dispersion.left_yards` | number | Spread left of the center, in yards. | | `dispersion.right_yards` | number | Spread right of the center, in yards. | | `dispersion.rotation_degrees` | number | Tilt of the pattern, in degrees, clockwise positive. | | `created_at` | string (timestamp) | When the club was added. | | `updated_at` | string (timestamp) | When the club was last changed. | Example club: ```json { "object": "club", "id": "a7d4a4dc-e38a-4f98-859d-322795119428", "club": "7_iron", "type": "iron", "display_name": "7 Iron", "position": 7, "typical_total_yards": 155, "typical_carry_yards": 147, "loft_degrees": 34, "dispersion": { "center_long_yards": -4, "center_lateral_yards": 3, "forward_yards": 9, "backward_yards": 12, "left_yards": 14, "right_yards": 10, "rotation_degrees": 8 }, "created_at": "2026-03-02T18:20:00.000Z", "updated_at": "2026-06-14T20:10:12.000Z" } ``` ### List clubs `GET /v1/clubs` The clubs in your bag, in bag order: position ascending, then id. Needs a key with the clubs:read scope. Scope: `clubs:read`. Operation id: `listClubs`. #### Query parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `limit` | integer | no | How many items to return, 1 to 100. Defaults to 25. | | `cursor` | string | no | The next_cursor value from the previous page, passed back unchanged with the same filters. | | `updated_after` | string (timestamp) | no | Only clubs whose own updated_at is strictly after this time (ISO 8601, with Z or an offset). Use it to sync changes since your last run; the list order does not change. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/clubs" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/clubs', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/clubs", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: A page of results. - `400`: A query parameter is unknown, missing, or has an invalid value. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. ### Get a club `GET /v1/clubs/{id}` One club by id. Needs a key with the clubs:read scope. Scope: `clubs:read`. Operation id: `getClub`. #### Path parameters | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `id` | string | yes | The club's id. | #### Example request curl: ```bash curl "https://data.newjune.co/v1/clubs/a7d4a4dc-e38a-4f98-859d-322795119428" \ -H "Authorization: Bearer $NEW_JUNE_API_KEY" ``` TypeScript: ```ts const response = await fetch('https://data.newjune.co/v1/clubs/a7d4a4dc-e38a-4f98-859d-322795119428', { headers: { Authorization: `Bearer ${process.env.NEW_JUNE_API_KEY}` }, }); const body = await response.json(); console.log(body); ``` Python: ```python import os import requests response = requests.get( "https://data.newjune.co/v1/clubs/a7d4a4dc-e38a-4f98-859d-322795119428", headers={"Authorization": f"Bearer {os.environ['NEW_JUNE_API_KEY']}"}, timeout=30, ) print(response.json()) ``` #### Responses - `200`: The item. - `401`: The API key is missing, not valid, revoked, or expired. - `403`: The key lacks the scope this endpoint needs, or the account is suspended. - `404`: No such resource for this account. - `429`: Too many requests. See the RateLimit and Retry-After headers. - `500`: Something went wrong on our side. - `503`: The API is temporarily unavailable. --- # Build with AI Source: https://developers.newjune.co/build-with-ai > Plain-text versions of these docs for coding agents, the OpenAPI document, and a prompt to paste into your agent. Every page on this site is also available as markdown, and the whole site is available as one file. Point a coding agent at these instead of the HTML pages: they are smaller, and they carry every endpoint, parameter, and field. | URL | What it is | | --- | --- | | [`/llms.txt`](https://developers.newjune.co/llms.txt) | An index of every page with a one-line description, in the [llms.txt](https://llmstxt.org) format. Start here. | | [`/llms-full.txt`](https://developers.newjune.co/llms-full.txt) | Every page as markdown in one file, in sidebar order. | | `.md` | One page as markdown, for example [`/quickstart.md`](https://developers.newjune.co/quickstart.md) or [`/api-reference/rounds.md`](https://developers.newjune.co/api-reference/rounds.md). | | [`/openapi.json`](https://developers.newjune.co/openapi.json) | The OpenAPI 3.1 document. Also served by the API at `https://data.newjune.co/v1/openapi.json`. | Every page also has a **Copy as Markdown** button under its title. The API reference markdown is built from the OpenAPI document, so it always matches the live contract. If an agent's answer disagrees with `openapi.json`, trust `openapi.json`. ## A prompt for coding agents Paste this into Claude Code, Cursor, Copilot, or any agent before asking it to write code against the API. Fill in the last line. ```text title="Prompt" You are writing code against the New June Data API, a read-only REST API that returns one golf player's own data. Read these before writing code: - https://developers.newjune.co/llms.txt (index of the docs) - https://developers.newjune.co/openapi.json (the contract; it wins over anything else) - https://developers.newjune.co/pagination.md and https://developers.newjune.co/errors.md Rules: - Base URL https://data.newjune.co/v1. Every endpoint is a GET. - Read the key from the NEW_JUNE_API_KEY environment variable and send it as "Authorization: Bearer ". Never hard-code or log the key. - Run on a server or script, never in browser code: the API sends no CORS headers. - Lists return {"object":"list","data":[...],"has_more":bool,"next_cursor":string|null}. Use limit=100 and pass next_cursor back as cursor until has_more is false. - Only use query parameters listed in openapi.json; unknown ones are a 400. - Related objects are linked by *_id fields and query filters (?round_id=...), never nested paths. - Fields are snake_case, always present, and null when unknown. Timestamps are ISO 8601 UTC. - On 429, wait Retry-After seconds and retry. Retry 500 and 503 with backoff. Do not retry other 4xx; branch on error.code. - Request only the scopes the task needs: rounds:read, reports:read, plans:read, clubs:read. Task: ``` ## Tips - **Give the agent a key with narrow scopes.** A key for a scoring dashboard needs only `rounds:read`. - **Let it check the key first.** `GET /v1/me` returns the key's scopes, so an agent can confirm it has what it needs before it starts. - **Ask for the samples' language.** Every page has curl, TypeScript (Node 20+, built-in `fetch`), and Python (`requests`) versions of the same request. Ask the agent to match one.