Space Access:

Campaign

Query campaign participants

Arguments:

NameDescription
idCampaign hash id.
pfirstQuery limit.
pafterQuery offset.

Request:

query campaignParticipants($id: ID!, $pfirst: Int!, $pafter: String!) {
  campaign(id: $id) {
    id
    numberID
    numNFTMinted
    participants {
      participants(first: $pfirst, after: $pafter) {
        list {
          address {
            username
            avatar
            address
            email
            solanaAddress
            aptosAddress
            seiAddress
            discordUserID
          }
        }
      }
      participantsCount
    }
  }
}

Variables:

{
  "id": "GCn45UjHXE",
  "pfirst": 1,
  "pafter": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCn45UjHXE",
      "numberID": 151178,
      "numNFTMinted": 0,
      "participants": {
        "participants": {
          "list": [
            {
              "address": {
                "username": "0xdoxes",
                "avatar": "https://source.boringavatars.com/marble/120/blunder8888@gmail.com",
                "address": "0x00000000ccd193975907ddb660b4692bb4257f9f",
                "email": "",
                "solanaAddress": "",
                "aptosAddress": "",
                "seiAddress": "",
                "discordUserID": ""
              }
            }
          ]
        },
        "participantsCount": 234163
      }
    }
  }
}

Query NFT holder by campaign

Arguments:

NameDescription
idCampaign hash id.
blockChain block.
firstQuery limit.
afterQuery offset.

Request:

query NFTHolders($id: ID!, $block: Int!, $first: Int!, $after: String!) {
  campaign(id: $id) {
    nftHolderSnapshot {
      holders(block: $block, first: $first, after: $after) {
        list {
          id
          holder
        }
        totalCount
        edges {
          node {
            id
            holder
          }
          cursor
        }
        pageInfo {
          startCursor
          endCursor
          hasNextPage
          hasPreviousPage
        }
      }
    }
  }
}

Variables:

{
  "id": "GCCw3UD1eD",
  "block": 47291627,
  "first": 1,
  "after": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "nftHolderSnapshot": {
        "holders": {
          "list": [
            {
              "id": "1",
              "holder": "0x102daf0f0b6c5f467dc0dab22c957c412e57b4aa"
            }
          ],
          "totalCount": 1,
          "edges": [
            {
              "node": {
                "id": "1",
                "holder": "0x102daf0f0b6c5f467dc0dab22c957c412e57b4aa"
              },
              "cursor": "1"
            }
          ],
          "pageInfo": {
            "startCursor": "1",
            "endCursor": "1",
            "hasNextPage": true,
            "hasPreviousPage": false
          }
        }
      }
    }
  }
}

Create campaigns

Arguments:

NameDescription
inputCampaign hash id.

Request:

mutation addCampaign($input: MutateCampaignInput!) {
  campaign(input: $input) {
    id
    numberID
    name
    claimEndTime
  }
}

Variables:

{
  "input": {
    "daoId": 2,
    "nftCoreId": 0,
    "name": "eeeeee",
    "description": "eeeeee",
    "thumbnail": "",
    "startTime": 1694793600,
    "endTime": 1698336000,
    "status": "Active",
    "formula": "",
    "cap": 1,
    "gasType": "Gas",
    "isPrivate": true,
    "type": "Bounty",
    "requireIntegrate": false,
    "nftTemplates": [],
    "tokenReward": {
      "tokenLogo": "",
      "tokenDecimal": "",
      "userTokenAmount": "",
      "tokenAddress": "",
      "tokenSymbol": "",
      "tokenRewardId": 0
    },
    "children": [],
    "distributionType": "RAFFLE",
    "rewardName": "ee",
    "credentialGroups": [
      {
        "conditions": [
          {
            "expression": "true"
          }
        ],
        "conditionRelation": "ALL",
        "rewards": [
          {
            "expression": "5",
            "rewardType": "LOYALTYPOINTS"
          },
          {
            "expression": "1",
            "rewardType": "CUSTOM"
          }
        ],
        "credentials": []
      }
    ],
    "taskConfig": {
      "rewardConfigs": []
    },
    "rewardType": "EVM",
    "rewardInfo": {}
  }
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCFEXUtxc1",
      "numberID": 5448,
      "name": "eeeeee",
      "claimEndTime": null
    }
  }
}

Claim OAT campaigns on third-party website

Use GraphQL API get campaign info

Request:

mutation claim {
  prepareParticipate(
    input: {
      signature: "" # keep empty
      campaignID: "{{campaignHashID}}" # campaign hash id
      address: "{{userAddr}}" # user address
    }
  ) {
    allow # Is allow user claim nft
    disallowReason # Disallow reason
  }
}

Response:

{
  "data": {
    "prepareParticipate": {
      "allow": true,
      "disallowReason": ""
    }
  }
}

Space

Query campaign list

Arguments:

NameDescription
idSpace id.
aliasSpace alias.
campaignInputCampaigns query params.

Request:

query CampaignList(
  $id: Int
  $alias: String
  $campaignInput: ListCampaignInput!
) {
  space(id: $id, alias: $alias) {
    id
    name
    alias
    campaigns(input: $campaignInput) {
      pageInfo {
        endCursor
        hasNextPage
      }
      list {
        id
        name
      }
    }
  }
}

Variables:

{
  "alias": "bnbchain",
  "campaignInput": {
    "forAdmin": false,
    "first": 2,
    "after": "-1",
    "excludeChildren": true,
    "gasTypes": null,
    "credSources": null,
    "rewardTypes": null,
    "chains": null,
    "statuses": null,
    "listType": "Newest",
    "types": [
      "Drop",
      "MysteryBox",
      "Forge",
      "MysteryBoxWR",
      "Airdrop",
      "ExternalLink",
      "OptIn",
      "OptInEmail",
      "PowahDrop",
      "Parent",
      "Oat",
      "Bounty",
      "Token",
      "DiscordRole",
      "Mintlist",
      "Points",
      "PointsMysteryBox"
    ],
    "searchString": null
  }
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "alias": "bnbchain",
      "campaigns": {
        "pageInfo": {
          "endCursor": "1",
          "hasNextPage": true
        },
        "list": [
          {
            "id": "GCU8jUP7RS",
            "name": "BNB Chain Ecosystem Catalyst Awards -  Trailblazers"
          },
          {
            "id": "GCis8Uj4gL",
            "name": "BNB Chain 3 YA NFT "
          }
        ]
      }
    }
  }
}

Query NFT holder by contract

Arguments:

NameDescription
addressContract address.
firstQuery limit.
afterQuery offset.

Request:

query nftHolders($address: String!, $first: Int!, $after: String!) {
  nftCore(address: $address) {
    holders(first: $first, after: $after) {
      totalCount
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
      }
      list {
        address
      }
    }
  }
}

Variables:

{
  "address": "0x9d3895D07bF07A791Ef8d015Ab10997D22179E5c",
  "first": 2,
  "after": "-1"
}

Response:

{
  "data": {
    "nftCore": {
      "holders": {
        "totalCount": 3,
        "pageInfo": {
          "startCursor": "0",
          "endCursor": "1",
          "hasNextPage": true,
          "hasPreviousPage": false
        },
        "list": [
          {
            "address": "0x000000000A38444e0a6E37d3b630d7e855a7cb13"
          },
          {
            "address": "0x00000015E180b01c40b881e10774Bc784bB6F4Eb"
          }
        ]
      }
    }
  }
}

Query leaderboard data

Overall

Arguments:

NameDescription
idSpace id.
pageSizeQuery limit.
cursorAfterYou don’t need to pass in this value on the first page. On the second page, you can start passing in the endCursor value returned by the first page.
orderSort by Points/GalxeID.
seasonIdQuery for season ranking. Overall ranking is null

Request:

query SpaceLeaderboard(
  $id: Int!,
  $pageSize: Int,
  $order: LoyaltyPointsRankOrder,
  $cursorAfter: String,
  $seasonId: Int
) {
  space(id: $id) {
    id
    name
    loyaltyPointsRanks(
      first: $pageSize
      order: $order
      cursorAfter: $cursorAfter
      sprintId: $seasonId
    ) {
      pageInfo {
        startCursor
        endCursor
        hasNextPage
        hasPreviousPage
        __typename
      }
      totalCount
      edges {
        node {
          id
          rank
          points
          space {
            name
            __typename
          }
          address {
            username
            id
            avatar
            address
            solanaAddress
            aptosAddress
            seiAddress
            twitterUserName
            discordUserName
            displayNamePref
            displayTwitter
            displayDiscord
            __typename
          }
          __typename
        }
        __typename
      }
      __typename
    }
    __typename
  }
}

Variables:

{
  "id": 40,
  "pageSize": 2,
  "cursorAfter": "Mg==",
  "order": "Points",
  "seasonId": null
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "loyaltyPointsRanks": {
        "pageInfo": {
          "startCursor": "Mw==",
          "endCursor": "NA==",
          "hasNextPage": true,
          "hasPreviousPage": true,
          "__typename": "PageInfo"
        },
        "totalCount": 5509,
        "edges": [
          {
            "node": {
              "id": "lbrank-DJkB89vLsPMm44LuraURi8-40",
              "rank": 2,
              "points": 180,
              "space": {
                "name": "BNB Chain",
                "__typename": "Space"
              },
              "address": {
                "username": "DJkB89vLsPMm44LuraURi8",
                "id": "DJkB89vLsPMm44LuraURi8",
                "avatar": "https://cdn.galxe.com/galaxy/score/c6096a05-45f3-4427-8961-3326f9812ae1.png",
                "address": "0x1fa5b7fc4da7777d211ed41d31f8b84735fd41b1",
                "solanaAddress": "",
                "aptosAddress": "",
                "seiAddress": "",
                "twitterUserName": "",
                "discordUserName": "",
                "displayNamePref": "USERNAME",
                "displayTwitter": false,
                "displayDiscord": false,
                "__typename": "Address"
              },
              "__typename": "LoyaltyPointsRank"
            },
            "__typename": "LoyaltyPointsRankEdge"
          },
          {
            "node": {
              "id": "lbrank-XHKvqqv82igAiiWjA7TEHH-40",
              "rank": 2,
              "points": 180,
              "space": {
                "name": "BNB Chain",
                "__typename": "Space"
              },
              "address": {
                "username": "tiepvien1111",
                "id": "XHKvqqv82igAiiWjA7TEHH",
                "avatar": "https://cdn.galxe.com/galaxy/score/30c28119-a45d-4591-ad22-436726404634.png",
                "address": "0x3739734419c979730fb0d0a4da42a840010e3cb1",
                "solanaAddress": "",
                "aptosAddress": "",
                "seiAddress": "",
                "twitterUserName": "",
                "discordUserName": "",
                "displayNamePref": "USERNAME",
                "displayTwitter": false,
                "displayDiscord": false,
                "__typename": "Address"
              },
              "__typename": "LoyaltyPointsRank"
            },
            "__typename": "LoyaltyPointsRankEdge"
          }
        ],
        "__typename": "LoyaltyPointsRankConnection"
      },
      "__typename": "Space"
    }
  }
}

Query leaderboard data for one address

Arguments:

NameDescription
idSpace id.
seasonIdQuery for season ranking. Overall ranking is null

Request:

query SpaceLoyaltyPoints(
  $id: Int,
  $address: String!,
  $seasonId: Int) {
  space(id: $id) {
    id
    addressLoyaltyPoints(address: $address, sprintId: $seasonId) {
      id
      points
      rank
    }
  }
}

Variables:

{
  "id": 40,
  "address": "0x1fa5b7fc4da7777d211ed41d31f8b84735fd41b1",
  "seasonId": null
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "addressLoyaltyPoints": {
        "id": "sa-lb-0x1fa5b7fc4da7777d211ed41d31f8b84735fd41b1-40",
        "points": 180,
        "rank": 2
      }
    }
  }
}

Distribute loyalty points

Prerequisite: generate an access token

mutation UpdateAccessToken($input: UpdateAccessTokenInput!) {
  updateAccessToken(input: $input) {
    accessToken
  }
}
{
  "input": {
    "address": "0x39b36ff83b60eb54d71758cffa3ab17d2d0b216c"
  }
}
{
  "data": {
    "updateAccessToken": {
      "access-token": "your-access-token"
    }
  }
}

Task Creation

Header:

{
  "access-token": "your-access-token"
}

Request:

mutation createTask {
  createTailoredTask(
    input: {
      title: "Connect to Galxe"
      description: "A user who connected to Galxe.com"
      link: "your_link"
      spaceId: 2
      tag: Once
      points: 10
      startTime: 0
    }
  ) {
    id
    title
    description
    link
    spaceId
    tag
    points
    startTime
  }
}

Response

{
  "data": {
    "createTailoredTask": {
      "id": "26",
      "title": "Connect to Galxe",
      "description": "A user who connected to Galxe.com",
      "link": "your_link",
      "spaceId": 2,
      "tag": "Once",
      "points": 10,
      "startTime": 0
    }
  }
}

Task Modification

Header:

{
  "access-token": "your-access-token"
}

Request:

mutation updateTask {
  updateTailoredTask(
    input: {
      id: 26
      title: "update task title"
      description: "desc"
      link: "your_link"
      points: 10
      tag: Once
      startTime: 0
    }
  )
}

Response:

{
  "data": {
    "updateTailoredTask": true
  }
}

Task Deletion

Header:

{
  "access-token": "your-access-token"
}

Request:

mutation deleteTask {
  deleteTailoredTask(id: 26)
}

Distributing Points via API

Request:

mutation {
  claimTailoredTaskLoyaltyPoints(
    id: 25
    addresses: [
      "0x447D24B00937BCc3fE5768c828fb2fae52c3e8C5"
      "0xaC1F963Ed7454d0D3295786E4Bcc47B961918C63"
    ]
  )
}

Response:

{
  "data": {
    "claimTailoredTaskLoyaltyPoints": true
  }
}

Credential

Query credential items

Header:

{
  "access-token": "your-access-token"
}
query CredItems($id: ID!, $first: Int, $after: String, $searchString: String) {
  credential(id: $id) {
    id
    itemCount
    credentialItems(first: $first, after: $after, searchString: $searchString) {
      totalCount
      pageInfo {
        endCursor
        hasNextPage
      }
      list
    }
  }
}

example variables:

{id: "2544", first: 500, after: ""}

Open Access:

User

Query profile and credential

query ProfileCredentials($address: String!, $first: Int, $after: String) {
  addressInfo(address: $address) {
    addressEligibleCredentials(first: $first, after: $after) {
      pageInfo {
        endCursor
        hasNextPage
      }
      totalCount
      list {
        id
        name
      }
    }
  }
}

Credential

Get credential value

Depends on credSource, metadata field should use corresponding field.

E.g. if credSource is SPACE_USER, then the query should look like the following:

query credential($id: ID!, $eligibleAddress: String!) {
  credential(id: $id, eligibleAddress: $eligibleAddress) {
    name
    credSource
    dimensionConfig
    metadata {
      spaceUsers {
        spaceId
        schema {
          follow {
            id
            description
            title
            type
          }
          points {
            id
            description
            title
            type
          }
          participations {
            id
            description
            title
            type
          }
        }
        defaultValue {
          follow
          points
          participations
        }
      }
    }
    value {
      address
      spaceUsers {
        follow
        points
        participations
      }
    }
  }
}

Campaign

Query campaign participants

Arguments:

NameDescription
idCampaign hash id.
pfirstQuery limit.
pafterQuery offset.

Request:

query campaignParticipants($id: ID!, $pfirst: Int!, $pafter: String!) {
  campaign(id: $id) {
    id
    numberID
    numNFTMinted
    participants {
      participants(first: $pfirst, after: $pafter) {
        list {
          address {
            username
            avatar
            address
            email
            solanaAddress
            aptosAddress
            seiAddress
            discordUserID
          }
        }
      }
      participantsCount
    }
  }
}

Variables:

{
  "id": "GCn45UjHXE",
  "pfirst": 1,
  "pafter": "-1"
}

Response:

{
  "data": {
    "campaign": {
      "id": "GCn45UjHXE",
      "numberID": 151178,
      "numNFTMinted": 0,
      "participants": {
        "participants": {
          "list": [
            {
              "address": {
                "username": "0xdoxes",
                "avatar": "https://source.boringavatars.com/marble/120/blunder8888@gmail.com",
                "address": "0x00000000ccd193975907ddb660b4692bb4257f9f",
                "email": "",
                "solanaAddress": "",
                "aptosAddress": "",
                "seiAddress": "",
                "discordUserID": ""
              }
            }
          ]
        },
        "participantsCount": 234163
      }
    }
  }
}

Space

Query campaign list

Arguments:

NameDescription
idSpace id.
aliasSpace alias.
campaignInputCampaigns query params.

Request:

query CampaignList(
  $id: Int
  $alias: String
  $campaignInput: ListCampaignInput!
) {
  space(id: $id, alias: $alias) {
    id
    name
    alias
    campaigns(input: $campaignInput) {
      pageInfo {
        endCursor
        hasNextPage
      }
      list {
        id
        name
      }
    }
  }
}

Variables:

{
  "alias": "bnbchain",
  "campaignInput": {
    "forAdmin": false,
    "first": 2,
    "after": "-1",
    "excludeChildren": true,
    "gasTypes": null,
    "credSources": null,
    "rewardTypes": null,
    "chains": null,
    "statuses": null,
    "listType": "Newest",
    "types": [
      "Drop",
      "MysteryBox",
      "Forge",
      "MysteryBoxWR",
      "Airdrop",
      "ExternalLink",
      "OptIn",
      "OptInEmail",
      "PowahDrop",
      "Parent",
      "Oat",
      "Bounty",
      "Token",
      "DiscordRole",
      "Mintlist",
      "Points",
      "PointsMysteryBox"
    ],
    "searchString": null
  }
}

Response:

{
  "data": {
    "space": {
      "id": "40",
      "name": "BNB Chain",
      "alias": "bnbchain",
      "campaigns": {
        "pageInfo": {
          "endCursor": "1",
          "hasNextPage": true
        },
        "list": [
          {
            "id": "GCU8jUP7RS",
            "name": "BNB Chain Ecosystem Catalyst Awards -  Trailblazers"
          },
          {
            "id": "GCis8Uj4gL",
            "name": "BNB Chain 3 YA NFT "
          }
        ]
      }
    }
  }
}