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

# Sending an event

> Example XblEventsWriteInGameEvent code that writes an XBOX Live in-game event to update event-based user stats using rules configured in Partner Center.

This topic provides example code that shows how to write an event.
This code updates event-based Stats based on the stat rules that you've defined in Partner Center.

#### Flat C API

```cpp theme={null}
HRESULT hr = XblEventsWriteInGameEvent(
    xboxLiveContext,
    "PuzzleSolved",
    R"({"DifficultyLevelId":100, "GameplayModeId":"Adventure"})",
    R"({"LocationX":1,"LocationY":1})"
);
```

For more information, see [XblEventsWriteInGameEvent](/reference/live/xsapi-c/events_c/functions/xbleventswriteingameevent).


## Related topics

- [Events example code](/services/xbox-services/player-data/stats-leaderboards/event-based/events/how-to/live-events-howto-nav.md)
- [Getting event-based stats](/services/xbox-services/player-data/stats-leaderboards/event-based/how-to/live-getting-eb-stat.md)
- [PlayFab Services SDK - Event Pipeline](/services/playfab/sdks/c/event-pipeline/eventpipeline.md)
- [PFEventPipelineConfig](/services/playfab/api-references/c/pfeventpipeline/structs/pfeventpipelineconfig.md)
- [How to](/services/xbox-services/player-data/stats-leaderboards/event-based/events/how-to/index.md)
