

```json
{
  "openapi": "3.0.0",
  "tags": [
    {
      "name": "Matchmaker Admin",
      "description": "Matchmaker Admin API"
    }
  ],
  "info": {
    "version": "3.0.0",
    "title": "Matchmaker Admin API",
    "contact": {
      "name": "Multiplayer Services",
      "x-slack-channel": "#ask-multiplayer"
    },
    "description": "# Introduction\n This document outlines the API specification for the Matchmaker Admin API.\n The Matchmaker Admin service allows you to create and update the Matchmaker configuration.\n## Resources\n Matchmaker currently allows interaction with the following types of resources:\n   - EnvironmentConfig: A resource that holds the environment-wide configuration options.\n   - Restrictions: A resource that holds the environment-wide restrictions (ex: maximum number of Queues, etc.).\n   - Queues: A resource that holds the configuration of a Matchmaker Queue (see Matchmaker's documentation for added details).\n## Rate Limits\n  The API has per project rate limiting in place, for all endpoints:\n\n  | Limit per second | Limit per thirty minutes |\n  | --- | --- |\n  | 10 | 1000 |\n\n The API responds with a `429` HTTP status code if the requests exceed the rate limit.\n\n## Dry Run\nThe API has a \"dryRun\" parameter for each write calls.\nThis parameter will stop the service from writing anything,\nmeaning that the full validation will be done, but nothing will be updated.\nYou can expect the same status code returned (201 for created, 200 for updated, etc.).\n\nExample: Sending an updated environment configuration with the dryRun parameter\nwill do the correct validation and return the validation errors just like a normal\ncall, but without updating the the configuration.\n"
  },
  "servers": [
    {
      "url": "https://services.api.unity.com"
    }
  ],
  "paths": {
    "/matchmaker/v3/projects/{projectId}/environments/{environmentId}/config": {
      "get": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "getEnvironmentConfig",
        "summary": "Get Matchmaker environment configuration",
        "description": "Get the Matchmaker's environment configuration.\nThis configuration is for the whole environment.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentConfig"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        }
      },
      "put": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "updateEnvironmentConfig",
        "summary": "Upsert Matchmaker environment configuration",
        "description": "Create or update the Matchmaker configuration.\nThis configuration is for the whole environment.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          },
          {
            "$ref": "#/components/parameters/dryRun"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnvironmentConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/200"
          },
          "201": {
            "$ref": "#/components/responses/201"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        }
      }
    },
    "/matchmaker/v3/projects/{projectId}/environments/{environmentId}/restrictions": {
      "get": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "getRestrictions",
        "summary": "Get Matchmaker restrictions",
        "description": "Get the Matchmaker configuration restrictions.\nThose restrictions are for the whole environment.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Restrictions"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        }
      }
    },
    "/matchmaker/v3/projects/{projectId}/environments/{environmentId}/queues": {
      "get": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "listQueues",
        "summary": "List queue config",
        "description": "Get all Matchmaker Queue configurations.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QueueConfig"
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        }
      }
    },
    "/matchmaker/v3/projects/{projectId}/environments/{environmentId}/queues/{queueName}": {
      "put": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "upsertQueueConfig",
        "summary": "Upsert a Matchmaker Queue",
        "description": "Create or update a single Matchmaker Queue configuration.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          },
          {
            "$ref": "#/components/parameters/queueName"
          },
          {
            "$ref": "#/components/parameters/dryRun"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueueConfig"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/200"
          },
          "201": {
            "$ref": "#/components/responses/201"
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "409": {
            "$ref": "#/components/responses/409"
          },
          "429": {
            "$ref": "#/components/responses/409"
          }
        }
      },
      "delete": {
        "tags": [
          "Matchmaker Admin"
        ],
        "operationId": "deleteQueue",
        "summary": "Deletes a Matchmaker Queue",
        "description": "Delete a Matchmaker Queue configuration.",
        "security": [
          {
            "ServiceAccount": [
              "matchmaker.config.write"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/projectId"
          },
          {
            "$ref": "#/components/parameters/environmentId"
          },
          {
            "$ref": "#/components/parameters/queueName"
          },
          {
            "$ref": "#/components/parameters/dryRun"
          }
        ],
        "responses": {
          "204": {
            "$ref": "#/components/responses/204"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "429": {
            "$ref": "#/components/responses/429"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EnvironmentConfig": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "defaultQueueName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Restrictions": {
        "type": "object",
        "properties": {
          "maxQueues": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Queues."
          },
          "maxPoolsPerQueue": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Pools per Queue."
          },
          "maxPoolVariants": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Variants per Pool."
          },
          "maxMatchTeams": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Teams per Match."
          },
          "maxMatchRules": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Rules per Match."
          },
          "maxTeamRules": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Team Rules per Team."
          },
          "maxRuleRelaxations": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Relaxations per Rule."
          },
          "maxPlayersPerTicket": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum number of Players per Ticket."
          },
          "maxPoolTimeout": {
            "type": "integer",
            "format": "int32",
            "description": "The maximum timeout in seconds for a Pool."
          }
        }
      },
      "QueueConfig": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "A unique name for this queue."
          },
          "enabled": {
            "type": "boolean",
            "default": true,
            "description": "Whether or not the queue is enabled."
          },
          "maxPlayersPerTicket": {
            "type": "integer",
            "format": "int32",
            "default": 20,
            "description": "The maximum number of players per ticket in this queue."
          },
          "defaultPool": {
            "$ref": "#/components/schemas/BasePoolConfig"
          },
          "filteredPools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FilteredPoolConfig"
            }
          }
        },
        "additionalProperties": false,
        "required": [
          "name",
          "enabled",
          "maxPlayersPerTicket"
        ]
      },
      "PoolConfig": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "A unique name for this pool."
          },
          "enabled": {
            "type": "boolean",
            "default": true,
            "description": "Whether or not the pool is enabled."
          },
          "matchHosting": {
            "$ref": "#/components/schemas/MatchHosting"
          },
          "timeoutSeconds": {
            "type": "integer",
            "format": "int32",
            "description": "The timeout in seconds before a ticket times out."
          },
          "matchLogic": {
            "$ref": "#/components/schemas/Rules"
          }
        },
        "required": [
          "name",
          "enabled",
          "matchHosting",
          "timeoutSeconds",
          "matchLogic"
        ]
      },
      "BasePoolConfig": {
        "type": "object",
        "allOf": [
          {
            "$ref": "#/components/schemas/PoolConfig"
          },
          {
            "type": "object",
            "properties": {
              "variants": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PoolConfig"
                }
              }
            }
          }
        ]
      },
      "FilteredPoolConfig": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BasePoolConfig"
          },
          {
            "type": "object",
            "properties": {
              "filters": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Filter"
                }
              }
            }
          }
        ],
        "required": [
          "filters"
        ],
        "additionalProperties": false
      },
      "Rules": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "matchDefinition"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "pattern": "[a-zA-Z0-9- .]{1,36}"
          },
          "matchDefinition": {
            "$ref": "#/components/schemas/RuleBasedMatchDefinition"
          },
          "backfillEnabled": {
            "type": "boolean"
          }
        }
      },
      "RuleBasedMatchDefinition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "teams"
        ],
        "properties": {
          "teams": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleBasedTeamDefinition"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "matchRules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rule"
            },
            "minItems": 0,
            "maxItems": 25
          }
        }
      },
      "RuleBasedTeamDefinition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "teamCount",
          "playerCount"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "pattern": "[a-zA-Z0-9- .]{1,36}"
          },
          "teamCount": {
            "$ref": "#/components/schemas/Range"
          },
          "playerCount": {
            "$ref": "#/components/schemas/Range"
          },
          "teamRules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Rule"
            },
            "minItems": 0,
            "maxItems": 25
          }
        }
      },
      "Range": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "min",
          "max"
        ],
        "properties": {
          "min": {
            "type": "integer",
            "format": "int32",
            "maximum": 10000,
            "minimum": 1
          },
          "max": {
            "type": "integer",
            "format": "int32",
            "maximum": 10000,
            "minimum": 1
          },
          "relaxations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RangeRelaxation"
            },
            "minItems": 0,
            "maxItems": 25
          }
        }
      },
      "RangeRelaxation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "atSeconds",
          "ageType",
          "value"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "RangeControl.ReplaceMin"
            ]
          },
          "atSeconds": {
            "type": "number",
            "format": "double",
            "maximum": 10000,
            "minimum": 1
          },
          "ageType": {
            "$ref": "#/components/schemas/AgeType"
          },
          "value": {
            "type": "number",
            "format": "double",
            "maximum": 10000,
            "minimum": 1
          }
        }
      },
      "RuleRelaxation": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "atSeconds",
          "ageType"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "RuleControl.Enable",
              "RuleControl.Disable",
              "ReferenceControl.Replace"
            ]
          },
          "atSeconds": {
            "type": "number",
            "format": "double",
            "maximum": 10000,
            "minimum": 1
          },
          "ageType": {
            "$ref": "#/components/schemas/AgeType"
          },
          "value": {}
        }
      },
      "Rule": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "name",
          "type"
        ],
        "properties": {
          "source": {
            "type": "string",
            "pattern": "[a-zA-Z0-9- .]{1,200}"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "pattern": "[a-zA-Z0-9- .]{1,36}"
          },
          "type": {
            "type": "string",
            "enum": [
              "LessThan",
              "LessThanEqual",
              "GreaterThan",
              "GreaterThanEqual",
              "Difference",
              "Equality",
              "DoubleDifference",
              "InList",
              "Intersection"
            ]
          },
          "reference": {},
          "overlap": {
            "type": "number"
          },
          "enableRule": {
            "type": "boolean"
          },
          "not": {
            "type": "boolean"
          },
          "relaxations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleRelaxation"
            },
            "minItems": 0,
            "maxItems": 25
          },
          "externalData": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "leaderboard": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "id"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "cloudSave": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "default": {},
                  "accessClass": {
                    "type": "string",
                    "enum": [
                      "default",
                      "public",
                      "protected",
                      "private"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "AgeType": {
        "type": "string",
        "enum": [
          "Youngest",
          "Oldest",
          "Average"
        ]
      },
      "MatchHosting": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/MultiplayHostingConfig"
          },
          {
            "$ref": "#/components/schemas/MatchIdHostingConfig"
          },
          {
            "$ref": "#/components/schemas/CloudCodeHostingConfig"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Multiplay": "#/components/schemas/MultiplayHostingConfig",
            "MatchId": "#/components/schemas/MatchIdHostingConfig",
            "CloudCode": "#/components/schemas/CloudCodeHostingConfig"
          }
        }
      },
      "MultiplayHostingConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Multiplay"
            ],
            "description": "The type of hosting. Either \"Multiplay\" or \"MatchId\"."
          },
          "buildConfigurationId": {
            "type": "string",
            "description": "The ID of the Multiplay build configuration to use."
          },
          "fleetId": {
            "type": "string",
            "description": "The ID of the Multiplay Fleet to use."
          },
          "defaultQoSRegionId": {
            "type": "string",
            "description": "The ID of the Multiplay QoS region to use."
          },
          "moduleName": {
            "type": "string",
            "description": "The name of the Cloud Code module."
          },
          "allocateFunctionName": {
            "type": "string",
            "description": "The name of the Cloud Code function that performs server allocation."
          },
          "pollFunctionName": {
            "type": "string",
            "description": "The name of the Cloud Code function that performs polling of the server allocation."
          }
        },
        "additionalProperties": false
      },
      "MatchIdHostingConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "MatchId"
            ],
            "description": "The type of the hosting. Must be \"MatchId\"."
          }
        },
        "additionalProperties": false
      },
      "CloudCodeHostingConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CloudCode"
            ],
            "description": "The type of hosting. Must be \"CloudCode\"."
          },
          "moduleName": {
            "type": "string",
            "description": "The name of the Cloud Code module."
          },
          "allocateFunctionName": {
            "type": "string",
            "description": "The name of the Cloud Code function that performs server allocation."
          },
          "pollFunctionName": {
            "type": "string",
            "description": "The name of the Cloud Code function that performs polling of the server allocation."
          }
        },
        "additionalProperties": false,
        "required": [
          "moduleName"
        ]
      },
      "Filter": {
        "type": "object",
        "properties": {
          "attribute": {
            "type": "string",
            "nullable": true,
            "description": "A string representing the attribute name of the filter field. Leave empty if operator is CommonExpressionLanguage."
          },
          "operator": {
            "type": "string",
            "enum": [
              "Equal",
              "NotEqual",
              "LessThan",
              "GreaterThan",
              "CommonExpressionLanguage"
            ],
            "nullable": false,
            "description": "A string representing the operator for the filter, for example, \"Equal\", \"NotEqual\", \"LessThan\", \"GreaterThan\", or \"CommonExpressionLanguage\"."
          },
          "value": {
            "nullable": false,
            "description": "A value (number or string) for the filter. Contains the CEL expression if operator is CommonExpressionLanguage."
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "resultCode": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    },
    "responses": {
      "200": {
        "description": "Ok"
      },
      "201": {
        "description": "Created"
      },
      "204": {
        "description": "No Content"
      },
      "400": {
        "description": "Bad Request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "404": {
        "description": "Not Found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "409": {
        "description": "Conflict",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "429": {
        "description": "Too Many Requests",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    },
    "parameters": {
      "projectId": {
        "name": "projectId",
        "in": "path",
        "description": "Unity Project ID identifying which project this request is intended for.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "environmentId": {
        "name": "environmentId",
        "in": "path",
        "description": "The target deployment environment.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "dryRun": {
        "name": "dryRun",
        "in": "query",
        "schema": {
          "type": "boolean"
        }
      },
      "queueName": {
        "name": "queueName",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "securitySchemes": {
      "ServiceAccount": {
        "type": "http",
        "scheme": "basic",
        "description": "To get started with Authentication, please visit the [Service Account Authentication section](https://services.docs.unity.com/docs/service-account-auth).\n\nFor this API, you must add the following role(s) to your service account :\n| Role Type | Role Name | Permissions |\n| --- | --- | --- |\n| Project Level Role | Matchmaker Viewer | <ul><li>matchmaker.config.read</li></ul> |\n| Project Level Role | Matchmaker Writer | <ul><li>matchmaker.config.write</li></ul> |"
      }
    }
  }
}
```