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

# Check Missions

> Checks whether the user has completed all of the actions that make up a mission, and whether they have already been rewarded for completing the mission.

<video autoPlay muted controls loop playsInline className="w-full" src="https://mintcdn.com/openformat/vGurOUJG2onkcsD3/assets/nodes/check-missions.mp4?fit=max&auto=format&n=vGurOUJG2onkcsD3&q=85&s=bfd31082ca2df7caebc2088afb27b663" data-path="assets/nodes/check-missions.mp4" />

## Node Inputs

| Key        | Description                                                                                                                  |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `API Key`  | Your OPENFORMAT API Key. which can be created in the [Dashboard](https://app.openformat.tech/home/settings).                 |
| `dApp ID`  | The ID for your OPENFORMAT dApp, you can create a dApp in the OPENFORMAT [Dashboard](https://app.openformat.tech/home/apps). |
| `User ID`  | The address of the user, which will be their existing web3 account address.                                                  |
| `Missions` | The list of missions to check for.                                                                                           |

### Missions Example

My example app is designed to help users run their first 10km by completing 1km runs.
Each time a user completes a 1km run, we use the [Reward XP](./reward-xp) node to complete the `complete_run` action.
Once they complete the `complete_run` action a specific amount of times, they will complete a mission. We use the following mission configuration:

```json theme={null}
[
  {
    "name": "Complete First Run",
    "requirements": [{ "action_name": "complete_run", "count": 1 }],
    "xp_reward_amount": 100,
    "badge_reward_id": "INSERT_COMPLETE_FIRST_RUN_BADGE_ID"
  },
  {
    "name": "Run 5k",
    "requirements": [{ "action_name": "complete_run", "count": 5 }],
    "xp_reward_amount": 200,
    "badge_reward_id": "INSERT_COMPLETE_5K_RUN_BADGE_ID"
  },
  {
    "name": "Run 10k",
    "requirements": [{ "action_name": "complete_run", "count": 10 }],
    "xp_reward_amount": 1000,
    "badge_reward_id": "INSERT_COMPLETE_10K_RUN_BADGE_ID"
  }
]
```

**In this configuration:**

* **First Mission: `complete_first_run`**

  * **Requirements**: The user must complete their first run (`complete_run` action) once.
  * **Rewards**: Upon completion, the user earns 100 XP and receives a badge identified by `BADGE_ID_FIRST_RUN`.

* **Second Mission: `run_5k`**

  * **Requirements**: The user must complete five runs (`complete_run` action) in total.
  * **Rewards**: Upon completion, the user earns 200 XP and receives a badge identified by `BADGE_ID_RUN_5K`.

* **Third Mission: `run_10k`**

  * **Requirements**: The user must complete ten runs (`complete_run` action) in total.
  * **Rewards**: Upon completion, the user earns 1000 XP and receives a badge identified by `BADGE_ID_RUN_10K`.

<Note>
  Currently, the mission `name` must match the name of the rewarded
  badge in the mission configuration above.
</Note>

## Node Outputs

| Key                                                   | Description                                                                                                                                                         |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `completedMissions`                                   | A list of missions that have been completed (i.e the badge has been rewarded to the user). Each mission includes `name`, `xp_reward_amount`, and `badge_reward_id`. |
| `pendingMissions`                                     | A list of missions that are pending completion. Each mission includes `name`, `xp_reward_amount`, and `badge_reward_id`.                                            |
| `uncompletedMissions`                                 | A list of missions that have not been completed. Each mission includes:                                                                                             |
| `uncompletedMissions.name`                            | The name of the uncompleted mission.                                                                                                                                |
| `uncompletedMissions.progressInPercent`               | The progress of the mission in percent.                                                                                                                             |
| `uncompletedMissions.remainingActions`                | A list of actions that need to be completed to finish the mission. Each action includes:                                                                            |
| `uncompletedMissions.remainingActions.name`           | The name of the action that needs to be completed.                                                                                                                  |
| `uncompletedMissions.remainingActions.remainingCount` | The remaining count of the action that needs to be completed.                                                                                                       |

## What's next?

Hopefully, you now understand what missions are and how to check if a user has completed them.
Why not try the [Check and Reward](../templates/check-and-reward-missions) template?
This template checks whether a user has completed all the actions required for a mission, and if they have,
it rewards them with the appropriate XP and badges.
