Complete Quest

Complete a quest for a user and award the associated rewards

Complete Quest

This endpoint allows you to mark a quest as completed for a user and award the associated rewards.

Authentication

To access this endpoint, you must include an Authorization header with your API key:

Authorization: YOUR_API_KEY

Endpoint

POST /api/v1/completeQuest

Request Body

{
  "customerId": "string",     // Required: The unique identifier for the user
  "questId": "string",        // Required: The ID of the quest to complete
  "twitterUsername": "string" // Required only for twitter-follow quests: The username of the user completing the quest (without @ symbol)
}

Response

Success Response (200 OK)

{
  "questId": "string",
  "customerId": "string",
  "status": "success",
  "newRewardsBalance": number,
  "txId": "string"
}

Error Responses

  • 400 Bad Request

    {
      "error": "Invalid body",
      "details": {
        // Validation error details
      }
    }
    
    • When the request body is invalid
    • When the quest is not yet active
    • When the quest has ended
    • When the user has already completed a standard quest
    • When the user has already completed a daily quest today (resets at 00:00 UTC)
    • When the Twitter username is missing for twitter-follow quests
    • When the Twitter username starts with @ (should be provided without @)
    • When the user has not followed the required Twitter account
  • 403 Forbidden

    {
      "error": "No API Key in request"
    }
    
    • When no API key is provided
    • When the API key is invalid
    • When the endpoint is not allowed with your current subscription plan
  • 429 Too Many Requests

    {
      "error": "You have reached the quest user limit"
    }
    
    • When you've reached your plan's user limit
    • When you've reached your plan's transaction limit
  • 500 Internal Server Error

    {
      "error": "An unexpected error occurred",
      "details": "Error message"
    }
    

Rate Limits

Rate limits vary by subscription plan:

  • Grow Plan: 100 API calls per minute
  • Pro Plan: 500 API calls per minute
  • Enterprise Plan: Unlimited API calls

Quest Types

The endpoint supports different types of quests:

Standard Quests

  • Can only be completed once per user
  • No additional parameters required

Daily Quests

  • Can be completed once per day per user
  • Resets at 00:00 UTC
  • No additional parameters required

Social Quests

Currently supports:

Twitter Follow Quests

  • Requires the user to follow a specific Twitter account
  • Additional required parameter: twitterUsername (without @ symbol)
  • Verifies that the user has actually followed the specified account
  • Can only be completed once per user
  • The account to follow is configured in the quest settings

Notes

  • For standard quests and social quests, a user can only complete each quest once
  • Daily quests can be completed once per day (resets at 00:00 UTC)
  • The endpoint will automatically create a new user if the provided customerId doesn't exist
  • The response includes the new balance of rewards after completing the quest
  • Twitter usernames must be provided without the @ symbol
  • Social quest verification is performed in real-time