-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathopenapi.yaml
More file actions
720 lines (692 loc) · 25 KB
/
openapi.yaml
File metadata and controls
720 lines (692 loc) · 25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
openapi: 3.0.3
info:
title: The Reep Register
description: |
The football entity register. Resolve player, team, coach, competition, season, and match IDs across
Transfermarkt, FBref, Sofascore, Understat, WhoScored, and 40+ data providers.
638,000+ entities (400K+ players, 144K+ matches, 45K+ teams, 43K+ coaches,
3K+ seasons, 200+ competitions) with cross-provider ID mappings sourced from
Wikidata and custom verified sources. Updated weekly.
Every entity has a stable Reep ID (`reep_<type_prefix><8hex>`) as the canonical
identifier. Wikidata QIDs are available as a convenience field where the entity
exists in Wikidata.
Reep IDs are immutable: once shipped to prod, an ID keeps resolving to the same
real-world entity forever. When an entity is re-canonicalised or merged, its old
`reep_id` redirects to the canonical entity via `_deprecated` / `_canonical_id`
meta fields on the `/lookup` response — so cached IDs never break.
People who are both players and coaches (e.g. Pep Guardiola) have separate
records with type-specific Reep IDs. The unique key is `reep_id`.
All data is open source: https://github.com/withqwerty/reep
version: 2.7.0
contact:
name: withqwerty
url: https://github.com/withqwerty/reep
servers:
- url: https://reep-api.rahulkeerthi2-95d.workers.dev
paths:
/search:
get:
operationId: searchEntities
summary: Search entities by name
description: |
Full-text search across players, teams, coaches, and competitions by name or alias.
Seasons and matches are excluded from default search to avoid noise; use `type=season`
or `type=match` explicitly when you want those entity classes.
Uses prefix matching with BM25 relevance ranking (e.g. "Cole Palm" matches "Cole Palmer").
Diacritics-insensitive ("Muller" matches "Müller").
parameters:
- name: name
in: query
required: true
schema:
type: string
example: Cole Palmer
description: Name to search for (prefix matching on name and aliases)
- name: type
in: query
required: false
schema:
type: string
enum: [player, team, coach, competition, season, match]
description: Filter by entity type
- name: limit
in: query
required: false
schema:
type: integer
default: 25
maximum: 100
description: Maximum results to return
- name: targets
in: query
required: false
schema:
type: string
example: wyscout,fbref
description: |
Comma-separated list of provider names to include in `external_ids`.
When omitted, the full cross-provider ID map is returned.
When set, only the named providers appear in `external_ids`, and the `qid`
convenience field is populated only if `wikidata` is in the list.
Unknown provider names are silently ignored. Useful for trimming response
size when you only need one or two target IDs per match.
responses:
"200":
description: Search results ranked by relevance
content:
application/json:
schema:
$ref: "#/components/schemas/SearchResponse"
example:
results:
- reep_id: reep_p2804f5db
qid: Q99760796
type: player
name_en: Cole Palmer
aliases_en: Cole Jermaine Palmer
date_of_birth: "2002-05-06"
nationality: United Kingdom
position: midfielder
position_detail: Attacking Midfield
external_ids:
wikidata: Q99760796
transfermarkt: "568177"
fbref: dc7f8a28
sofascore: "982780"
soccerway: "525801"
count: 1
"400":
description: Missing or invalid parameters
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/lookup:
get:
operationId: lookupById
deprecated: true
summary: Look up entity by Reep ID or Wikidata QID
description: |
**Deprecated.** Prefer `POST /batch/resolve` with a one-element `items` array, or
`GET /search` when you only have a name. This endpoint remains functional but is
not the recommended path for new integrations.
Exact lookup by Reep ID or Wikidata QID. The ID type is auto-detected:
- `reep_p...` / `reep_t...` / `reep_c...` / `reep_l...` / `reep_s...` / `reep_m...` → Reep ID lookup
- `Q...` → Wikidata QID lookup (may return multiple records for dual-role people)
Also accepts the legacy `?qid=` parameter for backwards compatibility.
parameters:
- name: id
in: query
required: true
schema:
type: string
example: reep_p2804f5db
description: Reep ID (reep_p...) or Wikidata QID (Q...)
- name: type
in: query
required: false
schema:
type: string
enum: [player, team, coach, competition, season, match]
description: Filter by entity type (only needed for QID lookups with dual-role people)
responses:
"200":
description: |
Entity details. When the client asked for a retired `reep_id`
that has a canonical successor, the response body carries the
canonical entity's fields with `_deprecated`, `_canonical_id`,
and `_deprecated_at` attached. Provider-id lookups (QIDs)
redirect silently — no deprecation meta.
content:
application/json:
schema:
$ref: "#/components/schemas/LookupResponse"
"400":
description: Missing id parameter
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"410":
description: |
The requested `reep_id` was retired with no canonical successor.
Body contains `_deprecated: true`, `_canonical_id: null`, and
`_deprecated_reason`. Applies only to direct `reep_id` lookups;
provider-id paths surface retirement as 200 with empty results.
content:
application/json:
schema:
type: object
required: [_deprecated, _canonical_id, _deprecated_at, _deprecated_reason]
properties:
_deprecated:
type: boolean
enum: [true]
_canonical_id:
type: string
nullable: true
enum: [null]
_deprecated_at:
type: string
_deprecated_reason:
type: string
enum: [retired, chain_depth_exceeded, canonical_missing]
/resolve:
get:
operationId: resolveProviderId
deprecated: true
summary: Resolve a provider ID to all other IDs
description: |
**Deprecated.** Prefer `POST /batch/resolve` — it accepts a one-element `items`
array and supports the `targets` parameter for response narrowing. This endpoint
remains functional but is not the recommended path for new integrations.
Given a provider name and ID, find the entity and return all cross-provider IDs.
Provider namespaces are not globally type-unique, so `type` is available when you
need to disambiguate IDs that exist across multiple entity classes.
parameters:
- name: provider
in: query
required: true
schema:
$ref: "#/components/schemas/ProviderName"
example: transfermarkt
description: Source provider name
- name: id
in: query
required: true
schema:
type: string
example: "568177"
description: ID from the source provider
- name: type
in: query
required: false
schema:
type: string
enum: [player, team, coach, competition, season, match]
description: Optional entity type disambiguator for provider IDs reused across types
responses:
"200":
description: Resolved entity with all provider IDs
content:
application/json:
schema:
$ref: "#/components/schemas/LookupResponse"
"400":
description: Missing provider or id parameter
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"409":
description: Multiple entities share the same provider ID across different types
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/batch/lookup:
post:
operationId: batchLookup
deprecated: true
summary: Look up multiple IDs in one request
description: |
**Deprecated.** Prefer `POST /batch/resolve` for all bulk lookups — it is
provider-aware, supports the `targets` parameter for response narrowing,
and echoes each input back in the `from` field for easy correlation.
Batch lookup by Reep IDs or Wikidata QIDs. Accepts a mix of both.
A single QID may return multiple records if the person is both a player and coach.
Results are flattened into a single array, so the response `count` may exceed
the number of `ids` in the request. Maximum 100 IDs per request.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [ids]
properties:
ids:
type: array
items:
type: string
minItems: 1
maxItems: 100
description: Array of Reep IDs or Wikidata QIDs
example:
ids: ["reep_p2804f5db", "Q11893"]
responses:
"200":
description: Batch lookup results
content:
application/json:
schema:
$ref: "#/components/schemas/BatchLookupResponse"
"400":
description: Invalid body, empty ids array, or exceeds 100 ID limit
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/batch/resolve:
post:
operationId: batchResolve
summary: Resolve one or more provider IDs to entities (primary endpoint)
description: |
The primary bulk translation endpoint. Given a list of `(provider, id, type?)` items,
returns the matching entities. Use this both for single lookups (one-element array)
and bulk translation (up to 100 per request).
**Translation workflow** — to translate N Opta IDs into Wyscout IDs in one call:
```
POST /batch/resolve
{ "items": [{"provider": "opta", "id": "..."}, ...],
"targets": ["wyscout"] }
```
Each result's `external_ids` will contain only the requested target providers,
dramatically reducing payload size. The `from` field on every result echoes
the input so callers can correlate regardless of array order or `not_found` gaps.
**Error handling** — malformed items return inline errors (`missing_fields`,
`unknown_provider`, `not_found`) rather than failing the whole batch. The
response `count` always equals `items.length`; position is preserved.
Maximum 100 items per request.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
type: object
required: [provider, id]
properties:
provider:
$ref: "#/components/schemas/ProviderName"
id:
type: string
type:
type: string
enum: [player, team, coach, competition, season, match]
description: Optional entity type disambiguator for reused provider IDs
minItems: 1
maxItems: 100
targets:
type: array
items:
$ref: "#/components/schemas/ProviderName"
description: |
Optional filter on response `external_ids`. When provided, each
matched entity's `external_ids` will contain only the named providers,
and the `qid` convenience field is populated only if `wikidata` is in
the list. Unknown provider names are silently ignored. Useful for
trimming response size when you only need one or two target IDs per
translation.
example:
items:
- provider: transfermarkt
id: "568177"
- provider: fbref
id: dea698d9
targets: ["wyscout", "sofascore"]
responses:
"200":
description: Batch resolve results. Position is preserved, `count` equals `items.length`.
content:
application/json:
schema:
$ref: "#/components/schemas/BatchResolveResponse"
example:
results:
- from: {provider: transfermarkt, id: "568177"}
reep_id: reep_p2804f5db
type: player
name_en: Cole Palmer
external_ids:
wyscout: "569823"
sofascore: "982780"
- from: {provider: fbref, id: dea698d9}
error: not_found
count: 2
"400":
description: Invalid body, empty items array, or exceeds 100 item limit
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/stats:
get:
operationId: getStats
summary: Database statistics
description: Returns entity counts by type and ID coverage by provider.
responses:
"200":
description: Statistics
content:
application/json:
schema:
$ref: "#/components/schemas/StatsResponse"
components:
schemas:
ProviderName:
type: string
description: |
Name of a supported data provider. Sourced from `VALID_PROVIDERS` in the worker.
Update this list whenever a new provider is added.
enum:
- wikidata
- transfermarkt
- transfermarkt_manager
- fbref
- fbref_verified
- soccerway
- sofascore
- flashscore
- opta
- opta_numeric
- optacore
- premier_league
- 11v11
- espn
- national_football_teams
- worldfootball
- soccerbase
- kicker
- uefa
- lequipe
- fff_fr
- serie_a
- besoccer
- footballdatabase_eu
- eu_football_info
- hugman
- german_fa
- statmuse_pl
- sofifa
- soccerdonna
- dongqiudi
- playmakerstats
- understat
- whoscored
- clubelo
- sportmonks
- api_football
- fotmob
- thesportsdb
- impect
- wyscout
- skillcorner
- heimspiel
- capology
Entity:
type: object
properties:
reep_id:
type: string
description: Universal Reep ID (reep_<type_prefix><8hex>). This is the canonical identifier.
qid:
type: string
nullable: true
description: Wikidata QID (convenience field, null for entities not in Wikidata)
type:
type: string
enum: [player, team, coach, competition, season, match]
name_en:
type: string
aliases_en:
type: string
nullable: true
full_name:
type: string
nullable: true
date_of_birth:
type: string
nullable: true
nationality:
type: string
nullable: true
position:
type: string
nullable: true
description: Coarse position (forward, midfielder, defender, goalkeeper). Players only.
position_detail:
type: string
nullable: true
description: Granular position from Transfermarkt (e.g. Centre-Back, Attacking Midfield, Right Winger). Players only.
current_team_reep_id:
type: string
nullable: true
description: Reep ID of current team (players only)
height_cm:
type: number
nullable: true
country:
type: string
nullable: true
description: For teams only
founded:
type: string
nullable: true
description: For teams only
stadium:
type: string
nullable: true
description: For teams only
competition_reep_id:
type: string
nullable: true
description: For seasons only — Reep ID of the parent competition
match_date:
type: string
nullable: true
description: For matches only — ISO date of the fixture
kickoff_utc:
type: string
nullable: true
description: For matches only — ISO kickoff timestamp when known
home_team_reep_id:
type: string
nullable: true
description: For matches only — Reep ID of the home team
away_team_reep_id:
type: string
nullable: true
description: For matches only — Reep ID of the away team
home_score:
type: integer
nullable: true
description: For matches only — final home score when known
away_score:
type: integer
nullable: true
description: For matches only — final away score when known
round_label:
type: string
nullable: true
description: For matches only — provider round label
referee:
type: string
nullable: true
description: For matches only
attendance:
type: integer
nullable: true
description: For matches only
season_label:
type: string
nullable: true
description: For matches only — provider-native season label when no canonical season mapping exists
source:
type: string
description: Provenance (wikidata, opta, etc.)
external_ids:
type: object
additionalProperties:
type: string
description: Map of provider name to external ID (includes wikidata QID)
_deprecated:
type: boolean
description: |
Present and `true` when the client asked for a `reep_id` that has
been retired. The body carries the canonical entity's fields; the
`_canonical_id` meta tells the client the underlying `reep_id` has
moved. Provider-id paths (e.g. `?id=Q42`) redirect silently and do
NOT set this field.
_canonical_id:
type: string
nullable: true
description: |
When `_deprecated=true`, the canonical successor `reep_id`. Null on
a retirement (entity removed with no successor — a 410 Gone body).
_deprecated_at:
type: string
description: ISO timestamp when the retired `reep_id` was soft-deleted.
_deprecated_reason:
type: string
enum: [retired, chain_depth_exceeded, canonical_missing]
description: |
Present on error-shape deprecation responses (410 Gone body). `retired`
= no successor. The other two are defensive fallbacks that should not
surface in normal operation.
SearchResponse:
type: object
properties:
results:
type: array
items:
$ref: "#/components/schemas/Entity"
count:
type: integer
LookupResponse:
type: object
properties:
results:
type: array
items:
$ref: "#/components/schemas/Entity"
count:
type: integer
BatchLookupResponse:
type: object
properties:
results:
type: array
description: |
Flattened list. A single QID input may expand to multiple entities
(e.g. dual-role player/coach), so `count` can exceed the number of
input ids.
items:
oneOf:
- $ref: "#/components/schemas/Entity"
- type: object
description: Error for a reep_id that was not found
required: [id, error]
properties:
id:
type: string
error:
type: string
enum: [not_found]
- type: object
description: |
Gone marker for a reep_id that was retired without a
canonical successor. Mirrors the /lookup 410 body shape
but lives inline in the batch results array.
required: [id, error, _deprecated, _canonical_id, _deprecated_at, _deprecated_reason]
properties:
id:
type: string
error:
type: string
enum: [gone]
_deprecated:
type: boolean
enum: [true]
_canonical_id:
type: string
nullable: true
enum: [null]
_deprecated_at:
type: string
_deprecated_reason:
type: string
enum: [retired, chain_depth_exceeded, canonical_missing]
- type: object
description: Error for a Wikidata QID that was not found
required: [qid, error]
properties:
qid:
type: string
error:
type: string
enum: [not_found]
count:
type: integer
BatchResolveResponse:
type: object
properties:
results:
type: array
description: |
Position-preserved, one result per input item. `count` always equals
the input `items.length`. Every result — success or error — includes
a `from` field echoing the input for correlation.
items:
oneOf:
- allOf:
- type: object
required: [from]
properties:
from:
$ref: "#/components/schemas/FromEcho"
- $ref: "#/components/schemas/Entity"
- type: object
description: Error variant
required: [from, error]
properties:
from:
$ref: "#/components/schemas/FromEcho"
error:
type: string
enum: [not_found, missing_fields, unknown_provider, unknown_type, ambiguous]
types:
type: array
items:
type: string
description: Present on `ambiguous` results to show the matching entity classes
count:
type: integer
FromEcho:
type: object
description: Echo of the input `(provider, id)` pair so callers can correlate results.
required: [provider, id]
properties:
provider:
type: string
id:
type: string
type:
type: string
nullable: true
StatsResponse:
type: object
properties:
total_entities:
type: integer
by_type:
type: object
additionalProperties:
type: integer
by_provider:
type: object
additionalProperties:
type: integer
custom_ids_count:
type: integer
ErrorResponse:
type: object
properties:
error:
type: string
description: Error message