# Authoritative matches: getting the match id

**URL:** <https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [December 16, 2021, 3:36pm UTC](https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187 "2021-12-16T15:36:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [December 16, 2021, 3:36pm UTC](https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187/1 "2021-12-16T15:36:42Z")

</div>

We use the authoritative match framework to create matches using an RPC call, basically like this:

```auto
    modulename := "pingpong"
    if matchId, err := nk.MatchCreate(ctx, modulename, params); err != nil {
        return "", err
    } else {
        return matchId, nil
    }

```

This works fine and the `matchId` is sent to the player which can then join the match just fine. Other players can also connect as the RPC call checks for existing matches with suitable parameters that are not full and returns a found match id.

But, once we’re in `MatchLoop()` there is a case where I need the match id of the match in progress. Basically I need to send it to bots so that they can join a match that is not getting enough human players. I can’t seem to find it in any way. There is `MatchGet()`, but it requires me to know the match id. The match id is not given to `MatchInit()`, so I can not store it in our match state that gets passed everywhere.

This looks like there is something simple that I’m not seeing? Where do I get the id of the match currently in progress?

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [December 16, 2021, 4:26pm UTC](https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187/2 "2021-12-16T16:26:31Z")

</div>

The Match ID is available in the context - see: [Basics - Heroic Labs Documentation](https://heroiclabs.com/docs/nakama/server-framework/basics/#context)

```auto
RUNTIME_CTX_MATCH_ID

```

---

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [December 16, 2021, 6:30pm UTC](https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187/3 "2021-12-16T18:30:52Z")

</div>

That would be it. Thank you!

---

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [December 16, 2021, 6:46pm UTC](https://forum.heroiclabs.com/t/authoritative-matches-getting-the-match-id/2187/4 "2021-12-16T18:46:12Z")

</div>

Works perfectly.
