Airdrop API

This page describes the usage of the airdrop endpoints

Airdrop Endpoint Documentation

Endpoint Overview

The Airdrop Parsing Endpoint allows users to upload a CSV file containing airdrop data for parsing and analysis. This functionality is essential for effectively managing airdrops and ensuring accurate data processing within the TokenInfo.AI platform.

Endpoint

POST /airdrop/parse

Request Parameters

Body Parameters

  • file:

    • Type: File (CSV)

    • Description: The CSV file containing airdrop addresses and amounts. This file is mandatory for the request.

  • tokenAddress:

    • Type: String

    • Description: The smart contract address of the token being airdropped. This parameter is required.

  • chain:

    • Type: Number (optional)

    • Description: The blockchain network on which the token exists. Defaults to 1 (Ethereum) if not provided.

Request Example

Here is an example of how to structure the request:

POST /airdrop/parse
Content-Type: multipart/form-data

{
  "file": [CSV file],
  "tokenAddress": "0xYourTokenAddress",
  "chain": 1 // optional
}

Response

The response from the endpoint will vary depending on the success or failure of the request.

Success Response

  • Status Code: 200 OK

  • Response Body:

{
  "status": true,
  "data": [
    {
      "address": "0xAddress1",
      "amount": 1000000000000000000 // Amount in the smallest unit
      "cliff": 864000 //cliff period in secs
      "interval": ['50', '50'] //an array of interval
      "start": 1721064674036 //start date
    }
  ]
}

Error Responses

  1. Missing File

    • Status Code: 400 Bad Request

    • Response Body:

    {
      "error": "No file sent"
    }
  2. Missing Parameters

    • Status Code: 400 Bad Request

    • Response Body:

    {
      "error": "Missing parameters",
      "expecting": "tokenAddress"
    }
  3. Wrong File Type

    • Status Code: 400 Bad Request

    • Response Body:

    {
      "error": "Wrong file type",
      "expecting": "csv",
      "sent": "application/json"
    }
  4. Internal Server Error

    • Status Code: 500 Internal Server Error

    • Response Body:

    {
      "error": "An internal server error occurred"
    }

Additional Information

  • The CSV file should contain two columns:

    1. Address: The recipient's wallet address.

    2. Amount: The amount of tokens to be airdropped.

  • The amount is automatically converted to the smallest unit based on the token's decimal places retrieved from the blockchain.

Airdrop Mint Address Endpoint Documentation

This endpoint is useful for creating Solana airdrop instructions by obtaining the associated token address for a specific user.

Endpoint

POST /airdrop/mint/address

Request Parameters

Body Parameters

  • tokenAddress:

    • Type: String

    • Description: The mint address of the token. This parameter is required.

  • userAddress:

    • Type: String

    • Description: The user address of the sender. This parameter is required.

  • type:

    • Type: String (optional)

    • Description: The type of token program to use. Defaults to "token". Use "token_22" for the TOKEN_2022_PROGRAM_ID.

Request Example

Here is an example of how to structure the request:

POST /airdrop/mint/address
Content-Type: application/json

{
  "tokenAddress": "0xYourMintAddress",
  "userAddress": "0xYourUserAddress",
  "type": "token" // optional
}

Response

The response from the endpoint will vary depending on the success or failure of the request.

Success Response

  • Status Code: 200 OK

  • Response Body:

{
  "status": true,
  "mint": "0xUserMintAddress",
  "tokenProgram": "TokenProgramID"
}

Error Responses

  1. Missing Parameters

    • Status Code: 400 Bad Request

    • Response Body:

    {
      "error": "Missing parameters",
      "expecting": {
        "tokenAddress": "0xYourMintAddress",
        "userAddress": "0xYourUserAddress"
      }
    }
  2. Internal Server Error

    • Status Code: 500 Internal Server Error

    • Response Body:

    {
      "error": "An internal server error occurred"
    }

Example

Here is an example of how to use the endpoint to get the mint address of a user:

POST /airdrop/mint/address
Content-Type: application/json

{
  "tokenAddress": "0xYourMintAddress",
  "userAddress": "0xYourUserAddress"
}

Example Response

{
  "status": true,
  "mint": "0xUserMintAddress",
  "tokenProgram": "TokenProgramID"
}

By utilizing the Airdrop Mint Address Endpoint, users can efficiently retrieve the mint address associated with a specific user on the Solana network, enabling smooth and effective creation of airdrop instructions within the TokenInfo.AI platform. By utilizing the Airdrop Parsing Endpoint, users can efficiently handle airdrop data and integrate it into their crypto projects with ease and accuracy.

Last updated