Skip to main content
Battle API object contains both user attempts, and it is accessible for both opponents on every step of the battle flow. To get the results, use getBattle query. Query execution example:
query getBattle {
  getBattle(battleId: 1) {
    id
    questionsNumber
    created
    bonusPointsEnabled
    domain {
      id
      name
    }
    isAnonymized
  }
}
After the query is successfully executed, a Battle object will be returned.

Battle object

The object represents battle data.
ParameterTypeDescription
attemptBattleAttemptOptional. The current API user attempt (no matter if the user is the battle initiator or an opponent).
bonusPointsEnabledBooleanRequired. Indicator of bonus points that can be earned for the fast answer.
createdIntRequired. The timestamp when the battle was created.
ctaCtaOptional. The list of the available CTA for the current API user. Find the list of available options below.
domainTaxonomyTermRequired. A domain the battle relates to. The list of battle questions list depends on the domain.
idIDRequired. ID of the battle.
initiatorBattleRivalRequired. Represents the battle initiator data.
initiatorAttemptBattleAttemptRequired. The battle initiator’s attempt.
isAnonymizedBooleanRequired. A marker indicating that the battle results were anonymized (initials will be returned).
opponentBattleRivalRequired. Represents the battle opponent data.
opponentAttemptBattleAttemptOptional. The opponent’s attempt (if it is already started).
questionsNumberIntRequired. The total number of questions in the battle.

Battle CTAs

The list of available CTAs can differ depending on the battle status for the current API user.
Action IDDescriptionCorresponding mutation/query
CREATE_BATTLE_ATTEMPTAllows to create the battle attempt. Available for the opponent if their attempt is not created yet.createBattleAttempt
VIEW_BATTLE_RESULTSAllows to view the battle results. Available when the battle is completed by the current API user.getBattle