Tokens

Tokens are the core part of blnk.fun. On this page, we'll dive into the different token endpoints you can use to manage tokens programmatically. We'll look at how to query, buy, and sell tokens.

The token model

The token model contains all the information about blnk.fun tokens, such as its on-chain & off-chain metadata, supply & reserve details, and analytics. It also contains a reference to the curve that determines the price of the token.

Properties

  • Name
    address
    Type
    string
    Description

    Base58-encoded public key of the token mint

  • Name
    creator
    Type
    string
    Description

    Base58-encoded public key of the account that created the token

  • Name
    supply
    Type
    integer
    Description

    Supply of the token

  • Name
    reserve
    Type
    integer
    Description

    SOL reserves for the token in lamports

  • Name
    views
    Type
    integer
    Description

    Number of times the token has been viewed

  • Name
    decimals
    Type
    integer
    Description

    0 for NFTs and 6 for SPL tokens

  • Name
    name
    Type
    string
    Description

    Name of the token

  • Name
    symbol
    Type
    string
    Description

    Shorthand name of the token

  • Name
    description
    Type
    string
    Description

    Description of the token

  • Name
    image
    Type
    string
    Description

    URL pointing to an image for the token

  • Name
    external_url
    Type
    string
    Description

    URL pointing to an external site (e.g. website, social media profile)

  • Name
    uri
    Type
    string
    Description

    URL pointing to the off-chain metadata

  • Name
    created_timestamp
    Type
    timestamp
    Description

    Timestamp of when the token was created

  • Name
    last_trade_timestamp
    Type
    timestamp
    Description

    Timestamp of when the token was last traded

  • Name
    last_view_timestamp
    Type
    timestamp
    Description

    Timestamp of when the token was last viewed

  • Name
    last_view_timestamp
    Type
    timestamp
    Description

    Timestamp of when the token was last viewed


GET/api/tokens

List all tokens

This endpoint allows you to retrieve a paginated list of all tokens. By default, a maximum of 200 tokens are shown per page.

Optional attributes

  • Name
    name
    Type
    integer
    Description

    Case insensitive search for tokens by name.

  • Name
    symbol
    Type
    integer
    Description

    Case insensitive search for tokens by symbol.

  • Name
    description
    Type
    integer
    Description

    Case insensitive search for tokens by description.

  • Name
    address
    Type
    integer
    Description

    Base58-encoded public key of the token mint.

  • Name
    limit
    Type
    integer
    Description

    Limit the number of tokens returned.

Request

GET
/api/tokens
curl -G https://blnk.fun/api/tokens \
  -d name=blink

Response

[
  {
    "name": "infiniteBLINK",
    "symbol": "INFINITE",
    "uri": "https://arweave.net/zwe-aVBjMUITk8gyy61hGG0Wd3u6uQjd2weqXe7vgCI",
    "description": "infiniteBLINK is the first test token that's forever tradable using only blinks.\nBuy the token on the bonding curve and sell at any time, all with a blink.\nTokens have infinite supply.",
    "image": "https://arweave.net/VOC8YtlDvt3f-5W762qvWDcDMCj-6kYfBt5HRI4A5Fc",
    "address": "infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1",
    "creator": "B1NKiifexipFc3gpxAN5WACY7aRupgJT7XeFJak7aosw",
    "decimals": 6,
    "supply": 860614180767312,
    "reserve": 123559227740,
    "views": 954740,
    "created_timestamp": 1720927740,
    "last_view_timestamp": 1723498811,
    "last_trade_timestamp": 1723466560,
    "external_url": null,
    "curve": {
      "address": "FCKUQodQxdUuTCYpXmLjXNNTy4zJNoCpHescXn8V2ApM",
      "c": 1e-12,
      "b": 0,
      "pow": 3,
      "frac": 5,
      "k0": null,
      "k1": null,
      "d": null,
      "interval": null
    }
  },
  {
    "name": "mockBLINK",
    // ...
  }
]


POST/api/tokens

Create a token

This endpoint allows you to retrieve a paginated list of all tokens. By default, a maximum of 200 tokens are shown per page.

Required attributes

  • Name
    name
    Type
    string
    Description

    Name for the token

  • Name
    symbol
    Type
    string
    Description

    Shorthand name for the token

  • Name
    description
    Type
    string
    Description

    Description for the token

  • Name
    image
    Type
    string
    Description

    Base64 encoded string image

  • Name
    decimals
    Type
    integer
    Description

    0 for NFTs and 6 for SPL tokens

  • Name
    curveAddress
    Type
    string
    Description

    Base58-encoded public key of an account that determines the price of the token

Optional attributes

  • Name
    external_url
    Type
    integer
    Description

    Link to an external site like a website or social media profile

Request

POST
/api/tokens
curl -X POST https://blnk.fun/api/tokens \
  -H "Content-Type: application/json" \
  -d '{
    "account": "B1NKiifexipFc3gpxAN5WACY7aRupgJT7XeFJak7aosw",
    "name": "infiniteBlink",
    "symbol": "BLINK",
    "description": "infiniteBLINK is the first test token forever tradable using only blinks",
    "image": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII=",
    "decimals": 6,
    "curveAddress": "CRVdAeCYAhRLa7afCU8TYszDpAkKLaJAR94GnRMxS29a"
  }'

Response

{
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAIEJSs+p2/+Ru+yr0AGxJrjY2uhRCCpdKx8ezXXaM0yBAqHFQLWdCtO7LEq9LuXAbSLlAe0tuTbwZoenpvlJePjYkN8oc9iQ0i2JZQf6hQXmrQWHiDbHxdwBWPXmr80R6r8Aq0cxgWv9JqiwiwRay/nNqaloEh3gqK7E00q4jMgkik5ykwRC8t7kyZu1ogIGF1b9Y0UqRXcZBArQZhzCSeEu7QiR5c5qILNB+BSbyK5xBxr0oHwliWuzejfbbXu9WVk8RbE+rUEbZqZcqGCqGiL9n/MH6eeYrnZ8bW762S5u4WGSyJMxeJt/Vw9lbZVjFWEmVJH/UkDhOrmy8PE9pCDkIDBkZv5SEXMv/srbpyw5vnvIzlu8X3EmssQ5s6QAAAAAa1UfcDTtRKNcazhMaHWRZOMuxlFxdcIfzVvrIXVz0Zqp8tCb3WHHz4hOze1Fh0DqG0wdHz8kBlXVWRLyTeKRwG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqQan1RcYx3TJKFZjmGkdXraLXrijm0ttXHNVWyEAAAAAirB6YPhh9DJLoFp4P5yU630paUWcpZu9gNfsedPWipUQouIYHEdvFEDB2N5tZhKGfh10G3s7f/PghvEiKcpI0QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYaKo+/xRHMxFeYPI0QbyKf3DPuNSgZVuNVUFeIyDswDCAAJAwAAAAAAAAAACAAFApDQAwAJEQEKAgMEBQYAAAsMAA0CDgcPGB2B6p0S/HGzhHKNdBMDAABWnZwkAAAAAAA=",
  "message": "infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1"
}

GET/api/tokens/:address

Retrieve a token

This endpoint allows you to retrieve a token by providing their address. Refer to the list at the top of this page to see which properties are included with token objects.

Request

GET
/api/tokens/infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1
curl -G https://blnk.fun/api/tokens/infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1

Response

{
  "name": "infiniteBLINK",
  "symbol": "INFINITE",
  "uri": "https://arweave.net/zwe-aVBjMUITk8gyy61hGG0Wd3u6uQjd2weqXe7vgCI",
  "description": "infiniteBLINK is the first test token that's forever tradable using only blinks.\nBuy the token on the bonding curve and sell at any time, all with a blink.\nTokens have infinite supply.",
  "image": "https://arweave.net/VOC8YtlDvt3f-5W762qvWDcDMCj-6kYfBt5HRI4A5Fc",
  "address": "infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1",
  "creator": "B1NKiifexipFc3gpxAN5WACY7aRupgJT7XeFJak7aosw",
  "decimals": 6,
  "supply": 860614180767312,
  "reserve": 123559227740,
  "views": 954740,
  "created_timestamp": 1720927740,
  "last_view_timestamp": 1723498811,
  "last_trade_timestamp": 1723466560,
  "external_url": null,
  "curve": {
    "address": "FCKUQodQxdUuTCYpXmLjXNNTy4zJNoCpHescXn8V2ApM",
    "c": 1e-12,
    "b": 0,
    "pow": 3,
    "frac": 5,
    "k0": null,
    "k1": null,
    "d": null,
    "interval": null
  }
}

POST/api/tokens/:address/buy

Buy a token

This endpoint allows you create a transaction to buy a token.

Required attributes

  • Name
    account
    Type
    string
    Description

    Base58-encoded public key of an account that may sign the transaction

  • Name
    amount
    Type
    number
    Description

    Amount of the token to buy. For SPL tokens, this is the amount in SOL to buy. For NFTs, this is the amount of NFTs.

Request

GET
/api/tokens/infiV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hHKNdBMDAABWnZwkAAAAAAA=",
  "message": "Sold INFINITE"
}

POST/api/tokens/:address/sell

Sell a token

This endpoint allows you create a transaction to sell a token.

Required attributes

  • Name
    account
    Type
    string
    Description

    Base58-encoded public key of an account that may sign the transaction

  • Name
    amount
    Type
    number
    Description

    Amount of the token to sell. For SPL tokens, this is the percentage of your tokens to sell. For NFTs, this is the amount of NFTs.

Request

GET
/api/tokens/infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1/buy
curl https://blnk.fun/api/tokens/infiVXrCfi3VCmiJnXRzKNoMZJqKwMpRfit3wWrVuB1/sell \
  -d account=B1NKiifexipFc3gpxAN5WACY7aRupgJT7XeFJak7aosw \
  -d amount=50

Response

{
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHD5Ss+p2/+Ru+yr0AGxJrjY2uhRCCpdKx8ezXXaM0yBAqHFQLWdCtO7LEq9LuXAbSLlAe0tuTbwZoenpvlJePjYkN8oc9iQ0i2JZQf6hQXmrQWHiDbHxdwBWPXmr80R6r8Aq0cxgWv9JqiwiwRay/nNqaloEh3gqK7E00q4jMgkik5ykwRC8t7kyZu1ogIGF1b9Y0UqRXcZBArQZhzCSeEu7QiR5c5qILNB+BSbyK5xBxr0oHwliWuzejfbbXu9WVk8RbE+rUEbZqZcqGCqGiL9n/MH6eeYrnZ8bW762S5u4WGSyJMxeJt/Vw9lbZVjFWEmVJH/UkDhOrmy8PE9pCDkIGtVH3A07USjXGs4TGh1kWTjLsZRcXXCH81b6yF1c9GaqfLQm91hx8+ITs3tRYdA6htMHR8/JAZV1VkS8k3ikcBt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkGp9UXGMd0yShWY5hpHV62i164o5tLbVxzVVshAAAAAIqwemD4YfQyS6BaeD+clOt9KWlFnKWbvYDX7HnT1oqVEKLiGBxHbxRAwdjebWYShn4ddBt7O3/z4IbxIinKSNEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJC+juIzHl2R1i5j6i238dNXR9aBu7YJIo4YoZcb6jc7AQgQAQkCAwQFBgAKCwAMAg0HDhqhUerd+eNfFAEAypo7AAAAACJz2j6GAwAAAAA=",
  "message": "Sold INFINITE"
}