# USA Foosball — Club Results Integration API **Version 2.** A club's own software (its website, app or bracket program) sends each finished foosball tournament to USA Foosball. It goes up as a first-class tournament: full bracket, every match, standings and podium on a public web page, and it counts in the USA Foosball Points Race. Canonical URL for this document: --- ## If you are an AI implementing this integration, read this section first If a person pasted you the prompt from usafoosball.com/integrations, follow its steps; this document is the reference. You are building a **reporter** into the club's own software: one function that turns a finished tournament from the project's data into one JSON body, and a hook that sends it the moment a tournament finishes. There is one call to make, and a test endpoint to make it against first. Five things determine whether you succeed: 1. **You describe what happened, not how the bracket looked.** You never send rounds, positions or bracket slots for elimination play. You send a flat list of matches, each naming the two teams that played and who won. USA Foosball regenerates the bracket with the same code that runs tournaments on usafoosball.com and replays your results through it. 2. **You invent your own IDs.** Players and teams are joined by short `ref` strings you make up (`"p1"`, `"t3"`, anything stable within the body). They exist only inside the request. `external_ref` is different: it's the project's own tournament ID, so a corrected tournament sent again replaces the one that's up. 3. **Seeding must reproduce the real pairings.** Because the bracket is regenerated, the order of `teams[]` has to produce the matchups that actually happened. See [Seeding](#seeding-the-one-thing-that-actually-bites). 4. **`final_places` comes from the project's own standings.** Read the finishing order the club's software shows, never work it out from the matches. We replay your matches and compare our places with yours: that's how we know the results are right. See [final_places](#final_places). 5. **You test until every answer is ready.** `POST /tournaments/test` takes exactly what a real send takes and never saves anything. It answers `"ready": true` only when every check passes. A real send runs the same checks and refuses what fails. See [Testing](#testing). Everything you need is here. There is no SDK, and you don't need one: it's one HTTP POST with a JSON body. --- ## Base URL and authentication ``` https://foos-api.com/api/v1/integrations ``` Every request needs the club's key in a header: ``` X-Club-Api-Key: ``` `Authorization: Bearer ` works too. A key belongs to exactly one club and can only ever write to that club. Every club has one: its admins find it at , and can make a new one there at any time, which stops the old one at once. **Keep the key out of the code.** Read it from an environment variable named `USA_FOOSBALL_API_KEY`, put that name (not the key) in the project's example env file, and keep the key itself in a local env file that git ignores. **Check the key** with `GET /schema`. It answers `200` and names the key's club: ```json { "club": { "id": 35, "name": "Brickyard Foosball Club", "url": "https://usafoosball.com/clubs/35" }, "version": 2, "...": "..." } ``` A missing, wrong or revoked key is a `401`: ```json { "error": "unauthorized", "message": "Missing or invalid X-Club-Api-Key." } ``` --- ## Endpoints | Method | Path | What it does | |---|---|---| | `GET` | `/schema` | Names the key's club, and gives the enums and an example body per format. | | `POST` | `/tournaments/test` | **The test.** Builds the tournament, replays every match, runs the checks. Never saves anything. | | `POST` | `/tournaments` | **The real send.** The same checks; it goes up only when every one passes. | | `GET` | `/tournaments/:external_ref` | Read back what's up, with its links. | | `DELETE` | `/tournaments/:external_ref` | Take it down completely, points and all. | | `POST` | `/matches` | One result on its own (see [Single match](#single-match-shortcut)). | | `POST` | `/raw_results` | Results in any shape, for a person to post (see [Send it raw](#if-it-wont-go-in-send-it-raw)). | `POST /tournaments?dry_run=1` (or `"dry_run": true` in the body) is the test under its old name. `/schema` is generated from the running code, so if this document and `/schema` ever disagree, `/schema` wins. --- ## Building it into your software - **Send on finish.** Right after a tournament finishes in the club's software, build the body and `POST /tournaments`. Only finished tournaments: there is no live feed. - **Never hold up the club's software.** Send in the background (a job, a queue, a deferred task, whatever the project already uses). A slow or failed send must never stop the software finishing its own tournament. - **Retry, then log.** Retry a send that fails on the network or with a `5xx` a few times with a back-off. A `422` won't change by retrying: log the answer's `message` (it names what differs) so a person can fix it. - **Corrections are a resend.** The same `external_ref` sent again replaces the tournament that's up, standings and points included. Send again whenever a result is corrected in the club's software. - **Keep a test you can run again.** A script or test that sends a few real finished tournaments to `POST /tournaments/test` and expects `"ready": true` from each. - **A way to turn it off.** An env var or setting that skips the send. Making a new key at usafoosball.com/integrations/api-key stops the old one at once. --- ## The mental model ``` your JSON ──▶ players[] ──▶ club guests, or linked USA Foosball accounts teams[] ──▶ a seeded bracket, regenerated by USA Foosball matches[] ──▶ results replayed in order, advancing winners final_places[] ──▶ compared with the places the replay gives │ ▼ a real, completed USA Foosball tournament (bracket, standings, podium, Points Race points) ``` USA Foosball doesn't store your bracket layout. It stores the facts (who played, who won, the score) and derives the bracket, the advancement, the standings and the champion itself. That's why the result looks the same as a tournament run on usafoosball.com, and why your own standings can be checked against it. --- ## The envelope ```jsonc { "external_ref": "spring-open-2026", // REQUIRED. Your own tournament ID. Sending it again replaces. "name": "Spring Open 2026", // REQUIRED. Display name. "format": "double_elim", // REQUIRED. See enums below. "tournament_type": "dyp", // REQUIRED. See enums below. "played_at": "2026-04-11T18:00:00Z", // Recommended. ISO 8601, when it was played. "settings": { "monster": { } }, // Monster format only. "players": [ ], // REQUIRED. "teams": [ ], // REQUIRED except Monster points-only. "matches": [ ], // REQUIRED. "final_places": [ ] // REQUIRED. Your software's own finishing order. } ``` ### Enums | Field | Allowed values | |---|---| | `format` | `single_elim`, `double_elim`, `round_robin`, `monster` | | `tournament_type` | `dyp`, `bring_partner`, `singles` | | `skill_level` | `a_player`, `b_player`, `c_player` | | `settings.monster.advancement` | `points_only`, `top_4`, `top_8`, `top_16` | `tournament_type` is how teams were formed, not the bracket: `dyp` is draw your partner, `bring_partner` is fixed pairs, `singles` is one player per team. Singles counts in the Points Race's singles; the other two count in doubles. Swiss isn't importable yet (see [Not supported yet](#not-supported-yet)). `played_at` sets when the tournament was played, so one from last year goes in on its own day rather than today. The day it counts on is that time in the club's own time zone. Leave it out and it's today. --- ## `players[]` Every person in the tournament, listed once. ```jsonc { "ref": "p1", // REQUIRED. Unique within this body. You invent it. "name": "Alex Río", // REQUIRED unless user_id is given. "user_id": 4821, // Optional. A known USA Foosball account id. "ifp_player_id": 20626, // Optional. An IFP player id. "skill_level": "a_player" // Optional. a_player | b_player | c_player. } ``` How a player is resolved, in order: - **`user_id`**: links the real USA Foosball account. If the id doesn't exist the whole body is refused. - **`ifp_player_id`**: links the USA Foosball account that has claimed that IFP player. Most IFP players haven't, so this usually falls through to the next case; that's expected. - **Otherwise**: the player goes in as a guest of the club under `name`. This is the normal path. Guests show on the bracket, standings and public pages, and a player can later claim the guest as themselves; their Points Race points follow the claim. `skill_level` also takes `"a"`, `"b"`, `"c"`. Any other value is ignored rather than refused. --- ## `teams[]` The competing units. Required for `single_elim`, `double_elim` and `round_robin`. For Monster it lists only the **knockout** teams, and is left out entirely for points-only Monster. ```jsonc { "ref": "t1", // REQUIRED. Unique within this body. "player_refs": ["p1", "p2"], // REQUIRED. One ref for singles, two for doubles. "seed": 1, // Optional. Defaults to the array index + 1. "name": "Río / Okafor" // Optional. Made from the player names otherwise. } ``` At least two teams are required. --- ## `matches[]` The shape depends on the format. Elimination and round robin use one shape; Monster qualifying uses another. Any match may carry its own `"ref"` (your match ID); our answers then name it. ### Elimination and round robin ```jsonc { "ref": "m7", // Optional. Your ID for the match, so our answers can name it. "team_refs": ["t1", "t4"], // REQUIRED. Exactly the two teams that played. "winner_ref": "t1", // REQUIRED. One of team_refs. "team1_score": 7, // Optional. Score for team_refs[0]. "team2_score": 4, // Optional. Score for team_refs[1]. "games": [ // Optional. Per-game detail, in team_refs order. { "game_number": 1, "team1_score": 7, "team2_score": 5 }, { "game_number": 2, "team1_score": 4, "team2_score": 7 }, { "game_number": 3, "team1_score": 7, "team2_score": 2 } ] } ``` Rules that matter: - **Don't send `round`, `position` or `bracket`.** They're ignored. The bracket is regenerated. - **Don't send byes.** A match naming fewer than two teams is skipped and not counted. Byes are made automatically when the team count isn't a power of two. - **Scores are optional but recommended.** They're stated in `team_refs` order and re-oriented for you. In a round robin, goals break ties (see [How we place a tie](#how-we-place-a-tie)), so send them. - **`winner_ref` is required even with scores.** It decides who advances. - **Order matters whenever the same two teams meet more than once.** Results are matched to the regenerated bracket by unordered team pair and used in the order you list them. In double elimination one pair can meet up to three times (the winners final, the grand final and the reset), so list those results in the order they were played. - **Double elimination's grand-final reset.** The losers-bracket team arrives with one loss and has to beat the winners-bracket team twice. If they win the grand final, send the reset as the next result for the same pair. If the winners-bracket team wins the grand final, there's no reset. - **Every match you send must be used.** A result the regenerated bracket has no place for (a third grand-final game, a reset after the winners-bracket team closed it out) fails the `all_matches_used` check, naming the match. ### The match for 3rd place When the two semifinal losers played each other for 3rd and 4th, send that match with `"bracket": "third_place"` (the one place `bracket` is read outside a Monster): ```jsonc { "ref": "m15", "bracket": "third_place", "team_refs": ["t2", "t5"], "winner_ref": "t5" } ``` - Single elimination and a Monster's knockout only, with four or more teams. Double elimination's losers bracket already decides 3rd and 4th, so a `third_place` match there fails `all_matches_used`. - Sending one gives the regenerated bracket its 3rd-place match: its winner finishes 3rd and its loser 4th, so `final_places` names them 3 and 4. Leave it out and both semifinal losers tie for 3rd. - Send at most one, and only if it was played. ### Monster qualifying Monster rotates partners every round, so its qualifying matches name *players* directly and there's no `teams[]` entry for them. ```jsonc { "bracket": "monster_qualifying", // REQUIRED. This exact literal. "round": 1, // REQUIRED. Integer >= 1. "position": 1, // REQUIRED. Integer >= 1, unique in the round. "team1_player_refs": ["p1", "p2"], // REQUIRED. The partners on side 1. "team2_player_refs": ["p3", "p4"], // REQUIRED. The partners on side 2. "team1_score": 7, // REQUIRED. Monster scores are mandatory. "team2_score": 5 // REQUIRED. } ``` Monster scores are checked against the race and a wrong score is refused. For `race_to: N`: - The winner's score must be exactly `N`; the loser's must be `0` to `N-1`. - A tie is only legal as `N-1` to `N-1`, and only when `allow_ties` is `true`. ### Monster knockout The elimination shape, with `"bracket": "winners"` (or `losers`, `grand_finals`, `third_place`) and `team_refs` pointing at entries in `teams[]`. Send these only when `settings.monster.advancement` is `top_4`, `top_8` or `top_16`. --- ## `final_places[]` **Required.** The finishing order the club's own software shows, by team ref, best first: ```json "final_places": [ { "place": 1, "team": "t3" }, { "place": 2, "team": "t1" }, { "place": 3, "team": "t5" }, { "place": 3, "team": "t2" } ] ``` A Monster places players: `{ "place": 1, "player": "p4" }`. - **Read it from the project's standings, never work it out from the matches.** If you derive it from the matches, the check only compares our replay with itself and proves nothing. - **Ties share a place.** Two teams tied for 3rd are both `"place": 3`. - **Send at least the top 4** (every team that finished 4th or better here, ties included). Places past what a format decides (5th to 8th in an elimination) may be left out; every place you do send has to match. - Each ref once; a ref has to be in `teams[]` (Monster: in `players[]`). ### How we place a tie We replay your matches and place every entry. Where we tie entries, your place for each may be any of the places the tie spans: two teams tied 3rd here can be sent as 3 and 3, or 3 and 4. - **Elimination:** the champion 1st, the final's loser 2nd. Below that, teams knocked out in the same round tie (single elimination: both semifinal losers 3rd, unless they played the match for 3rd; double elimination: by the losers-bracket round they went out in). - **Round robin:** by wins, then match win percentage, then goal percentage, then the results between the teams still level, then goal difference. Teams level on all of those can be sent in either order. - **Monster:** by points per game (2 a win, 1 a tie), then wins per game, fewest losses per game, goal difference per game, then the points earned in games among the players still level. Players level on all of those can be sent in either order. With a knockout, its entries place first and everyone else follows by the qualifying board. If the club's software breaks a tie another way, the check fails and says where. Don't change `final_places` to pass: tell the person, because the standings on usafoosball.com would read differently from theirs. --- ## Monster settings ```jsonc "settings": { "monster": { "race_to": 7, // Points target per qualifying match. "allow_ties": false, "win_by_2": false, "advancement": "points_only", // points_only | top_4 | top_8 | top_16 "knockout_format": "single_elim" } } ``` `qualifying_rounds` is taken from the highest `round` in your qualifying matches, so you don't need to send it. With `points_only`, the tournament ends on the qualifying board and the champion is the points leader. With any `top_N`, also send `teams[]` for the knockout and the knockout matches. --- ## Seeding: the one thing that actually bites The order of `teams[]` (or the explicit `seed` on each) is the seeding. USA Foosball places them with standard tournament seeding: the 1 and 2 seeds at opposite ends of the bracket, the next pair on the quarter anchors, and so on, so the strongest can't meet until late. Then your results are matched to the regenerated matches **by team pair**. So **your seeds must produce the pairings that actually happened.** If the tournament used standard seeding, sending the real seeds reproduces it exactly. If the bracket was drawn some other way (say seeds 1 and 2 met in round one), the regenerated bracket has a match you have no result for, and the test fails `all_matches_used`: ``` The bracket needs a result for WB-R1-M2 (Río / Okafor vs Bell / Nakamura), and none of your matches is that pair. Check the seeding (the spec's Seeding section). ``` That names the pairing the bracket expected. Adjust the order of `teams[]` until the test passes. Because the test never saves, you can try as often as you need. Round robin has no seeding: every team plays every other, so any order works. Send every match. --- ## Corrections: `external_ref` `external_ref` is your key, unique per club. Use the project's own tournament ID. Sending the same `external_ref` again **replaces the tournament that's up** with the new one, standings and Points Race points included. There's no PATCH and you never need one. Don't use a timestamp or a random value, or every send makes a duplicate tournament. --- ## Testing ```bash curl -X POST 'https://foos-api.com/api/v1/integrations/tournaments/test' \ -H "X-Club-Api-Key: $USA_FOOSBALL_API_KEY" \ -H 'Content-Type: application/json' \ -d @tournament.json ``` The test does the whole import (the players, the teams, the bracket, every result replayed, the standings, the points) inside a transaction that always rolls back, then runs the checks. Nothing is saved and no links are handed back. Test with real finished tournaments from the project, at least three and one of every format the club runs, and fix the reporter until every one is ready. ### The checks They run in this order, on the test and on every real send: | `check` | Passes when | When it fails, `detail` says | |---|---|---| | `shape` | the body fits this spec | what's wrong ("final_places[] is required", "team 't2' references unknown player 'p9'") | | `all_matches_used` | every match you sent was played into the bracket, and the bracket finished | "3 of your 15 matches didn't fit the bracket: m7 (t3 vs t5), m9 (t1 vs t2), m12 (t4 vs t6). Check the seeding…", or the match the bracket needed | | `final_places` | the places from the replay equal yours (ties as above) | "You say t3 finished 1st. Replaying your matches, t5 did." (the first difference, then how many more) | | `not_entered_by_hand` | the club didn't already enter that day's places by hand | "Brickyard Foosball Club entered Nov 12's doubles places by hand. Remove them at usafoosball.com/clubs/35/results, or don't send this one." | | `replaces` | always | "New tournament." or "Replaces "Spring Open", sent Nov 3." | When `shape` fails, the others don't run. When the bracket can't be finished, `all_matches_used` fails and the rest don't run. ### The answer `200` when it's ready; `422` with the same shape when it isn't. ```json { "ok": true, "ready": true, "saved": false, "club": { "id": 35, "name": "Brickyard Foosball Club" }, "checks": [ { "check": "all_matches_used", "ok": true, "detail": "3 of 3 matches." }, { "check": "final_places", "ok": true, "detail": "1st to 3rd match yours." }, { "check": "not_entered_by_hand", "ok": true }, { "check": "replaces", "ok": true, "detail": "New tournament." } ], "tournament": { "external_ref": "thursday-dyp-2026-04-09", "name": "Thursday Night DYP", "played_at": "2026-04-09T23:00:00Z", "format": "single_elim", "tournament_type": "dyp", "player_count": 8, "team_count": 4, "match_count": 3 }, "standings": [ { "place": 1, "tied": false, "team": "t1", "players": [ { "ref": "p1", "name": "Alex Río", "account": true }, { "ref": "p2", "name": "Dana Okafor", "account": false } ] }, { "place": 2, "tied": false, "team": "t3", "players": [ "…" ] }, { "place": 3, "tied": true, "team": "t2", "players": [ "…" ] }, { "place": 3, "tied": true, "team": "t4", "players": [ "…" ] } ], "points_race": { "counts": true, "level": 10, "discipline": "doubles", "played_on": "2026-04-09", "players": [ { "ref": "p1", "name": "Alex Río", "place": 1, "points": 10, "earns": "now" }, { "ref": "p2", "name": "Dana Okafor", "place": 1, "points": 10, "earns": "when they claim it" }, "…" ] }, "links": null } ``` - `ok` is false only when the body itself is wrong (`shape`). `ready` is `ok` and every check passing. `saved` is true only on a real send that went up. - A failed answer adds `"error": "check_failed"` (or `"invalid_request"` for `shape`) and `message`, the first failing check's `detail`. - `links` is `null` on the test, because the tournament it built is gone. Only a real send's links open. --- ## The real send `POST /tournaments`, the same body. It runs the same checks first and **refuses what fails** (`422`, the same answer, nothing saved), so a wrong result never goes up. When every check passes it saves and answers the same shape with: ```json { "ok": true, "ready": true, "saved": true, "created": true, "replaced": false, "tournament": { "id": 812, "external_ref": "spring-open-2026", "status": "completed", "…": "…" }, "links": { "web_url": "https://usafoosball.com/tournaments/812", "bracket_url": "https://usafoosball.com/tournaments/812/bracket", "standings_url": "https://usafoosball.com/tournaments/812/standings" } } ``` `201` when it's new; `200` when it replaced the one with the same `external_ref`. The links are public and shareable at once. `web_url` is the tournament's page, bracket first. `bracket_url` is the bracket's own stable address: it opens that same page today, and it's the one to share for "the bracket". `standings_url` opens the standings. Add `?embed=1` to `bracket_url` for the bracket alone, to put in an iframe on your own site. **When a real send is refused** (`422`, `"error": "check_failed"`), the tournament isn't up and resending the same body won't change that. Log the answer's `message` (it names what's wrong) and leave it for a person: either your software's results for that tournament need fixing (then send it again), or it's a format the importer doesn't take (then send it raw, below). Retry only a send that didn't get an answer, or got a `5xx`. ### Reading it back `GET /tournaments/:external_ref` answers what's up now, with its links. It's a read, so it has no `ready`, `saved` or `checks`: ```json { "ok": true, "tournament": { "id": 812, "external_ref": "spring-open-2026", "name": "Spring Open 2026", "format": "single_elim", "tournament_type": "dyp", "status": "completed", "completed_at": "2026-04-12T22:00:00Z", "player_count": 8, "team_count": 4, "podium": "…", "points_race_level": 10 }, "links": { "web_url": "…", "bracket_url": "…", "standings_url": "…" } } ``` `404` with `"error": "not_found"` means nothing with that `external_ref` is up for your club. --- ## The Points Race A tournament that goes up counts in the USA Foosball Points Race as a **10**, the same as a club's weekly entered by hand. Every place earns its share of 10, in singles or doubles by `tournament_type`: | Place | 1st | 2nd | 3rd | 4th | 5th–8th | 9th–16th | 17th–32nd | 33rd–64th | 65th–128th | after | |---|---|---|---|---|---|---|---|---|---|---| | Points | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | A tie shares the place it ties for (two teams tied 3rd each earn 3rd's points). A singles tournament counts from 2 players, a doubles one from 2 teams. - Players with a USA Foosball account (`user_id`, or a claimed `ifp_player_id`) earn their points as soon as it's up. Guests earn theirs when they claim the result as themselves. - A resend replaces the points with the new tournament's; a `DELETE` takes them away. - **One way in per day.** A day and discipline the club already entered by hand at usafoosball.com/clubs/:id/results can't also be sent (`not_entered_by_hand`), and a day that came in from the software can't then be entered by hand. Nobody's points count twice. The test's `points_race` shows what each player would earn before anything goes up. --- ## Errors Every failure is JSON. Nothing is ever partly imported: the whole import is one transaction. | HTTP | `error` | Meaning and what to do | |---|---|---| | `401` | `unauthorized` | Missing, wrong or revoked key. Check `X-Club-Api-Key`. | | `422` | `invalid_request` | The body doesn't fit this spec (`shape`). `message` says what. | | `422` | `check_failed` | A check failed. `message` and the failing check's `detail` say what differs. | | `422` | `invalid_json` | The body didn't parse as JSON. Send one JSON object with `Content-Type: application/json`. | | `422` | `import_failed` | Something went wrong on our side. We kept what you sent; tell us. | | `404` | `not_found` | No tournament with that `external_ref` for your club (GET, DELETE). | Messages you're most likely to meet: - `The bracket needs a result for ( vs )…`: a seeding mismatch. See [Seeding](#seeding-the-one-thing-that-actually-bites). - `N of your M matches didn't fit the bracket: …`: a match the bracket had no place for, or a pair that met twice listed out of order. - `You say t3 finished 1st. Replaying your matches, t5 did.`: your standings and the replay differ. Check the matches first; if they're right, see [How we place a tie](#how-we-place-a-tie). - `final_places leaves out t6, who finished 4th replaying your matches.`: send at least the top 4. - `unknown player ref 'pX'` / `team 'tY' references unknown player 'pX'`: a ref in `teams[]` or `matches[]` has no entry in `players[]`. - `MQ-R2-M1: `: an illegal Monster score for the race. --- ## Worked examples Each is a complete, valid body that comes back ready from the test. ### Single elimination, draw your partner, 4 teams ```json { "external_ref": "thursday-dyp-2026-04-09", "name": "Thursday Night DYP", "format": "single_elim", "tournament_type": "dyp", "played_at": "2026-04-09T23:00:00Z", "players": [ { "ref": "p1", "name": "Alex Río" }, { "ref": "p2", "name": "Dana Okafor" }, { "ref": "p3", "name": "Sam Bell" }, { "ref": "p4", "name": "Kit Nakamura" }, { "ref": "p5", "name": "Jordan Vega" }, { "ref": "p6", "name": "Robin Osei" }, { "ref": "p7", "name": "Casey Lund" }, { "ref": "p8", "name": "Morgan Diaz" } ], "teams": [ { "ref": "t1", "seed": 1, "player_refs": ["p1", "p2"] }, { "ref": "t2", "seed": 2, "player_refs": ["p3", "p4"] }, { "ref": "t3", "seed": 3, "player_refs": ["p5", "p6"] }, { "ref": "t4", "seed": 4, "player_refs": ["p7", "p8"] } ], "matches": [ { "ref": "m1", "team_refs": ["t1", "t4"], "winner_ref": "t1", "team1_score": 7, "team2_score": 4 }, { "ref": "m2", "team_refs": ["t2", "t3"], "winner_ref": "t3", "team1_score": 5, "team2_score": 7 }, { "ref": "m3", "team_refs": ["t1", "t3"], "winner_ref": "t1", "team1_score": 7, "team2_score": 6 } ], "final_places": [ { "place": 1, "team": "t1" }, { "place": 2, "team": "t3" }, { "place": 3, "team": "t2" }, { "place": 3, "team": "t4" } ] } ``` Seeds 1 to 4 with standard seeding pair 1 v 4 and 2 v 3, which is what the matches send. Both semifinal losers tie for 3rd. ### Double elimination, fixed partners, with a grand-final reset ```json { "external_ref": "spring-open-2026", "name": "Spring Open 2026", "format": "double_elim", "tournament_type": "bring_partner", "played_at": "2026-04-11T18:00:00Z", "players": [ { "ref": "p1", "name": "Alex Río", "skill_level": "a_player" }, { "ref": "p2", "name": "Dana Okafor", "skill_level": "a_player" }, { "ref": "p3", "name": "Sam Bell", "skill_level": "b_player" }, { "ref": "p4", "name": "Kit Nakamura", "skill_level": "b_player" }, { "ref": "p5", "name": "Jordan Vega" }, { "ref": "p6", "name": "Robin Osei" }, { "ref": "p7", "name": "Casey Lund" }, { "ref": "p8", "name": "Morgan Diaz" } ], "teams": [ { "ref": "t1", "seed": 1, "player_refs": ["p1", "p2"], "name": "Río / Okafor" }, { "ref": "t2", "seed": 2, "player_refs": ["p3", "p4"], "name": "Bell / Nakamura" }, { "ref": "t3", "seed": 3, "player_refs": ["p5", "p6"], "name": "Vega / Osei" }, { "ref": "t4", "seed": 4, "player_refs": ["p7", "p8"], "name": "Lund / Diaz" } ], "matches": [ { "team_refs": ["t1", "t4"], "winner_ref": "t1", "team1_score": 7, "team2_score": 3 }, { "team_refs": ["t2", "t3"], "winner_ref": "t2", "team1_score": 7, "team2_score": 5 }, { "team_refs": ["t1", "t2"], "winner_ref": "t1", "team1_score": 7, "team2_score": 6 }, { "team_refs": ["t4", "t3"], "winner_ref": "t3", "team1_score": 4, "team2_score": 7 }, { "team_refs": ["t2", "t3"], "winner_ref": "t2", "team1_score": 7, "team2_score": 2 }, { "team_refs": ["t1", "t2"], "winner_ref": "t2", "team1_score": 5, "team2_score": 7 }, { "team_refs": ["t1", "t2"], "winner_ref": "t1", "team1_score": 7, "team2_score": 4 } ], "final_places": [ { "place": 1, "team": "t1" }, { "place": 2, "team": "t2" }, { "place": 3, "team": "t3" }, { "place": 4, "team": "t4" } ] } ``` `t1` v `t2` appears three times, the most possible, which is why result order matters. Bell / Nakamura lose the winners final, come through the losers bracket and win the grand final, but that only levels it, because they carried a loss into it. The reset decides the title, and Río / Okafor take it. Listed in play order, those three results are used as winners final, grand final, reset. Reverse any two and the champion is wrong, and the test says so in `final_places`. Had Río / Okafor simply won the grand final, there'd be no reset to send and the body would stop at six matches. ### Round robin, singles ```json { "external_ref": "monday-singles-league-w14", "name": "Monday Singles — Week 14", "format": "round_robin", "tournament_type": "singles", "played_at": "2026-04-06T23:30:00Z", "players": [ { "ref": "p1", "name": "Alex Río" }, { "ref": "p2", "name": "Dana Okafor" }, { "ref": "p3", "name": "Sam Bell" }, { "ref": "p4", "name": "Kit Nakamura" } ], "teams": [ { "ref": "t1", "player_refs": ["p1"] }, { "ref": "t2", "player_refs": ["p2"] }, { "ref": "t3", "player_refs": ["p3"] }, { "ref": "t4", "player_refs": ["p4"] } ], "matches": [ { "team_refs": ["t1", "t2"], "winner_ref": "t1", "team1_score": 7, "team2_score": 5 }, { "team_refs": ["t1", "t3"], "winner_ref": "t1", "team1_score": 7, "team2_score": 2 }, { "team_refs": ["t1", "t4"], "winner_ref": "t1", "team1_score": 7, "team2_score": 6 }, { "team_refs": ["t2", "t3"], "winner_ref": "t2", "team1_score": 7, "team2_score": 4 }, { "team_refs": ["t2", "t4"], "winner_ref": "t2", "team1_score": 7, "team2_score": 6 }, { "team_refs": ["t3", "t4"], "winner_ref": "t4", "team1_score": 3, "team2_score": 7 } ], "final_places": [ { "place": 1, "team": "t1" }, { "place": 2, "team": "t2" }, { "place": 3, "team": "t4" }, { "place": 4, "team": "t3" } ] } ``` For singles, each team holds one player ref. These results give a clean 3-0, 2-1, 1-2, 0-3 table. ### Monster, points only, 8 players over 3 rounds ```json { "external_ref": "monster-2026-04-14", "name": "Tuesday Monster", "format": "monster", "tournament_type": "dyp", "played_at": "2026-04-14T23:00:00Z", "settings": { "monster": { "race_to": 7, "allow_ties": false, "win_by_2": false, "advancement": "points_only" } }, "players": [ { "ref": "p1", "name": "Alex Río" }, { "ref": "p2", "name": "Dana Okafor" }, { "ref": "p3", "name": "Sam Bell" }, { "ref": "p4", "name": "Kit Nakamura" }, { "ref": "p5", "name": "Jordan Vega" }, { "ref": "p6", "name": "Robin Osei" }, { "ref": "p7", "name": "Casey Lund" }, { "ref": "p8", "name": "Morgan Diaz" } ], "matches": [ { "bracket": "monster_qualifying", "round": 1, "position": 1, "team1_player_refs": ["p1", "p2"], "team2_player_refs": ["p3", "p4"], "team1_score": 7, "team2_score": 5 }, { "bracket": "monster_qualifying", "round": 1, "position": 2, "team1_player_refs": ["p5", "p6"], "team2_player_refs": ["p7", "p8"], "team1_score": 7, "team2_score": 3 }, { "bracket": "monster_qualifying", "round": 2, "position": 1, "team1_player_refs": ["p1", "p3"], "team2_player_refs": ["p5", "p7"], "team1_score": 7, "team2_score": 4 }, { "bracket": "monster_qualifying", "round": 2, "position": 2, "team1_player_refs": ["p2", "p4"], "team2_player_refs": ["p6", "p8"], "team1_score": 6, "team2_score": 7 }, { "bracket": "monster_qualifying", "round": 3, "position": 1, "team1_player_refs": ["p1", "p5"], "team2_player_refs": ["p2", "p6"], "team1_score": 7, "team2_score": 2 }, { "bracket": "monster_qualifying", "round": 3, "position": 2, "team1_player_refs": ["p3", "p7"], "team2_player_refs": ["p4", "p8"], "team1_score": 1, "team2_score": 7 } ], "final_places": [ { "place": 1, "player": "p1" }, { "place": 2, "player": "p5" }, { "place": 3, "player": "p8" }, { "place": 4, "player": "p6" }, { "place": 5, "player": "p4" }, { "place": 6, "player": "p2" }, { "place": 7, "player": "p3" }, { "place": 8, "player": "p7" } ] } ``` No `teams[]`, because points-only Monster never forms standing teams. Alex wins all three (6 points). Jordan, Morgan and Robin win two each (4 points) and are split by goal difference (+6, +3, 0); Kit, Dana and Sam win one each and split the same way (+3, -4, -5). To add a knockout, set `advancement` to `top_4`, add `teams[]` with the four knockout entries, and add the knockout matches in the elimination shape with `"bracket": "winners"`. --- ## Single match shortcut For a club that only records finals, `POST /matches` builds a small completed tournament from one result. `format` defaults to `single_elim` and `tournament_type` to `dyp`, a single `match` object is taken in place of `matches`, and with one match `final_places` may be left out (the winner is 1st, the other team 2nd). `?dry_run=1` tests it. ```json { "external_ref": "house-final-2026-04-18", "name": "House Final", "players": [ { "ref": "p1", "name": "Alex Río" }, { "ref": "p2", "name": "Dana Okafor" }, { "ref": "p3", "name": "Sam Bell" }, { "ref": "p4", "name": "Kit Nakamura" } ], "teams": [ { "ref": "t1", "player_refs": ["p1", "p2"] }, { "ref": "t2", "player_refs": ["p3", "p4"] } ], "match": { "team_refs": ["t1", "t2"], "winner_ref": "t1", "team1_score": 7, "team2_score": 5 } } ``` It runs through the same importer and checks, so it's replaced by `external_ref` the same way. --- ## Checklist before you go live - [ ] The key comes from `USA_FOOSBALL_API_KEY`, never the code, and `GET /schema` names the club. - [ ] `external_ref` is the project's own tournament ID. - [ ] Every `ref` in `teams[]`, `matches[]` and `final_places[]` exists; every ref is unique. - [ ] Every match has a `winner_ref` that's one of its own `team_refs`. - [ ] No byes, no `round`/`position`/`bracket` on elimination matches. - [ ] `teams[]` order is the real seeding. - [ ] A pairing that met more than once is listed in play order (double elim: the reset after the grand final). - [ ] `final_places` comes from the project's own standings, with at least the top 4. - [ ] At least three real finished tournaments, one of every format the club runs, come back `"ready": true` from `POST /tournaments/test`. - [ ] The person said yes before the first real send. - [ ] The send runs in the background after a tournament finishes, retries, and logs what still fails. --- ## If it won't go in: send it raw Some tournaments won't fit: a format the importer doesn't take (Swiss, a Monster variant, a bracket drawn by hand), seeding you can't reproduce, or results too incomplete to replay. Don't guess, and don't loop forever. After five tests that still fail on the same tournament, send it as it is: ``` POST https://foos-api.com/api/v1/integrations/raw_results X-Club-Api-Key: Content-Type: text/plain (or application/json, or text/csv) ``` The body can be anything readable: the project's own export, a CSV, your best JSON attempt, and a few lines saying what the tournament was (name, date, format, how teams were formed) and why it wouldn't go in. Text only, up to 2 MB. It always answers: ```json { "ok": true, "received": true, "id": 41, "message": "Got it. USA Foosball will post these results by hand and check them with you." } ``` A person at USA Foosball posts it by hand. Every call is kept on our side, including the ones that were refused, so nothing you send is lost. --- ## Not supported yet - **Swiss.** USA Foosball runs Swiss itself, but the importer doesn't take it yet. Send it raw. - **In-progress tournaments.** Only finished ones: every match played needs a result. There's no live, match-by-match feed. - **Editing one match.** Send the whole tournament again with the same `external_ref`; it's a clean replacement. --- ## How a person gets set up 1. **Open the club's key page.** A club's admin signs in at . The club's key is already there, and so is the prompt with the key and the club filled in. 2. **Copy the prompt** into the coding AI that works in the club's project (Cursor, Claude Code, Copilot or another). It reads this document, builds the reporter and tests it here. 3. **Say yes.** Once every test is ready, the AI asks before anything goes live. 4. **Then every tournament reports itself.** Each one the club finishes goes up on usafoosball.com with its bracket and standings links, and counts in the Points Race. Questions: text (302) 377-7797 or email .