# 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 `<resource>_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. |
