Start sending a large PDF rulebook in parts
const url = 'https://api.thebgdb.org/v1/games/5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77/rulebooks/uploads';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"size":61250112,"language":"en","edition":"5th edition, 2015"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.thebgdb.org/v1/games/5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77/rulebooks/uploads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "size": 61250112, "language": "en", "edition": "5th edition, 2015" }'For a PDF too heavy for POST /games/{id}/rulebooks: up to 200 MB. Say how many bytes the file has; the answer tells how to cut it (partSize bytes a part, the last one shorter, parts in all) and gives a token. Send each part with PUT /rulebook-uploads/{upload}/parts/{part}, then POST /rulebook-uploads/{upload}/complete; those calls carry the token in the x-upload-token header and nothing else. The token opens this one upload, for two hours. The member’s email address must be confirmed. A member can start five uploads a minute, have three under way at once, and add 10 rulebooks a day, uploads under way included. An upload neither completed nor cancelled is discarded after a day.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The game’s id, as returned in every game object. The game’s slug is accepted too, and so is an address it had before: a slug changed when the game was renamed by the addressing rule, or the id or slug of an entry merged into it because both were the same game. The answer is the game under its current id and slug; compare them with what you sent to update a stored link.
Example
5c9b0f43-7a39-4f0c-8a4e-2f2d2b1d9a77Request Bodyrequired
Section titled “Request Bodyrequired”object
Bytes of the whole file.
What the file is. rulebook: the game’s rules (the only type structured rules are drafted from); player_aid: player aids, reference sheets, rules summaries; score_sheet: score sheets and printable trackers; faq: FAQ and errata; campaign: campaign logs, scenario books; print_and_play: print-and-play files; variant: solo, automa and fan variants; other: anything else.
A language code such as “en”, “fr” or “pt-BR”.
Which edition or printing these rules belong to. Optional.
Example
{ "size": 61250112, "language": "en", "edition": "5th edition, 2015"}Responses
Section titled “Responses”The upload is open.
object
A large rulebook on its way in, and how to send it.
object
The upload’s id, and the rulebook’s once it is complete.
Send it as x-upload-token with every part and to finish or cancel. Shown once.
Bytes of every part but the last.
How many parts to send.
When the token stops being accepted.
Example
{ "data": { "id": "c2b7e5a4-3f1d-4b7c-8f0a-9e6d5c4b3a21", "token": "9f2c61f0a4b84d7e9c3a5b1d7e2f4a6c8b0d2e4f6a8c0e2f4a6b8d0c2e4f6a81", "partSize": 8388608, "parts": 8, "expiresAt": "2026-11-21T20:04:11.120Z" }}The size, the type, the language or the edition is not valid.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}The request has no valid session token.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}The member has not confirmed their email address.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}No game has this id.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}The file is larger than 200 MB.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}Rate limited, more than five starts in a minute, three uploads already under way, or 10 rulebooks already added today.
object
What went wrong, in plain English words. The wording may change: act on code.
A stable name for this refusal, for programs and for showing the message in another language. A code is never renamed; new ones may be added.
The numbers the sentence names, when it names any: for example { "max": 20 } with daily_photo_limit.
object
Example
{ "error": "Game not found", "code": "game_not_found"}