Guides

Matchmaking

Let Inhouse pick the opponents. You queue players, Inhouse forms a lobby and tells your server by webhook, and you record the result. There is nothing to poll.

How it works

  1. Queue a party with POST /v1/queue/join.
  2. Receive match.found at your webhook when the party's lobby forms. The lobby is an ordinary pending match.
  3. Play the match. That part is entirely yours.
  4. Record the result with one POST /v1/match/record, using the event's matchId.

The overview draws this as a sequence diagram.

Before you start

  • Add a webhook endpoint in the portal (the Webhooks page) that receives match.found. Test and live each have their own. /queue/join refuses a project without one, because a formed match is announced only by webhook.
  • Pick a rule. Every pool starts with a rule, ranked-1v1: one player per side, and the pool's default. Its skill gap starts at 100, widens 10 per second and stops at 400, and a party expires after 300 seconds. For anything but 1v1, add your own.

Queue a party

A party is one player, or several who will play on one team.

curl -X POST https://api.inhouseranks.com/v1/queue/join \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "partyExternalId": "party-alice",
    "players": [{ "mmrEntityExternalId": "alice" }]
  }'
  • Leave out matchmakingRuleId to join the pool's default rule.
  • partyExternalId is optional: your own id for the party, up to 100 characters. It comes back beside the party's _id in every response and event, and /queue/leave takes it, so you never need to keep Inhouse's id.
{
  "party": {
    "_id": "6b01eb7991a8d0c2e72af691",
    "matchmakingRuleId": "ranked-1v1",
    "externalId": "party-alice",
    "players": [
      {
        "mmrEntityExternalId": "alice",
        "mmrEntity": {
          "_id": "6b01eb7991a8d0c2e72af66e",
          "stats": [
            {
              "mmr": { "value": 1545.086633573829 /* ... */ }
              // ...
            }
          ]
          // ...
        }
        // ...
      }
    ],
    "status": "searching"
    // ...
  }
}

Each player comes back as { mmrEntityExternalId, mmrEntity }: their rated user as it is now. That is the rating the matchmaker will use. Joining the queue never creates anyone. A player new to the pool is shown at the pool's starting rating with _id: null, and is created when the match is recorded.

Handle match.found

One event per match, listing every party in it, team by team:

{
  "id": "6b01eb7991a8d0c2e72af695",
  "type": "match.found",
  "createdAt": "2026-11-21T19:05:29.771091Z",
  "data": {
    "matchId": "6b01eb7991a8d0c2e72af694",
    "poolId": "6b01eb7991a8d0c2e72af66b",
    "matchmakingRuleId": "ranked-1v1",
    "regionId": null,
    "teams": [
      {
        "teamId": "<teamAId>",
        "winProbability": 0.3681855893462594,
        "parties": [
          {
            "partyId": "6b01eb7991a8d0c2e72af692",
            "partyExternalId": null,
            "players": [
              {
                "mmrEntityExternalId": "bob",
                "mmrEntity": {
                  "_id": "6b01eb7991a8d0c2e72af66f",
                  "name": "bob",
                  "stats": [
                    {
                      "positionId": null,
                      "mmr": { "value": 1451.2775372294423 /* ... */ },
                      "wins": 0,
                      "losses": 3,
                      "ties": 0,
                      "matchCount": 3,
                      "groupRank": {
                        "lower": 1000,
                        "upper": 1500,
                        "rank": "Silver",
                        "tier": 2,
                        "image": null
                      },
                      "hideRating": false
                      // ...
                    }
                  ],
                  "externalId": "bob"
                  // ...
                }
                // ...
              }
            ]
          }
        ]
      }
      // ... 1 more
    ]
  }
}
  • Find your players by partyId, or by the partyExternalId you joined with. Everyone else in the lobby is listed too, so you can seat the whole match.
  • Keep each teamId. You send it back when you record the result.
  • winProbability is the team's predicted chance of winning. See How lobbies are chosen.
  • regionId is the region to host the match in, or null when the queue has no regions. See Regions.

Verify the signature, answer 2xx within 10 seconds, and dedupe on the event's id. Webhooks covers all three, and the two other events a party can end with: party.expired and party.cancelled.

Record the result

Play the match, then record it in one call: the event's matchId, and each team's place by its teamId.

curl -X POST https://api.inhouseranks.com/v1/match/record \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "matchId": "6b01eb7991a8d0c2e72af694",
    "scores": [
      { "teamId": "<teamAId>", "place": 1 },
      { "teamId": "<teamBId>", "place": 2 }
    ]
  }'

Always send the event's matchId. It names the match the matchmaker wrote, so /match/record rates that one. Without it, /match/record answers 400 match-result-required, or writes a second match if you sent a matchResult. A matchmade match is already ranked.

You can also score players by mmrEntityExternalId instead of teams by teamId. See Record a match that already exists.

Leave the queue

When players stop matchmaking, take their party out. If they disconnect, close the game or back out and you don't, they can be placed in a match nobody plays.

curl -X POST https://api.inhouseranks.com/v1/queue/leave \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "partyExternalId": "party-frank" }'

Name the party by its partyId, or by the partyExternalId it joined with. Leaving sends no event: you made the call yourself. A party that is no longer waiting answers 404 party-not-found.

Custom rules

Give a pool your own rules when you create it (/v1/pool/create takes matchmakingRules) or later:

curl -X POST https://api.inhouseranks.com/v1/pool/update \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "poolId": "6b01eb7991a8d0c2e72af687",
    "matchmakingRules": [
      {
        "id": "ranked-5v5",
        "default": true,
        "minTeams": 2,
        "maxTeams": 2,
        "targetTeams": 2,
        "minPlayersPerTeam": 5,
        "maxPlayersPerTeam": 5,
        "targetPlayersPerTeam": 5,
        "maxPartySize": 5,
        "initialSkillGap": 100,
        "skillGapGrowthPerSecond": 5,
        "maxSkillGap": 500,
        "maxTeamWinProbability": 0.6,
        "maxQueueSeconds": 300
      }
    ]
  }'
  • /v1/pool/update replaces the whole list, the starting 1v1 rule included. null clears it. At creation, [] creates the pool with no rules.
  • Required: id, the three team counts, the three per-team counts, initialSkillGap and skillGapGrowthPerSecond. A rule missing one, or an inconsistent one, is 400 invalid-matchmaking-rule.
  • Removing a rule cancels the parties queued under it. Each gets a party.cancelled event whose reason is rule-removed.
  • The portal edits the same rules.

Every field is described under Matchmaking rule.

Positions

A rule can make every team fill named slots: one top, one jungle, one mid and so on. Players then queue with the positions they're willing to play, and the matchmaker only ever gives them one of those.

1. Give the rule teamPositions: each position, and how many players a team has in it.

curl -X POST https://api.inhouseranks.com/v1/pool/create \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ranked 5v5",
    "kind": "competitive",
    "groupConfig": {},
    "matchmakingRules": [
      {
        "id": "ranked-5v5",
        "default": true,
        "minTeams": 2,
        "maxTeams": 2,
        "targetTeams": 2,
        "minPlayersPerTeam": 5,
        "maxPlayersPerTeam": 5,
        "targetPlayersPerTeam": 5,
        "maxPartySize": 5,
        "initialSkillGap": 100,
        "skillGapGrowthPerSecond": 5,
        "maxSkillGap": 500,
        "teamPositions": {
          "top": 1,
          "jungle": 1,
          "mid": 1,
          "bot": 1,
          "support": 1
        }
      }
    ]
  }'
  • The team size is the number of slots. Set all three per-team counts to their total (5 here).
  • minPositionsPerPlayer is how many positions each player has to list. Left out, it is 1.
  • Saving the rule adds its positions to the pool's game, so every player also gets a rating of their own in each position they play.

2. Queue each player with positionIds, first choice first:

curl -X POST https://api.inhouseranks.com/v1/queue/join \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "poolId": "6b01eb7991a8d0c2e72af69b",
    "partyExternalId": "party-ivy",
    "players": [
      { "mmrEntityExternalId": "ivy", "positionIds": ["mid", "support"] }
    ]
  }'
{
  "party": {
    "_id": "6b01eb7991a8d0c2e72af69e",
    "matchmakingRuleId": "ranked-5v5",
    "externalId": "party-ivy",
    "players": [
      {
        "mmrEntityExternalId": "ivy",
        "positionIds": ["mid", "support"]
        // ...
      }
    ],
    "status": "searching"
    // ...
  }
}

3. Read each player's positionId in match.found: the position they were given. It is always one they listed.

{
  "id": "6b01eb7991a8d0c2e72af6a9",
  "type": "match.found",
  "data": {
    "matchId": "6b01eb7991a8d0c2e72af6a8",
    "matchmakingRuleId": "ranked-5v5",
    "teams": [
      {
        "teamId": "<teamAId>",
        "winProbability": 0.5,
        "parties": [
          {
            "partyId": "6b01eb7991a8d0c2e72af69e",
            "players": [
              {
                "mmrEntityExternalId": "ivy",
                "positionIds": ["mid", "support"],
                "positionId": "mid"
                // ...
              }
            ]
            // ...
          },
          {
            "partyId": "6b01eb7991a8d0c2e72af69f",
            "players": [
              {
                "mmrEntityExternalId": "jack",
                "positionIds": ["top", "jungle"],
                "positionId": "top"
                // ...
              }
            ]
            // ...
          },
          {
            "partyId": "6b01eb7991a8d0c2e72af6a1",
            "players": [
              {
                "mmrEntityExternalId": "liam",
                "positionIds": ["bot", "mid"],
                "positionId": "bot"
                // ...
              }
            ]
            // ...
          },
          {
            "partyId": "6b01eb7991a8d0c2e72af6a2",
            "players": [
              {
                "mmrEntityExternalId": "mona",
                "positionIds": ["support", "bot"],
                "positionId": "support"
                // ...
              }
            ]
            // ...
          },
          {
            "partyId": "6b01eb7991a8d0c2e72af6a4",
            "players": [
              {
                "mmrEntityExternalId": "olga",
                "positionIds": ["jungle", "support"],
                "positionId": "jungle"
                // ...
              }
            ]
            // ...
          }
        ]
      }
      // ... 1 more
    ]
    // ...
  }
  // ...
}

4. Record the result as usual, with the event's matchId. The match already holds each player's position, so recording it moves two of their ratings: the overall one, and the one for that position.

{
  "match": {
    "_id": "6b01eb7991a8d0c2e72af6a8",
    "status": "recorded",
    "ranked": true,
    "matchmaking": { "matchmakingRuleId": "ranked-5v5", "playerCount": 10 }
    // ...
  },
  "matchPlayers": [
    {
      "teamId": "<teamAId>",
      "mmrEntityId": "6b01eb7991a8d0c2e72af6aa",
      "mmrChanges": [
        {
          "positionId": null,
          "multiplier": null,
          "advantage": null,
          "before": 1500,
          "after": 1516,
          "bonus": null
        },
        {
          "positionId": "mid",
          "multiplier": null,
          "advantage": null,
          "before": 1500,
          "after": 1516,
          "bonus": null
        }
      ],
      "outcome": "win"
      // ...
    },
    {
      "teamId": "<teamAId>",
      "mmrEntityId": "6b01eb7991a8d0c2e72af6ab",
      "mmrChanges": [
        {
          "positionId": null,
          "multiplier": null,
          "advantage": null,
          "before": 1500,
          "after": 1516,
          "bonus": null
        },
        {
          "positionId": "top",
          "multiplier": null,
          "advantage": null,
          "before": 1500,
          "after": 1516,
          "bonus": null
        }
      ],
      "outcome": "win"
      // ...
    }
    // ... 8 more
  ]
}

What to know:

  • A position is a hard requirement. A player is never given a position they didn't list, however long they wait, and a lobby that can't fill every slot doesn't form.
  • Players are matched on their overall rating, the block of their stats with positionId: null, whichever positions they list. A position decides where a player sits, not what they're rated.
  • Every ranked match moves the overall rating. A match played in a position also moves that position's own rating, which starts from the overall one the first time they play it. A position's rating is yours to show, on a leaderboard per position for example. The matchmaker doesn't read it.
  • The more positions players list, the shorter the wait. With one position each, the least popular position decides how many players ever get a match: when a tenth of your players queue for a position that fills a fifth of the slots, only half of them can be placed. With two positions each, nearly everyone is. Set minPositionsPerPlayer to 2 if your game runs short of one position.
  • First choices come first where they can. A round prefers lobbies in which more players get the first position on their list. A position the queue is short of is filled first, though, so listing it second often means playing it.
  • A party shares a team, so its players need different slots. Two players who both list only mid can't queue together under a rule with one mid per team: 400 party-positions-conflict.
  • A join is refused with 400 positions-required when a player lists too few positions, and 400 invalid-position for one the rule doesn't have.

Regions

A queue with regions only puts parties together that accept the same region, and match.found says which region the match is in. Region ids are your own names for them, such as eu-west.

1. List the queue's regions. They come from three places, and the first one that is set wins:

  • the rule's regionIds
  • the pool's matchmakingRegionIds, on /v1/pool/create or /v1/pool/update
  • the project's, set in the portal (Matchmaking → Regions)
curl -X POST https://api.inhouseranks.com/v1/pool/create \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Regional 1v1",
    "kind": "community",
    "groupConfig": {},
    "matchmakingRegionIds": ["eu-west", "us-east"]
  }'
  • Left out or null, a level uses the one above it. A pool without matchmakingRegionIds uses the project's.
  • [] is set too: it turns regions off for that level and below. A rule with regionIds: [] matches everyone together, whatever the pool or the project lists.
  • With no regions anywhere, matchmaking works as it always has.
  • The rules for an id are under Matchmaking rule.

2. Queue each party with regionIds: the regions it will play in. The party lists them once, for all its players.

curl -X POST https://api.inhouseranks.com/v1/queue/join \
  -H "x-api-key: $INHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "poolId": "6b01eb7991a8d0c2e72af6be",
    "partyExternalId": "party-sam",
    "regionIds": ["eu-west"],
    "players": [{ "mmrEntityExternalId": "sam" }]
  }'
  • Leave it out, or send [], to accept any region the queue offers, including regions added while the party waits.
  • A region the queue doesn't offer, or one listed twice, is 400 invalid-region. A queue without regions ignores the list.

3. Read regionId in match.found: the region to host the match in. Every party in the lobby accepted it.

{
  "id": "6b01eb7991a8d0c2e72af6c4",
  "type": "match.found",
  "data": {
    "matchId": "6b01eb7991a8d0c2e72af6c3",
    "matchmakingRuleId": "ranked-1v1",
    "regionId": "eu-west",
    "teams": [
      {
        "teamId": "<teamAId>",
        "parties": [
          {
            "partyId": "6b01eb7991a8d0c2e72af6c1",
            "partyExternalId": "party-sam",
            "players": [{ "mmrEntityExternalId": "sam" /* ... */ }]
          }
        ]
        // ...
      },
      {
        "teamId": "<teamBId>",
        "parties": [
          {
            "partyId": "6b01eb7991a8d0c2e72af6c2",
            "partyExternalId": null,
            "players": [{ "mmrEntityExternalId": "tess" /* ... */ }]
          }
        ]
        // ...
      }
    ]
    // ...
  }
  // ...
}

What to know:

  • A region is a hard requirement. A party is never matched outside its regions, however long it waits.
  • The more regions parties accept, the shorter the wait. The matchmaker plans each region over the parties that listed it, the region with the fewest players first, so a party that lists several is placed where players are scarce.
  • A party that lists none usually fills in first. The matchmaker prefers to match it with parties that listed a region before matching it with other parties that listed none. A lobby made only of parties that listed none plays in the first region of the queue's list.
  • A party is cancelled when none of its regions is left. If the project's, the pool's or the rule's regions change while it waits, it gets a party.cancelled event whose reason is region-removed. A party with one of its regions left keeps waiting.
  • The match keeps its region as matchmaking.regionId.
  • /v1/queue/stats counts every region together.

How lobbies are chosen

A lobby must fit its rule. Two numbers decide whether it does:

  • Skill gap: the highest-rated player in the lobby minus the lowest-rated, in rating points. Every player counts individually, party members included. The allowed gap starts at initialSkillGap, widens by skillGapGrowthPerSecond for each second of waiting, and stops at maxSkillGap. The wait that counts is the lobby's longest unless the rule says otherwise: see Whose wait opens the gap.
  • Win probability: each lobby is split into the most even teams possible. If the favored team's chance is still above maxTeamWinProbability, the lobby is refused.

Win probability is the number the rating engine itself uses when the match is rated. A team's rating is its players' average, and the pool's formula gives its chance of beating each other team. On Elo that is 1 / (1 + 10^((theirs − yours) / 400)) on the pool's scale. Glicko-2 also discounts for how uncertain the opposing team's average rating is, √(sum of RD²) / players. A team's value is that chance averaged over its opponents. With two teams it is simply P(A beats B): on the default scale, team averages about 70 points apart give 0.6.

Whose wait opens the gap

A lobby holds parties that have waited different times. The rule's skillGapOpenedBy says whose wait its allowed gap comes from:

skillGapOpenedBy The gap comes from What you get
longestWait (default) The party in the lobby that has waited longest. A party that just joined can be placed at once in a wide lobby an older party opened. Shorter waits, wider lobbies.
shortestWait The party in the lobby that has waited least. Every party is inside the gap its own wait allows. Closer matches, longer waits.

Take a 1v1 rule that starts at 100 points and widens by 10 a second, up to 400. Player A has waited 30 s, so A's gap is 400. Player B joins 350 points away, with a gap of 100. By the longest wait they are matched at once. By the shortest wait they are matched 25 s later, when B's own gap reaches 350, unless someone closer joins first.

The two differ most when few players are queuing. In our simulations, a 5v5 queue with one player joining a second went from an average gap of about 280 points to about 165 by the shortest wait, and from an average wait of about 20 s to about 39 s. A 1v1 queue with twenty players joining a second came out the same either way.

Only the skill gap follows this setting. relaxLobbySizeAfterSeconds always counts the lobby's longest wait.

How a round chooses lobbies

The queue is matched every few seconds. Each round plans a rule's whole queue at once instead of filling one lobby at a time. It lines the waiting players up by rating and cuts lobbies from neighbors in that line:

  1. Only lobbies the rule allows. The right number of players, every party whole on one of the equal teams, a skill gap inside what the lobby's wait allows, and the most even split inside maxTeamWinProbability.
  2. As few players left waiting as possible. If a lobby can form, it does. A player is never held back to make someone else's lobby better.
  3. Then the lowest cost. Between plans that place as many players:
    • each lobby costs (1 − waitWeight) × lobbyCost
    • each player left waiting costs waitWeight × (wait ÷ T)²

lobbyCost runs from 0 (everyone rated the same, even teams) to 1 (the worst the rule could ever allow). It's the average of three parts: the lobby's skill gap as a share of the widest gap the rule ever allows, how lopsided it is (how far the favored team's win probability is above 0.5, doubled), and, in pools with rating windows, the share of its parties still being placed beyond the first.

T is the rule's own measure of a long wait: the seconds its allowed gap takes to reach maxSkillGap, or maxQueueSeconds when it never gets there. The wait is squared, so a few seconds between new arrivals barely count and a long wait counts for a lot.

waitWeight sets the balance:

waitWeight Effect
0 Forms the closest-rated, most even lobbies. Time waited only breaks ties.
0.5 (default) Counts both the same. Once a player has waited T (30 s on the default rule), they're placed ahead of a newcomer whatever that does to match quality.
1 Places whoever has waited longest. Match quality only breaks ties.

No lobby outside the rule's limits ever forms, whatever the weight. A lobby that can't form yet is tried again on the next round, with a wider gap.

Under a rule with positions, players are lined up by the same rating, and a lobby is allowed only if every slot of every team is filled by a player who listed that position. So a lobby isn't always a run of neighbors: the round reaches past players whose positions are already taken. lobbyCost then has a fourth part: the share of the lobby's players who didn't get the first position on their list.

How many lobbies a round considers

A round doesn't try every possible set of players. It takes each waiting party in turn as the lowest-rated in a lobby, and walks up the line until it has enough players: that is the closest-rated lobby with the party at the bottom. Then it walks on a little further, so that someone just above who has waited much longer can take a newcomer's seat. lobbyOptionsPerParty is how many lobbies it collects from each party this way, 1 to 8. A stretch of players that makes no allowed lobby doesn't count toward it.

The default, 3, suits nearly every game. More options rarely place more players, because every party's own walk finds most of the same lobbies, and a lobby one round misses usually forms on the next. In our simulations, 5 and 8 placed as many players as 3, give or take a few lobbies in tens of thousands of players, with about the same waits and gaps, while each round took about 1.5 and 2 times as long to plan. At 1, each party is offered only its closest-rated lobby.

What to know about the queue

  • The queue isn't stored. A party exists only while it waits. Once it's placed, expires or is cancelled it's gone, and its event says what became of it.
  • A server restart empties the queue, and tells you. Every party that was waiting gets a party.cancelled event whose reason is server-shutdown: queue it again. While the server restarts, /v1/queue/join can answer 503 server-restarting for a few seconds; retry after its Retry-After.
  • Queue a party again when you've heard nothing for its rule's maxQueueSeconds. The restart events are best effort: a server that stops without warning sends none, and an event that fails to reach you is in the delivery log.
  • A player can be in one searching party per pool. A second join is 409 player-already-queued.
  • A partyExternalId names one party per pool at a time. Another join with it answers 409 party-external-id-taken until that party is placed, expires, is cancelled or leaves.
  • Queued players can't be put in a match. While a player waits in a pool's queue, no match in that pool can take them in: not a new one (/match/record, /match/create, /match/import, or /match/score opening one), and not an existing one they aren't in yet (/match/update or /match/score adding them). Each answers 409 player-in-queue, naming them in mmrEntityExternalIds. Take their party out with /queue/leave first.
  • A match they're already in is never held up. Players can queue for their next game while their last match is still open, and that match can still be scored, updated and recorded. Their queued rating is the one they had when they joined, so record a match before queueing its players again when you can: the matchmaker then places them on their latest rating.
  • A formed match remembers where it came from. It keeps matchmaking: { matchmakingRuleId, playerCount }, plus regionId in a queue with regions.
  • Every lobby spends a match. It counts against your plan the moment it's formed. See Limits and billing.

Show queue activity

GET /v1/queue/stats says how busy a pool's queue is, for showing players things like "42 players in queue": how many are waiting, how their ratings are spread, and how far their searches have widened.

curl "https://api.inhouseranks.com/v1/queue/stats?matchmakingRuleId=ranked-1v1" \
  -H "x-api-key: $INHOUSE_API_KEY"
{
  "now": "2026-11-21T19:05:29.765580Z",
  "poolId": "6b01eb7991a8d0c2e72af66b",
  "matchmakingRuleId": "ranked-1v1",
  "ratingBucketSize": 100,
  "skillGapBucketSize": 50,
  "parties": 2,
  "players": 2,
  "oldestEnqueuedAt": "2026-11-21T19:05:29.758581Z",
  "rating": { "min": 1451.2775372294423, "max": 1545.086633573829 },
  "ratingBuckets": [
    { "from": 1400, "to": 1500, "players": 1 },
    { "from": 1500, "to": 1600, "players": 1 }
  ],
  "allowedSkillGap": { "min": 100.03999, "max": 100.06999 },
  "allowedSkillGapBuckets": [{ "from": 100, "to": 150, "players": 2 }]
}
  • It's aggregates only. It never names a party or a player, so it can't tell you what became of your party. The webhook event does.
  • With matchmakingRuleId, the numbers are that rule's queue only. Without it, they're the whole pool, every rule's queue together, and matchmakingRuleId is null.
  • Call it from your game server, never from the game client: the API key must stay secret. The queue is matched every few seconds, so polling more often than that adds nothing. Poll once and pass the numbers on to your players.

Every field is under Queue stats.