fortnite-api-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fortnite_api_sdk-0.1.0/.github/workflows/ci.yml +53 -0
- fortnite_api_sdk-0.1.0/.github/workflows/publish.yml +42 -0
- fortnite_api_sdk-0.1.0/.gitignore +10 -0
- fortnite_api_sdk-0.1.0/.python-version +1 -0
- fortnite_api_sdk-0.1.0/LICENSE +21 -0
- fortnite_api_sdk-0.1.0/PKG-INFO +541 -0
- fortnite_api_sdk-0.1.0/README.md +511 -0
- fortnite_api_sdk-0.1.0/examples/quickstart.py +38 -0
- fortnite_api_sdk-0.1.0/openapi/swagger.json +7471 -0
- fortnite_api_sdk-0.1.0/pyproject.toml +47 -0
- fortnite_api_sdk-0.1.0/scripts/generate.py +574 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/__init__.py +9 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/_transport.py +226 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/client.py +102 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/errors.py +16 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/models.py +236 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/py.typed +0 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/__init__.py +71 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/_base.py +6 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/account.py +128 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/aes.py +32 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/assets.py +32 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/battlepass.py +20 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/calendar.py +19 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/cosmetics.py +47 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/crew.py +32 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/events.py +56 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/fn.py +116 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/friends.py +104 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/map.py +39 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/news.py +56 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/oauth.py +92 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/parsing.py +145 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/playlists.py +44 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/profile.py +80 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/quests.py +20 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/replays.py +124 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/shop.py +19 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/stats.py +44 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/tournaments.py +212 -0
- fortnite_api_sdk-0.1.0/src/fortnite_api/resources/weapons.py +43 -0
- fortnite_api_sdk-0.1.0/tests/test_live.py +39 -0
- fortnite_api_sdk-0.1.0/tests/test_transport.py +59 -0
- fortnite_api_sdk-0.1.0/uv.lock +436 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ci-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Sync dependencies
|
|
28
|
+
run: uv sync --extra dev
|
|
29
|
+
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: uv run ruff check src tests scripts
|
|
32
|
+
|
|
33
|
+
- name: Test
|
|
34
|
+
run: uv run pytest -q
|
|
35
|
+
|
|
36
|
+
build:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Install uv
|
|
42
|
+
uses: astral-sh/setup-uv@v5
|
|
43
|
+
|
|
44
|
+
- name: Build distributions
|
|
45
|
+
run: uv build
|
|
46
|
+
|
|
47
|
+
- name: Check metadata
|
|
48
|
+
run: uvx twine check dist/*
|
|
49
|
+
|
|
50
|
+
- name: Verify generator is up to date
|
|
51
|
+
run: |
|
|
52
|
+
uv run python scripts/generate.py
|
|
53
|
+
git diff --exit-code src/fortnite_api
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Install uv
|
|
14
|
+
uses: astral-sh/setup-uv@v5
|
|
15
|
+
|
|
16
|
+
- name: Build distributions
|
|
17
|
+
run: uv build
|
|
18
|
+
|
|
19
|
+
- name: Check metadata
|
|
20
|
+
run: uvx twine check dist/*
|
|
21
|
+
|
|
22
|
+
- uses: actions/upload-artifact@v4
|
|
23
|
+
with:
|
|
24
|
+
name: dist
|
|
25
|
+
path: dist/
|
|
26
|
+
|
|
27
|
+
publish:
|
|
28
|
+
needs: build
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
environment:
|
|
31
|
+
name: pypi
|
|
32
|
+
url: https://pypi.org/p/fortnite-api-sdk
|
|
33
|
+
permissions:
|
|
34
|
+
id-token: write
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/download-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
- name: Publish to PyPI
|
|
42
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tettu0530
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fortnite-api-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK (sync + async) for the Fortnite API at api-fortnite.com
|
|
5
|
+
Project-URL: Homepage, https://api-fortnite.com
|
|
6
|
+
Project-URL: Repository, https://github.com/Tettu0530/fortnite-api-sdk
|
|
7
|
+
Project-URL: Issues, https://github.com/Tettu0530/fortnite-api-sdk/issues
|
|
8
|
+
Author-email: voredge <dev@voredge.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api,esports,fortnite,sdk,tournaments
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: pydantic>=2.7
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# Fortnite API SDK (Python)
|
|
32
|
+
|
|
33
|
+
Python SDK for the Fortnite API at **[api-fortnite.com](https://api-fortnite.com)** — sync **and** async, fully typed.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv add fortnite-api-sdk # or: pip install fortnite-api-sdk
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The import name is `fortnite_api`:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from fortnite_api import FortniteAPI, AsyncFortniteAPI, FortniteAPIError
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API Key
|
|
48
|
+
|
|
49
|
+
Acquire your API Key by creating a Free Account here: https://api-fortnite.com
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from fortnite_api import FortniteAPI
|
|
55
|
+
|
|
56
|
+
client = FortniteAPI(api_key="your-api-key-here")
|
|
57
|
+
|
|
58
|
+
# Get current shop
|
|
59
|
+
shop = client.shop.get_current()
|
|
60
|
+
|
|
61
|
+
# Get tournament leaderboard
|
|
62
|
+
leaderboard = client.tournaments.get_leaderboard(
|
|
63
|
+
event_id="epicgames_S37_BlitzCupsAllPlatforms_BR",
|
|
64
|
+
event_window_id="S37_BlitzCupsAllPlatforms_Event1_BR",
|
|
65
|
+
page=0,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
client.close()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The client is also a context manager (`with FortniteAPI(...) as client:`), which closes the underlying HTTP connection for you.
|
|
72
|
+
|
|
73
|
+
### Async
|
|
74
|
+
|
|
75
|
+
Every method exists on `AsyncFortniteAPI` with an identical signature — just `await` it:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import asyncio
|
|
79
|
+
from fortnite_api import AsyncFortniteAPI
|
|
80
|
+
|
|
81
|
+
async def main():
|
|
82
|
+
async with AsyncFortniteAPI(api_key="your-api-key-here") as client:
|
|
83
|
+
shop = await client.shop.get_current()
|
|
84
|
+
weapons = await client.weapons.get(rarity="mythic")
|
|
85
|
+
print(len(shop.storefronts or []), len(weapons))
|
|
86
|
+
|
|
87
|
+
asyncio.run(main())
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
All examples below use the sync client; prefix calls with `await` for the async one.
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
- ✅ Sync **and** async clients with method-for-method parity
|
|
95
|
+
- ✅ Pydantic models for well-defined responses (shop, cosmetics, weapons, map, season); raw `dict` for the rest
|
|
96
|
+
- ✅ Automatic error handling with a single `FortniteAPIError` (status + message + body)
|
|
97
|
+
- ✅ Support for all Fortnite API endpoints (22 resources, 113 methods)
|
|
98
|
+
- ✅ Built-in OAuth flow helpers
|
|
99
|
+
- ✅ Optional per-call user token (`x-fortnite-token`)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 📚 API Resources
|
|
104
|
+
|
|
105
|
+
### Shop
|
|
106
|
+
|
|
107
|
+
Access the Fortnite Item Shop and Battle Pass data.
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# Get current item shop (-> ShopResponseDto)
|
|
111
|
+
shop = client.shop.get_current(lang="en")
|
|
112
|
+
for storefront in shop.storefronts or []:
|
|
113
|
+
print(storefront.name)
|
|
114
|
+
|
|
115
|
+
# Get current Battle Pass
|
|
116
|
+
battle_pass = client.battlepass.get()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Tournaments
|
|
122
|
+
|
|
123
|
+
Comprehensive tournament data including leaderboards, events, and eligibility tracking.
|
|
124
|
+
|
|
125
|
+
#### Get Current Events
|
|
126
|
+
```python
|
|
127
|
+
events = client.tournaments.get_current()
|
|
128
|
+
history = client.tournaments.get_global_history()
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Get Tournament Leaderboard
|
|
132
|
+
```python
|
|
133
|
+
leaderboard = client.tournaments.get_leaderboard(
|
|
134
|
+
event_id="epicgames_S37_BlitzCupsAllPlatforms_BR",
|
|
135
|
+
event_window_id="S37_BlitzCupsAllPlatforms_Event1_BR",
|
|
136
|
+
page=0,
|
|
137
|
+
)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Power Rankings
|
|
141
|
+
```python
|
|
142
|
+
top = client.tournaments.get_power_rankings(page=0)
|
|
143
|
+
player = client.tournaments.get_power_rankings_player("Ninja")
|
|
144
|
+
results = client.tournaments.search_power_rankings(q="nin", limit=10)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Tournament Tracker (requires user token)
|
|
148
|
+
```python
|
|
149
|
+
tracker = client.tournaments.get_tracker(account_id="accountId", fortnite_token="userToken")
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Check Eligibility (requires user token)
|
|
153
|
+
Verify if a player meets requirements for major tournaments (e.g. 14 tournaments in 180 days):
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
eligibility = client.tournaments.get_tracker_eligibility(
|
|
157
|
+
account_id="accountId",
|
|
158
|
+
days=180,
|
|
159
|
+
required_tournaments=14,
|
|
160
|
+
fortnite_token="userToken",
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
# Per-event eligibility (token requirements verified when a user token is provided)
|
|
164
|
+
status = client.tournaments.check_eligibility("Ninja", "epicgames_S37_BlitzCups_BR")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### Player Events (requires user token)
|
|
168
|
+
```python
|
|
169
|
+
events = client.tournaments.get_player(
|
|
170
|
+
account_id="your-account-id", region="EU", platform="Windows", fortnite_token="userToken"
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Cash Prizes
|
|
175
|
+
```python
|
|
176
|
+
prizes = client.tournaments.get_cashprizes()
|
|
177
|
+
window = client.tournaments.get_cashprize("S37_BlitzCupsAllPlatforms_Event1_BR")
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### Quests
|
|
183
|
+
|
|
184
|
+
Access player quest progress, XP, and account level information.
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
# Requires the user's personal Fortnite OAuth token
|
|
188
|
+
quests = client.quests.get("accountId", fortnite_token="userToken")
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Authentication Required**: user's Fortnite OAuth token.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### Stats & Profiles
|
|
196
|
+
|
|
197
|
+
Player statistics and ranked progression.
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
# Single player stats
|
|
201
|
+
stats = client.stats.get("4735ce9132924caf8a5b17789b40f79c")
|
|
202
|
+
|
|
203
|
+
# Bulk stats
|
|
204
|
+
bulk = client.stats.get_bulk(["accountId1", "accountId2"])
|
|
205
|
+
|
|
206
|
+
# Stat leaderboard
|
|
207
|
+
lb = client.stats.get_leaderboard("kills", limit=100)
|
|
208
|
+
|
|
209
|
+
# Ranked progress (enriched)
|
|
210
|
+
ranked = client.profile.get_ranked(display_name="Ninja")
|
|
211
|
+
level = client.profile.get_level(account_id="accountId", fortnite_token="userToken")
|
|
212
|
+
tracks = client.profile.get_tracks()
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Calendar
|
|
218
|
+
|
|
219
|
+
Fortnite in-game calendar and season information.
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
# Get current season info (-> SeasonEntryDto)
|
|
223
|
+
season = client.calendar.get_season()
|
|
224
|
+
print(season.season_number, season.season_date_begin, season.season_date_end)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
### Assets / Bundles
|
|
230
|
+
|
|
231
|
+
Fortnite shop and tournament asset bundles (images, icons, rewards).
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
shop_bundles = client.assets.get_shop_bundles()
|
|
235
|
+
tournament_bundles = client.assets.get_tournament_bundles()
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### Weapons
|
|
241
|
+
|
|
242
|
+
Comprehensive weapon data including stats and metadata.
|
|
243
|
+
|
|
244
|
+
```python
|
|
245
|
+
# Get all weapons (-> list[WeaponListItemDto])
|
|
246
|
+
weapons = client.weapons.get(rarity="legendary", category="assault")
|
|
247
|
+
|
|
248
|
+
# Available patches (current one flagged)
|
|
249
|
+
patches = client.weapons.get_patches()
|
|
250
|
+
|
|
251
|
+
# Rarity definitions and colors
|
|
252
|
+
rarities = client.weapons.get_rarities()
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
### OAuth
|
|
258
|
+
|
|
259
|
+
OAuth authentication flow helpers for obtaining user tokens.
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
# Device-code flow
|
|
263
|
+
flow = client.oauth.get_token()
|
|
264
|
+
print(flow) # contains a flowId and a user-facing URL to authenticate
|
|
265
|
+
|
|
266
|
+
auth = client.oauth.complete(body={"flowId": flow["flowId"]})
|
|
267
|
+
# auth contains the access token + device auth credentials
|
|
268
|
+
|
|
269
|
+
# Authorization-code flow
|
|
270
|
+
url = client.oauth.get_authorize_url(redirect_uri="https://your.app/callback")
|
|
271
|
+
linked = client.oauth.link(body={"code": "...", "redirectUri": "https://your.app/callback"})
|
|
272
|
+
|
|
273
|
+
# Refresh
|
|
274
|
+
refreshed = client.oauth.refresh_token(body={"refreshToken": "..."})
|
|
275
|
+
silent = client.oauth.refresh_device(body={"accountId": "...", "deviceId": "...", "secret": "..."})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Parsing
|
|
281
|
+
|
|
282
|
+
Parse Fortnite `.replay` files to extract match data. Accepts a path, `bytes`, or a file-like object.
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
# Single replay — pick the detail you need
|
|
286
|
+
stats = client.parsing.parse_stats("match.replay") # fast, stats only
|
|
287
|
+
broadcast = client.parsing.parse_broadcast("match.replay") # everything in one call
|
|
288
|
+
lobby = client.parsing.parse_lobby(open("match.replay", "rb"))
|
|
289
|
+
|
|
290
|
+
# Multiple replays in one request
|
|
291
|
+
results = client.parsing.parse_multiple(["a.replay", "b.replay"])
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Granular single-file methods: `parse_replay`, `parse_stats`, `parse_map`, `parse_loot`,
|
|
295
|
+
`parse_timeline`, `parse_zones`, `parse_lobby`, `parse_broadcast`.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
### Replays (by Match ID)
|
|
300
|
+
|
|
301
|
+
Download and parse tournament replays straight from a match ID.
|
|
302
|
+
|
|
303
|
+
```python
|
|
304
|
+
raw = client.replays.download(match_id) # -> bytes (.replay binary)
|
|
305
|
+
meta = client.replays.get_metadata(match_id)
|
|
306
|
+
parsed = client.replays.parse_stats(match_id)
|
|
307
|
+
broadcast = client.replays.parse_broadcast(match_id)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
### Account
|
|
313
|
+
|
|
314
|
+
Comprehensive account lookup with cross-platform support.
|
|
315
|
+
|
|
316
|
+
#### Lookup by Account ID
|
|
317
|
+
```python
|
|
318
|
+
account = client.account.get_by_id("4735ce9132924caf8a5b17789b40f79c")
|
|
319
|
+
# -> { "id", "displayName", "externalAuths" }
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
#### Lookup by Display Name
|
|
323
|
+
```python
|
|
324
|
+
account = client.account.get_by_display_name("Ninja")
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### Cross-Platform Lookup
|
|
328
|
+
Search for accounts by platform usernames (PSN, Xbox, Steam, Nintendo, Twitch, GitHub):
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
account = client.account.get_by_external_display_name(
|
|
332
|
+
"psn", "PSN_Username", case_insensitive=True
|
|
333
|
+
)
|
|
334
|
+
xbox = client.account.get_by_external_display_name("xbl", "Xbox_Gamertag")
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Supported platforms:** `psn`, `xbl`, `steam`, `nintendo`, `twitch`, `github`.
|
|
338
|
+
|
|
339
|
+
#### Bulk Operations
|
|
340
|
+
```python
|
|
341
|
+
# Bulk account lookup (max 100)
|
|
342
|
+
accounts = client.account.get_bulk(["accountId1", "accountId2", "accountId3"])
|
|
343
|
+
|
|
344
|
+
# Resolve account IDs to display names
|
|
345
|
+
names = client.account.get_display_names(["accountId1", "accountId2"])
|
|
346
|
+
|
|
347
|
+
# Bulk external lookups
|
|
348
|
+
accounts = client.account.bulk_external_display_names(
|
|
349
|
+
[{"externalAuthType": "psn", "displayName": "PSNUser1"}]
|
|
350
|
+
)
|
|
351
|
+
accounts = client.account.bulk_external_ids(
|
|
352
|
+
[{"externalAuthType": "psn", "externalId": "psn-id-123"}]
|
|
353
|
+
)
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
#### External Authentications
|
|
357
|
+
```python
|
|
358
|
+
auths = client.account.get_external_auths("accountId")
|
|
359
|
+
psn_auth = client.account.get_external_auth("accountId", "psn")
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
### News
|
|
365
|
+
|
|
366
|
+
Get Fortnite news and announcements for all game modes.
|
|
367
|
+
|
|
368
|
+
```python
|
|
369
|
+
br_news = client.news.get_br()
|
|
370
|
+
stw_news = client.news.get_stw()
|
|
371
|
+
creative_news = client.news.get_creative()
|
|
372
|
+
all_news = client.news.get_all()
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
### Cosmetics
|
|
378
|
+
|
|
379
|
+
Browse and search the complete Fortnite cosmetics catalog.
|
|
380
|
+
|
|
381
|
+
#### Get All Cosmetics
|
|
382
|
+
```python
|
|
383
|
+
# -> CosmeticDtoPaginatedResultDto (page, page_size, total, total_pages, data)
|
|
384
|
+
page = client.cosmetics.get_all(
|
|
385
|
+
page=1, page_size=50, type="outfit", rarity="legendary", set="Dark Series"
|
|
386
|
+
)
|
|
387
|
+
print(page.total, "items")
|
|
388
|
+
for item in page.data or []:
|
|
389
|
+
print(item.name, item.rarity)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### Get / Search / New
|
|
393
|
+
```python
|
|
394
|
+
item = client.cosmetics.get_by_id("CID_123_Athena")
|
|
395
|
+
results = client.cosmetics.search("galaxy", type="outfit", page_size=20)
|
|
396
|
+
new_items = client.cosmetics.get_new(page=1, page_size=50)
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### Crew
|
|
402
|
+
|
|
403
|
+
Fortnite Crew subscription pack information.
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
current = client.crew.get_current()
|
|
407
|
+
history = client.crew.get_history()
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
### Map
|
|
413
|
+
|
|
414
|
+
Current and historical Fortnite map data.
|
|
415
|
+
|
|
416
|
+
```python
|
|
417
|
+
map_data = client.map.get(version="v41.00") # -> MapDataDto (with POIs)
|
|
418
|
+
image_url = client.map.get_image() # -> resolved image URL string
|
|
419
|
+
history = client.map.get_history(season=1) # -> list[MapHistoryEntryDto]
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
### Playlists
|
|
425
|
+
|
|
426
|
+
Fortnite playlists and game modes.
|
|
427
|
+
|
|
428
|
+
```python
|
|
429
|
+
all_playlists = client.playlists.get_all()
|
|
430
|
+
active = client.playlists.get_active()
|
|
431
|
+
playlist = client.playlists.get_by_id("Playlist_DefaultSolo")
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### FN (Fortnite Game)
|
|
437
|
+
|
|
438
|
+
Fortnite-specific game data including inventory, features, and settings.
|
|
439
|
+
|
|
440
|
+
```python
|
|
441
|
+
# Battle Royale inventory (V-Bucks)
|
|
442
|
+
inventory = client.fn.get_br_inventory("accountId")
|
|
443
|
+
|
|
444
|
+
# Storefront keychain
|
|
445
|
+
keychain = client.fn.get_keychain()
|
|
446
|
+
|
|
447
|
+
# Purchase receipts
|
|
448
|
+
receipts = client.fn.get_receipts("accountId")
|
|
449
|
+
|
|
450
|
+
# Enabled game features
|
|
451
|
+
features = client.fn.get_enabled_features()
|
|
452
|
+
|
|
453
|
+
# Version check
|
|
454
|
+
version = client.fn.get_version("Windows", version="++Fortnite+Release-30.40-CL-...-Windows")
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
#### Privacy & Entitlement (require user token)
|
|
458
|
+
```python
|
|
459
|
+
privacy = client.fn.get_privacy("accountId", fortnite_token="userToken")
|
|
460
|
+
client.fn.update_privacy(
|
|
461
|
+
"accountId", {"optOutOfPublicLeaderboards": True}, fortnite_token="userToken"
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
check = client.fn.get_entitlement(fortnite_token="userToken")
|
|
465
|
+
client.fn.request_entitlement("accountId", fortnite_token="userToken")
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## 🔐 Authentication
|
|
471
|
+
|
|
472
|
+
Every method accepts an optional `fortnite_token` (sent as the `x-fortnite-token` header). Set it once on the client or pass it per call:
|
|
473
|
+
|
|
474
|
+
```python
|
|
475
|
+
client = FortniteAPI(api_key="...", fortnite_token="userToken")
|
|
476
|
+
client.fn.get_privacy("accountId", fortnite_token="override") # per-call override
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Endpoints Requiring a User Token
|
|
480
|
+
- `client.quests.get()`
|
|
481
|
+
- `client.tournaments.get_tracker()`
|
|
482
|
+
- `client.tournaments.get_tracker_eligibility()`
|
|
483
|
+
- `client.tournaments.get_player()`
|
|
484
|
+
- `client.fn.get_privacy()` / `client.fn.update_privacy()`
|
|
485
|
+
- `client.fn.get_entitlement()` / `client.fn.request_entitlement()`
|
|
486
|
+
- `client.profile.get_level()`
|
|
487
|
+
|
|
488
|
+
**How to obtain a user token:** use the OAuth flow:
|
|
489
|
+
|
|
490
|
+
```python
|
|
491
|
+
flow = client.oauth.get_token()
|
|
492
|
+
# Direct the user to the URL returned in `flow`
|
|
493
|
+
auth = client.oauth.complete(body={"flowId": flow["flowId"]})
|
|
494
|
+
# Use auth's access token as the `fortnite_token` argument
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## 🚀 Advanced Usage
|
|
500
|
+
|
|
501
|
+
### Custom Base URL & Timeout
|
|
502
|
+
|
|
503
|
+
```python
|
|
504
|
+
client = FortniteAPI(
|
|
505
|
+
api_key="your-api-key",
|
|
506
|
+
base_url="https://custom-api-url.com/api",
|
|
507
|
+
timeout=60.0,
|
|
508
|
+
)
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Error Handling
|
|
512
|
+
|
|
513
|
+
```python
|
|
514
|
+
from fortnite_api import FortniteAPIError
|
|
515
|
+
|
|
516
|
+
try:
|
|
517
|
+
shop = client.shop.get_current()
|
|
518
|
+
except FortniteAPIError as error:
|
|
519
|
+
print("API Error:", error.message)
|
|
520
|
+
print("Status Code:", error.status)
|
|
521
|
+
print("Details:", error.data) # raw error body
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## 📖 Documentation
|
|
527
|
+
|
|
528
|
+
- **Full API Documentation (Swagger)**: https://documentation.api-fortnite.com/documentation
|
|
529
|
+
- **Support**: https://api-fortnite.com
|
|
530
|
+
|
|
531
|
+
This SDK is generated from `openapi/swagger.json` — regenerate after a spec change with:
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
uv run python scripts/generate.py
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## 📝 License
|
|
540
|
+
|
|
541
|
+
MIT
|