API documentation

Every GiftSniper API request: parameters, sample responses, errors, webhooks and the event stream.

Quick start

  1. Choose a plan and pay. The key appears at once in My keys.
  2. Send the key in the header x-api-key with every request.
  3. Base URL: https://giftsniper.com/api/v1

curl

curl -H "x-api-key: YOUR_KEY" "https://giftsniper.com/api/v1/floors?coll=pepe"

Python

import requests

r = requests.get("https://giftsniper.com/api/v1/floors", params={"coll": "pepe"}, headers={"x-api-key": "YOUR_KEY"})
print(r.json()["floor"])

JavaScript

const r = await fetch("https://giftsniper.com/api/v1/floors?coll=pepe", { headers: { "x-api-key": "YOUR_KEY" } });
console.log((await r.json()).floor);

Prices are in TON. Times are unix seconds. Responses are JSON. Markets: portals, mrkt, telegram, fragment, getgems; the sales history also has tonnel (a closed marketplace).

Keep the key on your server. Never put it into website or app code that other people can see.

Plans and limits

PlanUnitsRequests per secondFreshnessListings and offersWebhooksStream
Trial3,00015–10 syesnono
Basic60,0002every minutenonono
Pro400,000105–10 syesnono
Max1,200,000205–10 syesup to 50,000 events a dayno
Stream3,000,000205–10 syesunlimitedup to 3 connections

Units are for the whole paid period and do not carry over. Failed requests are not charged. Webhooks and the stream use no units.

My key

GET/me

Units per request: 0. All plans.

Your plan, the units left and when the key expires. Handy for checking a key.

{
  "ok": true,
  "plan": "pro",
  "units": 400000,
  "units_used": 1250,
  "units_left": 398750,
  "expires_at": 1798756000,
  "requests_per_second": 10,
  "freshness_seconds": 10,
  "lots": true,
  "offers": true,
  "webhooks": 0,
  "stream_connections": 0
}

Collections

GET/collections

Units per request: 1. All plans.

All collections at once: supply, listed, floor, sales and volume.

{
  "ok": true,
  "now": 1796164100,
  "collections": [
    {
      "coll": "pepe",
      "name": "Plush Pepe",
      "supply": 3000,
      "alive": 2861,
      "burned": 0,
      "owners": 448,
      "listed": 322,
      "floor": 6777,
      "floor_7d": 6650,
      "floor_30d": 5900,
      "sales_24h": 8,
      "volume_24h": 57000,
      "sales_7d": 66,
      "volume_7d": 465000,
      "sales_30d": 234,
      "volume_30d": 1600000
    }
  ]
}

Floors

GET/floors?coll=pepe

Units per request: 1. All plans.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.

Collection floor on each market and the cheapest listing of every model, backdrop and symbol.

{
  "ok": true,
  "now": 1796164100,
  "coll": "pepe",
  "currency": "TON",
  "markets": {
    "portals": {
      "listed": 120,
      "floor": 6777
    },
    "mrkt": {
      "listed": 98,
      "floor": 6800
    }
  },
  "floor": 6777,
  "models": {
    "Pink Galaxy": 12500
  },
  "backdrops": {
    "Black": 19900
  },
  "symbols": {
    "Dice": 7100
  }
}

Floor history

GET/floors/history?coll=pepe&trait=model&name=Pink%20Galaxy&range=7d

Units per request: 1. All plans.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.
traitmodel, backdrop or symbol
nameName of the model, backdrop or symbol, as in /floors.
range1d, 7d or 30d

How the floor of one trait changed. At most one point per hour.

{
  "ok": true,
  "now": 1796164100,
  "coll": "pepe",
  "trait": "model",
  "name": "Pink Galaxy",
  "range": "7d",
  "currency": "TON",
  "step_seconds": 3600,
  "points": [
    {
      "at": 1795560000,
      "floor": 12900
    },
    {
      "at": 1795563600,
      "floor": 12500
    }
  ]
}

Sales history

GET/sales?coll=mythmask&before=1796164000

Units per request: 10, 100 or 700. All plans.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.
beforeOptional. Return sales before this time (unix seconds).

Sales history, newest first, up to 500 per page. For the next page pass next_before from the response as before. When next_before is null, the history has ended.

Sales on the pageUnits
last 24 hours, or no before10
1 to 30 days ago100
older than 30 days700

A page that costs 10 or 100 units shows sales up to 30 days old. Older ones come on the next page at its own price.

The charge is in the response header x-units-charged. Need the whole history? It is cheaper as files.

{
  "ok": true,
  "coll": "mythmask",
  "currency": "TON",
  "sales": [
    {
      "n": 4217,
      "market": "portals",
      "price": 7.9,
      "at": 1796164100,
      "kind": null,
      "model": "Night Vision",
      "backdrop": "Carmine"
    }
  ],
  "next_before": 1796150000
}

kind: null (a regular sale), offer (an accepted offer), lucky (LuckyBuy), premarket. Model and backdrop are as they were at the time of sale.

Gift

GET/gift?coll=pepe&n=100

Units per request: 1, or 20 after 3,000 gifts per day. All plans.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.
nGift number.

One gift: model, backdrop, symbol, owner, sales. Its listings are included on Trial and from Pro up. Days are UTC; today's count is in the header x-gifts-today.

{
  "ok": true,
  "coll": "pepe",
  "n": 100,
  "exists": true,
  "model": "Pink Galaxy",
  "backdrop": "Black",
  "symbol": "Dice",
  "owner": "Name",
  "owner_username": "username",
  "currency": "TON",
  "sales": [
    {
      "market": "mrkt",
      "price": 6500,
      "at": 1790000000,
      "kind": null
    }
  ],
  "lots": []
}

Listings

GET/lots?coll=pepe

Units per request: 10. Trial and plans from Pro up.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.

All listings of a collection on Portals, MRKT, Telegram, Fragment and Getgems in one response.

{
  "ok": true,
  "now": 1796164100,
  "coll": "pepe",
  "currency": "TON",
  "lots": [
    {
      "n": 1234,
      "market": "portals",
      "price": 6777,
      "stars": null,
      "listed_at": 1796100000,
      "price_changed_at": 1796160000,
      "locked_until": null,
      "premarket": false,
      "model": "Pink Galaxy",
      "backdrop": "Black",
      "symbol": "Dice"
    }
  ]
}

Offers

GET/offers?coll=pepe

Units per request: 1. Trial and plans from Pro up.

ParameterMeaning
collCollection. The same word as in its page address: giftsniper.com/pepe. /collections returns the full list.

The order book for the collection and traits from Portals, MRKT and Getgems, up to 300 offers per market. Empty models, backdrops and symbols mean any gift of the collection.

{
  "ok": true,
  "coll": "pepe",
  "currency": "TON",
  "markets": {
    "mrkt": {
      "updated_at": 1796164000,
      "complete": true,
      "offers": [
        {
          "id": "a1b2…",
          "price": 6400,
          "quantity": 3,
          "filled": 1,
          "left": 2,
          "models": [],
          "backdrops": ["Black"],
          "symbols": [],
          "expires_at": 1796700000
        }
      ]
    }
  }
}
  • complete: false: a part of the book. Portals returns only the 10 highest collection offers and the 10 highest trait offers.
  • aggregated: true: an aggregated Portals row: a price and the number of offers at it (offers_count).
  • Getgems also has seller_gets (net to the seller), nft (an offer for one gift) and offchain.
  • Updated every 3 minutes for Portals, 5 for MRKT, 10 for Getgems, every minute for the most traded collections. See updated_at.
  • Filled offers are sales with kind = "offer".

Events

The same in the stream and in webhooks.

typeWhat happened
listnew listing
price_downprice lowered
price_upprice raised
salesale
unlistlisting removed
{
  "type": "list",
  "coll": "pepe",
  "n": 1234,
  "market": "mrkt",
  "price": 6900,
  "model": "Pink Galaxy",
  "backdrop": "Black",
  "symbol": "Dice",
  "at": 1796164100,
  "ref": "8f2c…"
}
  • Price changes carry old_price, star-priced listings carry stars, sales carry id, kind and late (the sale was found late).
  • After a sale there is usually no separate unlist: a sale means the listing on that market is gone.
  • An event may be delivered more than once; repeated sales have the same id. Make your handler idempotent.
  • Price changes below 1 TON and 1% are not sent.
  • unlist has no price, sale has no symbol, unlist traits may be empty.

Filters

All optional; with no filters everything is sent. A price or trait filter applies only to events that carry that field.

types, colls, markets, models, backdrops, symbols, price_min, price_max

Webhooks

Max and Stream plans, up to 10 addresses, 0 units.

Events matching your filters are sent to your server, up to 100 at a time, at most once a second.

Create

curl -X POST "https://giftsniper.com/api/v1/webhooks" -H "x-api-key: YOUR_KEY" -H "content-type: application/json" \
  -d '{"url": "https://your.server/gifts", "types": ["list", "price_down"], "colls": ["pepe"], "price_max": 7000}'

The response contains secret. It is shown once, so save it.

What your server receives

POST https://your.server/gifts
X-GS-Webhook: <id>
X-GS-Signature: <hex HMAC-SHA256>

{
  "webhook": "<id>",
  "sent_at": 1796164100.2,
  "events": [
    {
      "type": "list",
      "coll": "pepe",
      "n": 1234,
      "market": "mrkt",
      "price": 6900,
      "model": "Pink Galaxy",
      "backdrop": "Black",
      "symbol": "Dice",
      "at": 1796164100,
      "ref": "8f2c…"
    }
  ]
}

Checking the signature (Python)

import hashlib, hmac

def ok(secret: str, raw_body: bytes, signature: str) -> bool:
    good = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(good, signature)
RequestWhat it does
GET /webhookslist and counters: delivered, failed, last_error, paused_reason, key_events_today
POST /webhookswith id in the body: change filters or resume, {"id": "…", "active": true}
DELETE /webhooks?id=…delete
  • Answer 2xx within 5 seconds. Otherwise the batch is retried twice.
  • After 20 failed batches in a row over 30+ minutes the webhook is paused.
  • Max: up to 50,000 events per UTC day per key, after that none until midnight UTC. Stream: unlimited. The whole market makes about a million events a day, so use filters.
  • The url must be https, a host name rather than an IP, port 443 or 8443.

Event stream

Stream plan, up to 3 connections, 0 units.

A persistent WebSocket connection. Every event arrives at once as its own message.

import asyncio, json, websockets

async def main():
    url = "wss://giftsniper.com/api/v1/stream?colls=pepe,mythmask&types=list,price_down&price_max=100"
    async with websockets.connect(url, additional_headers={"x-api-key": "YOUR_KEY"}) as ws:
        async for msg in ws:
            print(json.loads(msg))

asyncio.run(main())
  • Send the key in the x-api-key header, or as the key parameter if your library cannot set headers.
  • The first message is {"type": "hello"}. Filters can be changed on the fly: {"op": "subscribe", "colls": ["pepe"]}
  • A connection lives up to 24 hours, so reconnect when it closes. If events are not read fast enough it is closed with code 1013.

Response headers

HeaderMeaning
x-units-leftunits left
x-units-chargedunits charged for this request
x-planplan
x-expireskey expiry (unix)
x-data-ageage of the data in seconds
x-stale: 1the server is busy and the latest copy is returned. Never for /lots and /gift

Errors

{
  "ok": false,
  "error": {
    "code": "rate",
    "message": "Too many requests: up to 10 per second on this plan."
  }
}
CodeMeaning
400 paramsa wrong parameter
400 collno such collection
401 keymissing or invalid key
402 expiredthe paid period has ended
403 plannot included in your plan
403 key_offthe key is switched off
429 ratetoo often, wait a second
429 unitsno units left: renew or upgrade
503 busybusy, retry in a few seconds

Terms

  • One key per project.
  • Reselling the data or passing it on through your own API is not allowed.
  • Wherever people see the data, credit "Data by GiftSniper" with a link to giftsniper.com.

Questions: @giftsniper_contact