Guides
Import and migrate
Two ways to arrive with history. Migrate brings players over with the ratings they already have. Import replays old matches so Inhouse works the ratings out.
| You have | Use |
|---|---|
| Players with ratings from your own system | Migrate your players |
| A log of past matches and no ratings | Import match history |
If you want both, migrate first. Import matches players by name, and
migrating first gives each of those names an mmrEntityExternalId.
Migrate your players
Bring your players across with their current ratings and records instead of replaying history. They keep playing from where they are.
curl -X POST https://api.inhouseranks.com/v1/user/migrate \
-H "x-api-key: $INHOUSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"poolId": "6b01eb7991a8d0c2e72af67e",
"players": [
{
"mmrEntityExternalId": "alice",
"name": "Alice",
"stats": [{ "mmr": { "value": 1820 }, "wins": 30, "losses": 12 }]
},
{ "mmrEntityExternalId": "bob" }
]
}'{
"poolId": "6b01eb7991a8d0c2e72af67e",
"createdCount": 1,
"updatedCount": 0,
"skippedCount": 1,
"players": [
{
"mmrEntityExternalId": "alice",
"userExternalId": "alice",
"mmrEntityId": "6b01eb7991a8d0c2e72af682",
"userId": "6b01eb7991a8d0c2e72af682",
"status": "created"
},
{
"mmrEntityExternalId": "bob",
"userExternalId": "bob",
"mmrEntityId": "6b01eb7991a8d0c2e72af681",
"userId": "6b01eb7991a8d0c2e72af681",
"status": "skipped"
}
]
}- The pool must exist first.
poolIdis required, and there is no default-pool fallback here. Create the pool with itsmmrConfigand positions before you migrate. An unknown pool is404 group-not-found. - Up to 1000 players per call. Send more in several calls.
- Players that already exist are skipped, so re-running a migration is
safe. Send
"overwrite": trueto replace their stats with what you send, and their name if you send one. Overwrite replaces. It doesn't merge. - All or nothing. Every player is checked before anything is written.
Any problem answers
400 invalid-migrationwith one entry per bad row inerrors. Unknown fields are refused, so a typo can't quietly migrate everyone at the starting rating. - Migrating is free. A migrated player counts toward your monthly players only once a match they're in is recorded.
What to send for each player
stats takes the shape mmrEntity.stats[] comes back in: one block per
position, where the block without a positionId is the overall rating.
Every field is optional, and a field you leave out takes the pool's
default:
| Field | Default when left out |
|---|---|
name |
The mmrEntityExternalId. |
mmr.value |
The pool's initialMmr. |
mmr.ratingDeviation, mmr.volatility |
The pool's Glicko-2 starting values. Glicko-2 only: an Elo pool refuses them. |
mmr.lastRatedAt |
Unset. An ISO 8601 time, used for idle confidence decay. Glicko-2 only. |
wins, losses, ties |
0. |
matchCount |
wins + losses + ties. |
winStreak, loseStreak, currentStreak |
0. Send any of them and the others are derived. currentStreak is signed: +3 is three wins, −3 three losses. |
seasonStartWins, seasonStartMatchCount |
Unset, so the whole record counts toward this season. |
Every player gets an overall block, sent or not. A block for a position is
created only when you send it, and its positionId must be one of the
pool's positions.
A batch with a bad row writes nothing and says why:
{
"code": "invalid-migration",
"message": "Nothing was migrated: 1 of 1 players are invalid. Fix them and send the batch again.",
"errors": [
{
"index": 0,
"mmrEntityExternalId": "erin",
"userExternalId": "erin",
"code": "unknown-field",
"field": "rating",
"message": "Unknown field \"rating\". Allowed here: mmrEntityExternalId, name, stats."
}
]
}Import match history
One call records and rates many matches, oldest first.
curl -X POST https://api.inhouseranks.com/v1/match/import \
-H "x-api-key: $INHOUSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"poolId": "6b01eb7991a8d0c2e72af67e",
"matches": [
{
"playDate": "2024-05-01T19:30:00Z",
"title": "Week 1",
"players": [
{ "name": "Alice", "placement": 1, "score": 21 },
{ "name": "Bob", "placement": 2, "score": 17 }
]
}
]
}'{
"passedCount": 1,
"failedCount": 0,
"passed": [
{
"index": 0,
"matchId": "6b01eb7991a8d0c2e72af683",
"playDate": "2024-05-01T19:30:00.000Z"
}
],
"failed": []
}- Each match is a free-for-all: every player is their own team. A match
is
{ playDate, title?, players }with at least two players, and a player is{ name, placement, score?, role? }.placementdecides the result.scoreandroleonly go into the player's caption. - At most 1000 matches per call.
rankeddefaults totruehere, unlike/match/record.- It stops at the first match it can't record and still answers
200. Matches before it are inpassedand kept. The failing one is infailedwith itscode(over-plan-limitorplayer-in-queue, for example), and every match after it is infailedasnot-processed. CheckfailedCount. - A body that's wrong in shape writes nothing:
400 invalid-import, with one{index, code}per bad match inerrors. - It bills like live play, in the current month. Whatever a match's
playDate, each imported match spends one of this month's matches and counts its players as this month's.
Imported players have no id of yours
Players are matched by name, not mmrEntityExternalId. An imported player is the
rated user in the pool whose name is theirs. A name the pool doesn't have
creates a rated user with no mmrEntityExternalId.
That matters afterwards. Calls that name players by mmrEntityExternalId
(/match/record, /match/score, /v1/user/ratings) can't reach that rated
user. A later match by mmrEntityExternalId starts a second one, and each is billed as
its own player.
To keep rating imported players, create them first with /v1/user/migrate,
with name set to the name you import them under.