> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get battle results

`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:

<CodeGroup>
  ```filename GraphQL Get battle query theme={null}
  query getBattle {
    getBattle(battleId: 1) {
      id
      questionsNumber
      created
      bonusPointsEnabled
      domain {
        id
        name
      }
      isAnonymized
    }
  }
  ```

  ```File Get battle query result [expandable] theme={null}
  {
    "data": {
      "getBattle": {
        "id": "1",
        "questionsNumber": 5,
        "created": 1775148819,
        "bonusPointsEnabled": true,
        "domain": {
          "id": 2,
          "name": "Geography"
        },
        "isAnonymized": false
      }
    }
  }
  ```
</CodeGroup>

After the query is successfully executed, a `Battle` object will be returned.

## `Battle` object

The object represents battle data.

| Parameter            | Type                                                                                | Description                                                                                                                     |
| :------------------- | :---------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
| `attempt`            | [`BattleAttempt`](/OpignoEnterpriseAPI/Battle/RespondToBattle#battleattempt-object) | **Optional**. The current API user attempt (no matter if the user is the battle initiator or an opponent).                      |
| `bonusPointsEnabled` | `Boolean`                                                                           | **Required**. Indicator of bonus points that can be earned for the fast answer.                                                 |
| `created`            | `Int`                                                                               | **Required**. The timestamp when the battle was created.                                                                        |
| `cta`                | `Cta`                                                                               | **Optional**. The list of the available CTA for the current API user. Find the list of available options [below](#battle-ctas). |
| `domain`             | `TaxonomyTerm`                                                                      | **Required**. A domain the battle relates to. The list of battle questions list depends on the domain.                          |
| `id`                 | `ID`                                                                                | **Required**. ID of the battle.                                                                                                 |
| `initiator`          | `BattleRival`                                                                       | **Required**. Represents the battle initiator data.                                                                             |
| `initiatorAttempt`   | [`BattleAttempt`](/OpignoEnterpriseAPI/Battle/RespondToBattle#battleattempt-object) | **Required**. The battle initiator's attempt.                                                                                   |
| `isAnonymized`       | `Boolean`                                                                           | **Required**. A marker indicating that the battle results were anonymized (initials will be returned).                          |
| `opponent`           | `BattleRival`                                                                       | **Required**. Represents the battle opponent data.                                                                              |
| `opponentAttempt`    | [`BattleAttempt`](/OpignoEnterpriseAPI/Battle/RespondToBattle#battleattempt-object) | **Optional**. The opponent's attempt (if it is already started).                                                                |
| `questionsNumber`    | `Int`                                                                               | **Required**. 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 ID               | Description                                                                                          | Corresponding mutation/query                                         |
| :---------------------- | :--------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------- |
| `CREATE_BATTLE_ATTEMPT` | Allows to create the battle attempt. Available for the opponent if their attempt is not created yet. | [`createBattleAttempt`](/OpignoEnterpriseAPI/Battle/RespondToBattle) |
| `VIEW_BATTLE_RESULTS`   | Allows to view the battle results. Available when the battle is completed by the current API user.   | [`getBattle`](/OpignoEnterpriseAPI/Battle/GetBattle)                 |
