GB Files REST API
Create a transfer, pay once, upload resumable SHA-256-verified chunks in parallel, and get a share link. Every step is safe to retry.
The API is what the web app uses. There are no API keys and no accounts: each transfer has its own uploadToken, and a person pays for it once on Stripe Checkout. The machine-readable spec is at /v1/openapi.json.
Base URL: https://gbfiles.com
How a transfer works
- Create the transfer by declaring the files and their sizes. You get the price, an upload token, a Stripe Checkout link, and the chunk layout for every file.
- Pay. A person opens the checkout link and pays by card. Nothing uploads until payment clears.
- Upload chunks straight to storage, in parallel, each with a SHA-256 checksum that storage verifies.
- Finalize. The chunks are joined server-side and you get the share link.
The server keeps a ledger of finished chunks, so at any point you can ask which chunks are still missing and upload only those.
1. Create a transfer
curl -X POST https://gbfiles.com/v1/transfers \
-H 'Content-Type: application/json' \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"title": "Final cut",
"recipientEmail": "client@example.com",
"senderEmail": "me@example.com",
"files": [
{ "relativePath": "final/cut.mov", "filename": "cut.mov", "sizeBytes": 48318382080 }
]
}'
Optional fields: title, password (at least 4 characters), recipientEmail (we email them the link when it's ready), senderEmail (we email you on the first download). Up to 5,000 files and 5 TB in total.
The response includes transfer.id, uploadToken, checkoutUrl, the price tier, and for each file its id, chunkSizeBytes and chunkCount. Keep transfer.id and uploadToken: they are all you need to resume later.
Send the same Idempotency-Key when retrying. You get the same transfer and the same open checkout back, so a retry can never create a second charge.
2. Pay
Open checkoutUrl in a browser, or give it to the person paying. When payment clears, the transfer moves from awaiting_payment to uploading. Poll the status endpoint:
curl https://gbfiles.com/v1/transfers/$ID/status -H "X-Upload-Token: $TOKEN"
3. Upload chunks
Chunk i of a file covers bytes i × chunkSizeBytes up to the next boundary or the end of the file. Chunk sizes are 16, 64, 128 or 540 MiB depending on file size. For each chunk:
# a. Get a short-lived upload URL for this chunk
URL=$(curl -s -X POST https://gbfiles.com/v1/transfers/$ID/files/$FILE_ID/chunks/$I/presign \
-H "X-Upload-Token: $TOKEN" | jq -r .presignedUrl)
# b. PUT the bytes. Storage recomputes SHA-256 and rejects mismatches (400 BadDigest).
SHA_B64=$(openssl dgst -sha256 -binary chunk.bin | base64)
ETAG=$(curl -s -D - -o /dev/null -X PUT "$URL" \
-H 'Content-Type: application/octet-stream' \
-H "x-amz-checksum-sha256: $SHA_B64" \
--data-binary @chunk.bin | awk 'tolower($1)=="etag:"{print $2}' | tr -d '\r')
# c. Record the chunk as done
curl -X POST https://gbfiles.com/v1/transfers/$ID/files/$FILE_ID/chunks/$I/complete \
-H "X-Upload-Token: $TOKEN" -H 'Content-Type: application/json' \
-d "{\"etag\": $ETAG, \"sha256\": \"$(openssl dgst -sha256 chunk.bin | awk '{print $NF}')\", \"sizeBytes\": $(wc -c < chunk.bin)}"
Run about four chunks at a time. Every one of these calls is safe to repeat: presigning again gives a fresh URL, re-uploading a chunk overwrites it with the same bytes, and completing a finished chunk is a no-op.
4. Finalize
curl -X POST https://gbfiles.com/v1/transfers/$ID/finalize -H "X-Upload-Token: $TOKEN"
Returns {"status": "ready", "shareUrl": "https://gbfiles.com/t/…"}. For very large files it returns 202 with status: "assembling"; poll the status endpoint until transfer.status is ready and read shareUrl from there. If chunks are missing you get 409 incomplete_upload with a count.
Resuming after a crash
Call the status endpoint. Each file lists completedChunkIndices and missingChunkIndices. Upload only the missing ones, then finalize. Uploaded chunks are kept until the transfer expires, so you can resume hours later from a different machine, as long as you have the transfer ID and upload token.
Downloading
GET /v1/transfers/{id}/manifest.jsonlists every file with itsid,relativePath,sizeBytes, and the SHA-256 of each chunk. For password-protected transfers, sendX-Transfer-Password.GET /d/{id}/{fileId}streams the file. It supportsRangerequests and stays the same for the life of the transfer, socurl -fL -C - -o name https://gbfiles.com/d/{id}/{fileId}resumes from wherever it stopped. For protected transfers add-u ":PASSWORD".POST /v1/transfers/{id}/files/{fileId}/download-url(body{"password": "…"}if protected) returns that same link, with a per-file token for protected transfers.
Deleting
curl -X DELETE https://gbfiles.com/v1/transfers/$ID -H "X-Upload-Token: $TOKEN"
Deletes every file immediately. Otherwise transfers are deleted automatically after 7 days.
Errors and limits
| Status | Error | Meaning |
|---|---|---|
| 400 | validation_error, size_limit_exceeded |
Bad request body, or more than 5 TB in total |
| 401 | unauthorized |
Missing or wrong X-Upload-Token |
| 402 | payment_required |
The transfer hasn't been paid yet |
| 403 | invalid_password |
Wrong or missing download password |
| 409 | invalid_state, incomplete_upload |
Wrong step for the transfer's state, or chunks still missing |
| 410 | transfer_expired |
The 7-day link has expired |
Other endpoints: GET /v1/pricing (tiers and limits as JSON), GET /v1/health.