Credit API over HTTP
The SwiftServers plugin uses this API. Call it yourself when you aren’t on Paper, or from a website or bot.
- Base address:
https://auth.swiftservers.org/api/credits/v1 - Headers:
Authorization: Bearer ssk_...andAccept: application/json - Rate limit: 60 payment requests and 600 other calls a minute per key, then
429.
Version 1 only ever gains fields, so code written for it keeps working.
Endpoints
Section titled “Endpoints”| Method and path | What it does |
|---|---|
GET /me |
The key’s server, its limits, and debug for a debug key |
POST /payments |
Ask a player for credits |
GET /payments/{id} |
A payment’s state |
POST /payments/{id}/refund |
Refund a payment, within 48 hours |
GET /players/{uuid}/balance |
A player’s balance, if they allow it |
GET /votes?from=&to=&player=&limit= |
Votes for your server (or its network), newest first |
GET /plugin |
The newest plugin version (no key needed) |
Ask for credits
Section titled “Ask for credits”POST /api/credits/v1/payments{"player": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "amount": 200, "description": "VIP rank", "idempotency_key": "order-1842"}| Field | |
|---|---|
player |
Java UUID, or the Floodgate UUID for Bedrock players |
amount |
5 to 2,000 credits |
description |
Up to 64 characters of plain text |
idempotency_key |
Your own id. Sending it again returns the same payment instead of charging twice |
allow_earned |
Optional. true lets the player pay with free credits, which earn you nothing |
The answer is 201 with status: pending. A payment from a debug key has debug: true and moves no credits. Check GET /payments/{id} until status is confirmed, declined or expired, or use a webhook.
Read votes
Section titled “Read votes”How many times a player voted for your server in the last 30 days:
GET /api/credits/v1/votes?player=069a79f4-44e9-4726-a5be-fca90e38aaf5{"from": "2026-10-31T09:00:00+00:00", "to": "2026-11-30T09:00:00+00:00", "total": 12, "voters": 1, "votes": [{"player": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Notch", "voted_at": "2026-11-30T08:12:03+00:00"}]}Leave out player for every vote. from and to take any date (up to a year apart), and limit (1 to 500, default 100) caps the votes list but not total. A server behind a Velocity network reads the network’s votes, because a vote for any of its servers counts for the network.
Errors
Section titled “Errors”A refused request answers 4xx with error and message:
error |
Meaning |
|---|---|
player_not_linked |
The player has no SwiftServers account linked |
player_busy |
The player already has an open request |
invalid_amount |
Outside 5 to 2,000 |
cap_reached |
A daily or monthly limit is reached |
payer_too_new, owner_too_new |
An account is too new |
payer_unavailable, self_dealing |
This player can’t pay this server |
payments_unavailable, api_frozen |
Payments are off for this server |
idempotency_conflict |
The key was reused for a different payment, or a debug key’s for a real one |
debug_team_only |
A debug key asked a player outside the server’s team |
A declined payment has a decline_reason: declined, closed, expired, insufficient_credits, cap_reached, left or not_on_server.
Webhooks
Section titled “Webhooks”Give a key a webhook address (public https:// only) on the Credit API page. The panel posts {"event": "payment.confirmed", "payment": {...}} when a payment is confirmed, declined, expires or is refunded, and retries for about 20 minutes.
Check signatures
Section titled “Check signatures”Every answer and webhook has X-Swift-Signature: t=<unix time>,v1=<hex>.
- Make the signing secret once: HMAC-SHA256 of
swift-credit-signing, keyed with your whole API key, as lowercase hex. - Compute HMAC-SHA256 of
<t>.<raw body>, keyed with that secret. - Compare it with
v1, and refuse anything wheretis over 5 minutes old.