API Documentation (1.0.0)

Download OpenAPI specification:Download

Auth

Exchange Firebase IdToken for system's access token

header Parameters
Google-Id-Token
required
string

Firebase IdToken to be exchanged for the system's access token

Responses

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Users

Retrieve current authenticated user's information

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "id": "123e4567-e89b-12d3-a456-426614174000",
  • "display_name": "John Doe",
  • "email": "[email protected]",
  • "authentication_provider": "sso",
  • "authentication_provider_id": "abcd1234",
  • "created_at": "2023-10-01T12:00:00Z",
  • "updated_at": "2023-10-15T15:30:00Z",
  • "role": "user",
  • "profile_picture_url": "https://example.com/images/johndoe.jpg",
  • "phone_number": "+1234567890",
  • "last_login": "2023-10-18T09:30:00Z",
  • "status": "active",
  • "open_id": "1234567890"
}

Retrieve authenticated user's voting history

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Search for a user by ID

Authorizations:
bearerAuth
query Parameters
open_id
required
string

Responses

Response samples

Content type
application/json
{
  • "user_id": "user_12345",
  • "display_name": "John Doe"
}

Gold

Retrieve current user's gold balance

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "gold": 100
}

Purchase gold for the current user

Authorizations:
bearerAuth
Request Body schema: application/json
required
amount
integer

Amount of gold to purchase

purchase_token
string

A token representing the in-app purchase (e.g., from the app store)

app_identifier
string

The unique identifier of the app where the purchase was made

purchase_channel
string

The channel used for the purchase (e.g., 'google_play', 'apple_app_store')

Responses

Request samples

Content type
application/json
{
  • "amount": 0,
  • "purchase_token": "string",
  • "app_identifier": "string",
  • "purchase_channel": "string"
}

Response samples

Content type
application/json
{
  • "gold": 150
}

Retrieve current user's gold transaction history

Authorizations:
bearerAuth
query Parameters
limit
integer

Number of transactions to return (default: 10)

offset
integer

Offset for pagination (default: 0)

Responses

Response samples

Content type
application/json
{
  • "transactions": [
    ]
}

Diamond

Retrieve current user's diamond balance

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "diamond": 50
}

Retrieve current user's diamond transaction history

Authorizations:
bearerAuth
query Parameters
limit
integer

Number of transactions to return (default: 10)

offset
integer

Offset for pagination (default: 0)

Responses

Response samples

Content type
application/json
{
  • "transactions": [
    ]
}

Topics

List topics

Authorizations:
bearerAuth
query Parameters
tags
Array of strings
sort
string
Enum: "largest_gold" "largest_voters" "latest" "oldest"

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Create a voting topic

Authorizations:
bearerAuth
Request Body schema: application/json
required
headline
string

Title of the voting topic

description
string

Details about the topic

result_measurement_method
string

Method to measure the result

result_date
string <date-time>

Date when the result will be announced

related_resources
Array of strings <uri> [ items <uri > ]

Responses

Request samples

Content type
application/json
{
  • "headline": "Best City to Visit in 2024",
  • "description": "Vote for the best travel destination city for 2024.",
  • "result_measurement_method": "majority",
  • "result_date": "2024-12-31T23:59:59Z",
}

Response samples

Content type
application/json
{
  • "topic_id": "topic_12345",
  • "status": "reviewing",
  • "creator": {
    }
}

Add choices to a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
choice_label
string

Human-readable label for the choice

choice_description
string

Detailed description of the choice

Responses

Request samples

Content type
application/json
{
  • "choice_label": "Paris",
  • "choice_description": "The city of lights, known for its culture and history."
}

Response samples

Content type
application/json
{
  • "choice_id": "choice_001"
}

Get detailed information about a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string

Responses

Response samples

Content type
application/json
{
  • "topic_id": "topic_12345",
  • "headline": "Best City to Visit in 2024",
  • "description": "Vote for the best travel destination city for 2024.",
  • "creator": {
    },
  • "result_measurement_method": "majority",
  • "result_date": "2024-12-31T23:59:59Z",
  • "result": {
    },
  • "result_history": [
    ],
  • "choices": [
    ],
  • "status": "voting",
  • "gold_staked": 1000,
  • "voters_count": 50,
}

Set the result of a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
result_choice_id
string

The ID of the choice that is the result

Responses

Request samples

Content type
application/json
{
  • "result_choice_id": "choice_001"
}

Response samples

Content type
application/json
{
  • "result_choice_id": "choice_001"
}

Get highest reward potential for user

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
choice_id
string

ID of the choice

gold_staked
number

Number of gold to be staked

Responses

Request samples

Content type
application/json
{
  • "choice_id": "string",
  • "gold_staked": 0
}

Response samples

Content type
application/json
{
  • "highest_reward": 500
}

Voting

Vote on a topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
choice_id
string

The ID of the choice the user is voting for

gold_staked
integer

Amount of gold the user is staking

Responses

Request samples

Content type
application/json
{
  • "choice_id": "choice_001",
  • "gold_staked": 100
}

Response samples

Content type
application/json
{
  • "vote_id": "vote_54321"
}

Appeal the result of a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
reason
string

The reason for appealing the result

Responses

Request samples

Content type
application/json
{
  • "reason": "The result doesn't reflect the majority's vote."
}

Response samples

Content type
application/json
{
  • "status": "pending"
}

Results

Set the result of a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
result_choice_id
string

The ID of the choice that is the result

Responses

Request samples

Content type
application/json
{
  • "result_choice_id": "choice_001"
}

Response samples

Content type
application/json
{
  • "result_choice_id": "choice_001"
}

Rewards

Get highest reward potential for user

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
choice_id
string

ID of the choice

gold_staked
number

Number of gold to be staked

Responses

Request samples

Content type
application/json
{
  • "choice_id": "string",
  • "gold_staked": 0
}

Response samples

Content type
application/json
{
  • "highest_reward": 500
}

Claim rewards (diamonds) for winning a voting topic

Authorizations:
bearerAuth
path Parameters
topic_id
required
string

Responses

Response samples

Content type
application/json
{
  • "status": "success",
  • "diamonds_received": 150
}

Admin

Review a voting topic (approve or deny)

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
action
string
Enum: "approve" "deny"

Action to approve or deny the topic

Responses

Request samples

Content type
application/json
{
  • "action": "approve"
}

Response samples

Content type
application/json
{
  • "status": "voting"
}

Approve or deny a topic result

Authorizations:
bearerAuth
path Parameters
topic_id
required
string
Request Body schema: application/json
required
action
string
Enum: "approve" "deny"

Action to approve or deny the result

Responses

Request samples

Content type
application/json
{
  • "action": "approve"
}

Response samples

Content type
application/json
{
  • "status": "approved"
}

Friends

Add a user to the friend list

Authorizations:
bearerAuth
Request Body schema: application/json
required
user_id
string

The ID of the user to add as a friend

Responses

Request samples

Content type
application/json
{
  • "user_id": "user_12345"
}

Response samples

Content type
application/json
{
  • "status": "User added to friend list"
}

Get list of friends

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Gifts

Get list of available gifts

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Purchase and send a gift

Authorizations:
bearerAuth
path Parameters
gift_id
required
string
Request Body schema: application/json
required
recipient_user_id
string

The ID of the friend receiving the gift

Responses

Request samples

Content type
application/json
{
  • "recipient_user_id": "user_67890"
}

Response samples

Content type
application/json
{
  • "status": "Gift sent successfully"
}

List of gifts received

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Claim a received gift and receive gold

Authorizations:
bearerAuth
path Parameters
gift_id
required
string

Responses

Response samples

Content type
application/json
{
  • "status": "Gift claimed successfully",
  • "gold_received": 100
}