# decobuy

> Wholesale vouchers for Discord decorations. One voucher becomes one discord.gift link for one item at that voucher's Discord price.

Shop: https://store.decobuy.lol
Activation: https://activate.decobuy.lol/?code=<CODE>

## Auth

Send `X-API-Key: dbyyy_...` on every request. Create the key in Account. It is shown once.

## Price tiers

`retail_price` is Discord's USD price. `price` is the voucher price.

| tier_id | Discord price | voucher price | items |
|---|---|---|---|
| 15 | $5.99 | $1.53 | 1015 |
| 7 | $6.99 | $1.82 | 1 |
| 14 | $7.99 | $1.82 | 90 |
| 3 | $8.99 | $2.60 | 82 |
| 16 | $9.99 | $3.90 | 32 |
| 1 | $10.99 | $3.25 | 107 |
| 4 | $11.99 | $3.12 | 4 |
| 8 | $12.99 | $4.65 | 70 |
| 5 | $14.99 | $3.64 | 9 |
| 2 | $15.99 | $4.81 | 95 |
| 9 | $16.99 | $5.20 | 3 |
| 11 | $17.99 | $5.72 | 6 |
| 17 | $19.99 | $6.50 | 2 |
| 13 | $20.99 | $5.46 | 7 |
| 6 | $23.99 | $7.80 | 25 |
| 10 | $28.99 | $9.75 | 11 |
| 12 | $34.99 | $11.70 | 1 |

## Endpoints

All JSON, prefix `/api/reseller/v1`.

- `GET /me` -> username, balance, discount_percent
- `GET /tiers`
- `GET /tiers/{tier_id}/items` -> sku, name, kind, collection, image_url, retail_price
- `POST /vouchers` body `{"tier_id": 20, "quantity": 1}` -> unit_price, total, vouchers
- `GET /vouchers?status=active&page=1`
- `POST /vouchers/lookup` body `{"code": "DB-..."}`
- `POST /vouchers/redeem` body `{"code": "DB-...", "sku": "1333866045282451527"}`
- `POST /vouchers/status` body `{"code": "DB-..."}`

A voucher matches one item with the same Discord price. It cannot be split across cheaper items.
Example item: Aim for Love, sku `1333866045282451527`, Discord price $5.99.

Statuses: `active`, `processing`, `delivered`, `invalid`.
If delivery fails, the voucher goes back to `active`.

## Errors

`{"error": {"code": "...", "message": "..."}}`

401 `invalid_api_key` · 402 `insufficient_balance` · 404 `tier_not_found` or `voucher_not_found` · 409 `voucher_already_used` · 400 `item_not_eligible` · 422 `validation_error` · 429 `rate_limited` · 503 `delivery_unavailable`

20 requests per minute per key. On 429, wait for `Retry-After`.
