

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Player Names",
    "contact": {
      "name": "Unity",
      "url": "https://discussions.unity.com/tag/authentication"
    },
    "description": "The Player Names service allows users to manage player names and other text fields.",
    "version": "v1",
    "termsOfService": "https://unity3d.com/legal/terms-of-service"
  },
  "servers": [
    {
      "url": "https://social.services.api.unity.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Player Names",
      "description": "Player Names API"
    }
  ],
  "paths": {
    "/v1/names/{playerId}": {
      "get": {
        "summary": "Get a player's name.",
        "description": "Get a player's name. The '/me' endpoint can be used to get the name of the calling player.",
        "operationId": "getName",
        "tags": [
          "Player Names"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Player"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/PlayerId"
          },
          {
            "$ref": "#/components/parameters/autoGenerate"
          },
          {
            "$ref": "#/components/parameters/showMetadata"
          }
        ]
      },
      "post": {
        "summary": "Update a player's name.",
        "description": "Update a player's name, or create it if it doesn't exist. White space is not allowed in the name, and a random numeric suffix will automatically be added to it.",
        "operationId": "updateName",
        "tags": [
          "Player Names"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNameRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Player"
                }
              }
            }
          },
          "default": {
            "$ref": "#/components/responses/ErrorResponse"
          }
        },
        "parameters": [
          {
            "$ref": "#/components/parameters/PlayerId"
          }
        ]
      }
    }
  },
  "components": {
    "responses": {
      "ErrorResponse": {
        "description": "An unsuccessful response with a body that conforms to the RFC 7807 problem details format.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorStatus"
            },
            "examples": {
              "Forbidden": {
                "summary": "A Forbidden (HTTP 403) Error",
                "value": {
                  "status": 403,
                  "title": "Forbidden",
                  "detail": "Invalid JWT",
                  "code": 53
                }
              },
              "NotFound": {
                "summary": "A Not Found (HTTP 404) Error",
                "value": {
                  "status": 404,
                  "title": "Not Found",
                  "detail": "no player name found",
                  "code": 33000
                }
              },
              "InternalServerError": {
                "summary": "An Internal Server Error (HTTP 500) Error",
                "value": {
                  "status": 500,
                  "title": "Internal Server Error",
                  "detail": "",
                  "code": 0
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "UpdateNameRequest": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The player's updated name.",
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[^\\s]+$"
          }
        },
        "required": [
          "name"
        ]
      },
      "Player": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "autoGenerated": {
            "type": "boolean"
          }
        },
        "required": [
          "id"
        ]
      },
      "ErrorStatus": {
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "The HTTP status code of the response."
          },
          "title": {
            "type": "string",
            "description": "A short, human-readable summary of the problem type.  It does not change between occurrences of the problem, except for purposes of localization."
          },
          "detail": {
            "type": "string",
            "description": "A human-readable explanation specific to this occurrence of the problem."
          },
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "An integer that uniquely identifies an error type.  This can be used to programmatically identify the type of error."
          },
          "details": {
            "type": "array",
            "description": "A list of additional details about specific errors.",
            "items": {
              "$ref": "#/components/schemas/Detail"
            }
          }
        },
        "description": "The body that is returned for any failing request.  We are using the [RFC 7807 Error Format](https://www.rfc-editor.org/rfc/rfc7807.html#section-3.1).",
        "required": [
          "status",
          "title",
          "detail",
          "code"
        ],
        "example": {
          "status": 403,
          "title": "Forbidden",
          "detail": "Invalid JWT",
          "code": 53
        }
      },
      "Detail": {
        "type": "object",
        "properties": {
          "errorType": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "description": "Additional detail about an error.  For example, this might include detailed validation failure messages, debugging information, and troubleshooting steps.",
        "required": [
          "errorType",
          "message"
        ]
      }
    },
    "parameters": {
      "PlayerId": {
        "name": "playerId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "The player's ID."
      },
      "autoGenerate": {
        "in": "query",
        "name": "autoGenerate",
        "required": false,
        "schema": {
          "type": "boolean"
        },
        "description": "Indicates if a player without a name should have one auto generated or not. Defaults to true."
      },
      "showMetadata": {
        "in": "query",
        "name": "showMetadata",
        "required": false,
        "schema": {
          "type": "boolean"
        },
        "description": "If true, returns additional metadata like 'autoGenerated' with records. Defaults to false."
      }
    },
    "securitySchemes": {
      "Client": {
        "type": "http",
        "scheme": "bearer",
        "description": "To get started with Authentication, please visit the [Client Authentication section](https://services.docs.unity.com/docs/client-auth)."
      },
      "ServiceAccount": {
        "type": "http",
        "scheme": "bearer",
        "description": "To get started with Authentication, please visit the\n        [Service Account Authentication section](https://services.docs.unity.com/docs/service-account-auth).\n        When using a Service Account, these APIs require exchanging Service Account credentials for\n        an access token, please see the section about the\n        [Token Exchange API](https://services.docs.unity.com/docs/service-account-auth/index.html#extra-step-use-the-token-exchange-api)."
      }
    }
  },
  "security": [
    {
      "Client": []
    },
    {
      "ServiceAccount": []
    }
  ]
}
```