Quest Protocol
  • Introduction
    • Welcome to Quest Protocol
    • Integrate & Partner with Quest
    • Use Cases
      • Creator Platforms
      • Gaming
      • NFT Marketplaces
      • Social Media DApps
      • DeFi
  • QUEST PLATFORM
    • Creating a Campaign
    • Audience Overview
    • User Profile
    • Discover Page
    • Perk Store
    • Integrations
    • Memberships
    • Segmentation & Targetting
    • AI Insights
  • QUEST PROTOCOL - SDKs & APIs
    • UI SDK Components
      • Embedded XP Points
      • Embedded in-dApp Guides
      • Embedded Web3 Search
      • Embedded Quests
    • Quest SDKs & APIs
      • User
      • Entity
      • Badge
      • Campaign
      • App Metric
      • Membership Card
      • Entity Tag
      • Membership Tier
      • Skill
      • Entity Credit Tier
      • Gem
      • Custom Reward
      • Entity Gem
      • Entity Alert
      • Entity Feature Flag
      • Entity Data contract
      • Entity Authentication Token
      • Event Metric Mapping
    • Data Engine
  • Website
  • Quest Thesis
Powered by GitBook
On this page
  1. QUEST PROTOCOL - SDKs & APIs
  2. Quest SDKs & APIs

Badge

PreviousEntityNextCampaign

Last updated 1 year ago

Get all badges of a user

get

This endpoint retrives all the badges that the user is associated with.

Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
Responses
200
Successful response
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/badges HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
Accept: */*
{
  "success": true,
  "data": [
    {
      "data": {
        "xp": 10,
        "visibility": "OPEN",
        "type": "NONE",
        "remainingCount": 100,
        "createdAt": "2023-05-26T14:44:19.220Z",
        "badgeId": "dummy-id",
        "entityId": "e-000001",
        "name": "dummy-badge-name",
        "imageIPFS": "QmXdzQQ238rkdiM7i9YgXXEtm5n3Fypw9r6QPVtwjNMGzW",
        "description": "dummy-description",
        "skills": [
          {
            "skillId": "123",
            "score": 123
          }
        ],
        "badgeContractTokenId": "dummy-token",
        "endsAt": 1685198841965,
        "typeData": [
          "t"
        ],
        "proofType": "Proof of Appreciation",
        "createdBy": "u-0000001"
      },
      "inDyNFT": false,
      "claimed": false,
      "claimStatus": "UNCLAIMED"
    }
  ]
}

Get all badges created by a user

get

This endpoint retrives all the badges a user has created.

Path parameters
userIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/users/{userId}/created-badges HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": [
    {
      "data": {
        "xp": 10,
        "visibility": "OPEN",
        "type": "NONE",
        "remainingCount": 100,
        "createdAt": "2023-05-26T14:44:19.220Z",
        "badgeId": "dummy-id",
        "entityId": "e-000001",
        "name": "dummy-badge-name",
        "imageIPFS": "QmXdzQQ238rkdiM7i9YgXXEtm5n3Fypw9r6QPVtwjNMGzW",
        "description": "dummy-description",
        "skills": [
          {
            "skillId": "123",
            "score": 123
          }
        ],
        "badgeContractTokenId": "dummy-token",
        "endsAt": 1685198841965,
        "typeData": [
          "t"
        ],
        "proofType": "Proof of Appreciation",
        "createdBy": "u-0000001"
      },
      "inDyNFT": false,
      "claimed": false,
      "claimStatus": "UNCLAIMED"
    }
  ]
}

Get all badges of an entity

get

This endpoint retrives all the badges associated with an entity.

Path parameters
entityIdstringRequired
Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
Responses
200
Successful response
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/badges HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
Accept: */*
{
  "success": true,
  "data": [
    {
      "data": {
        "xp": 10,
        "visibility": "OPEN",
        "type": "NONE",
        "remainingCount": 100,
        "createdAt": "2023-05-26T14:44:19.220Z",
        "badgeId": "dummy-id",
        "entityId": "e-000001",
        "name": "dummy-badge-name",
        "imageIPFS": "QmXdzQQ238rkdiM7i9YgXXEtm5n3Fypw9r6QPVtwjNMGzW",
        "description": "dummy-description",
        "skills": [
          {
            "skillId": "123",
            "score": 123
          }
        ],
        "badgeContractTokenId": "dummy-token",
        "endsAt": 1685198841965,
        "typeData": [
          "t"
        ],
        "proofType": "Proof of Appreciation",
        "createdBy": "u-0000001"
      },
      "inDyNFT": false,
      "claimed": false,
      "claimStatus": "UNCLAIMED"
    }
  ]
}

Get badge details of an entity

get

This endpoint retrives the badge details associated with an entity.

Path parameters
entityIdstringRequired
badgeIdstringRequired
Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/badges/{badgeId} HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": {
    "badge_data": {
      "badgeId": "badge123",
      "entityId": "entity123",
      "badgeContractTokenId": "token123",
      "name": "My Badge",
      "imageIPFS": "https://example.com/badge-image.jpg",
      "description": "This is my badge description.",
      "xp": 100,
      "skills": [
        {
          "skillId": "skill1",
          "score": 80
        },
        {
          "skillId": "skill2",
          "score": 60
        }
      ],
      "isEnabled": true,
      "visibility": "LIMITED",
      "type": "DISCORD",
      "typeData": {
        "key1": "value1",
        "key2": "value2"
      },
      "proofType": "Type A",
      "endsAt": 1678900000,
      "remainingCount": 5,
      "createdBy": "user123",
      "createdAt": "2023-06-27T12:45:00Z"
    },
    "skills_data": [
      {
        "skillId": "skil-12",
        "score": 20,
        "name": "Java",
        "description": "sun-microsystem's java",
        "isEnabled": true
      }
    ],
    "entity_data": {
      "id": "entity123",
      "entityURLAlias": "my-entity",
      "entityRecordIds": [
        "record1",
        "record2"
      ],
      "contracts": [
        "contract1",
        "contract2"
      ],
      "badgeContractAddress": "0x123abc",
      "dyNFTContractAddress": "0x456def",
      "themeContractAddress": "0x789ghi",
      "name": "My Entity",
      "openseaSlug": "my-entity-slug",
      "description": "This is my entity description.",
      "twitter": "myentity",
      "discord": "myentity#1234",
      "telegram": "myentity",
      "instagram": "myentity",
      "website": "https://myentity.com",
      "medium": "myentity",
      "imageUrl": "https://example.com/myentity.jpg",
      "bannerUrl": "https://example.com/myentity-banner.jpg",
      "isEnabled": false,
      "isPrivate": false,
      "chainSource": "OFF_CHAIN",
      "defaultDyNftThemeId": "0",
      "discordQuestWebhookURL": "https://example.com/discord-webhook",
      "modifiedAt": "2023-06-27T12:45:00Z",
      "createdAt": "2023-06-25T09:00:00Z",
      "plan": "FREE",
      "theme": {},
      "parentEntityId": "e-0000001"
    },
    "claimedUsers": [
      {
        "userId": "user-123"
      }
    ],
    "unclaimedUsers": [
      {
        "userId": "user-123"
      }
    ],
    "isOwner": true,
    "stats": {
      "claimedCount": 10,
      "unclaimedCount": 5
    },
    "claimStatus": "NOT_WHITELISTED"
  }
}

Get Badges Count for User

get

Retrieve the number of badges earned by a specific user within a particular entity.

Path parameters
entityIdstringRequired

The unique identifier of the entity.

userIdstringRequired

The unique identifier of the user within the entity.

Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/users/{userId}/badges-count HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": 5
}

Get User Earned Badges for Entity

get

Retrieve the badges earned by a specific user within a particular entity.

Path parameters
entityIdstringRequired

The unique identifier of the entity.

userIdstringRequired

The unique identifier of the user within the entity.

Query parameters
prefixBadgeIpfsstringOptional

Specify 'true' to prefix Badge IPFS URLs with the base URL.

pageintegerOptional

The page number for paginated results (default: 1).

limitintegerOptional

The number of items per page (default: 20).

Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/users/{userId}/badges HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": [
    {
      "badgeId": "badge123",
      "entityId": "entity123",
      "badgeContractTokenId": "token123",
      "name": "My Badge",
      "imageIPFS": "https://example.com/badge-image.jpg",
      "description": "This is my badge description.",
      "xp": 100,
      "skills": [
        {
          "skillId": "skill1",
          "score": 80
        },
        {
          "skillId": "skill2",
          "score": 60
        }
      ],
      "isEnabled": true,
      "visibility": "LIMITED",
      "type": "DISCORD",
      "typeData": {
        "key1": "value1",
        "key2": "value2"
      },
      "proofType": "Type A",
      "endsAt": 1678900000,
      "remainingCount": 5,
      "createdBy": "user123",
      "createdAt": "2023-06-27T12:45:00Z"
    }
  ],
  "page": 1,
  "totalCount": 10,
  "totalPages": 1
}
  • GETGet all badges of a user
  • GETGet all badges created by a user
  • GETGet all badges of an entity
  • POSTAdd badge for an entity
  • GETGet badge details of an entity
  • POSTUpdate badge
  • POSTClaim badge for an entity
  • POSTAdd users to badge
  • GETGet Badges Count for User
  • GETGet User Earned Badges for Entity

Add badge for an entity

post

This endpoint adds a badge for an entity.

Path parameters
entityIdstringRequired
Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
tokenstringRequired

The token for user authentication.

Example: dummy-token
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
Body
namestringRequiredExample: dummy-name
imageIPFSstringRequiredExample: dummy-hash
descriptionstringRequiredExample: dummy-description
userIdsstring[]OptionalExample: u-00000001
endsAtinteger · int64OptionalExample: 1685198841965
xpnumberOptionalExample: 0
airdropEnabledbooleanOptionalExample: false
typeDataobjectOptional
typestringOptionalExample: NONE
totalCountnumberOptionalExample: 10
visibilitystringOptionalExample: LIMITED
proofTypestringOptionalExample: dummy proof
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/badges HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
token: dummy-token
userid: dummy-userid
Content-Type: application/json
Accept: */*
Content-Length: 297

{
  "name": "dummy-name",
  "imageIPFS": "dummy-hash",
  "description": "dummy-description",
  "skills": [
    {
      "skillId": "dummy-id",
      "score": 100
    }
  ],
  "userIds": [
    "u-00000001"
  ],
  "endsAt": 1685198841965,
  "xp": 0,
  "airdropEnabled": false,
  "typeData": {},
  "type": "NONE",
  "totalCount": 10,
  "visibility": "LIMITED",
  "proofType": "dummy proof"
}
{
  "success": true,
  "badgeId": "badge-1212122"
}

Update badge

post

This endpoint updates a badge of an entity.

Path parameters
entityIdstringRequired
badgeIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
namestringOptionalExample: dummy badge
imageIPFSstringOptionalExample: ipfa-hash
descriptionstringOptionalExample: updated the description
typestringOptionalExample: DISCORD
endsAtnumberOptionalExample: 720000
xpnumberOptionalExample: 20
typeDataobjectOptional
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/badges/{badgeId}/update HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 183

{
  "name": "dummy badge",
  "imageIPFS": "ipfa-hash",
  "description": "updated the description",
  "type": "DISCORD",
  "skills": [
    {
      "skillId": "java",
      "score": 100
    }
  ],
  "endsAt": 720000,
  "xp": 20,
  "typeData": {}
}
{
  "success": true
}

Claim badge for an entity

post

This endpoint allows users to claim a badge for an entity

Path parameters
entityIdstringRequired
badgeIdstringRequired
Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
addToDynamicNFTbooleanOptionalExample: true
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/badges/{badgeId}/claim HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 24

{
  "addToDynamicNFT": true
}
{
  "success": true,
  "nftMinted": true,
  "calculatedDynamicNFT": true
}

Add users to badge

post

This endpoint allows an admin to add users to a Badge.

Path parameters
entityIdstringRequired
badgeIdstringRequired
Query parameters
userIdstringRequired

The Id of the user performing the request.

Example: dummy-userid
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
userIdsstring[]RequiredExample: ["user-1","user-2"]
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/badges/{badgeId}/users HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 31

{
  "userIds": [
    "user-1",
    "user-2"
  ]
}
{
  "success": true
}