> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squadvault.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Create player

> Create a new player with gamer tags.



## OpenAPI

````yaml /openapi.yaml post /players
openapi: 3.1.0
info:
  title: SquadVault Public API
  version: 1.0.0
  description: >
    Organization-scoped Public API for teams, players, documents, tryout
    applications, and uploads.

    Base path is `/v1`. Authenticate with an organization API key in the
    `x-api-key` header.


    The key is scoped to one organization. List and create calls still require
    that organization ID

    in the path, query, or body, and it must match the key. Tryout get, update,
    and convert-to-player

    always require `organizationId` (query on GET, JSON body on PATCH/POST). Get
    team/player by ID

    uses `/teams/{organizationId}/{teamId}` and
    `/players/{organizationId}/{playerId}`.

    Team, player, and document update/delete resolve the organization from the
    resource ID.
  contact:
    name: SquadVault Support
    email: hello@squadvault.xyz
    url: https://squadvault.xyz
servers:
  - url: https://api.squadvault.xyz/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Teams
  - name: Players
  - name: Documents
  - name: Tryout Applications
  - name: Uploads
paths:
  /players:
    post:
      tags:
        - Players
      summary: Create player
      description: Create a new player with gamer tags.
      operationId: createPlayer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePlayerRequest'
            example:
              organizationId: org_example
              name: Alex Morgan
              role: AWP
              mainGame: cs
              gamerTags:
                - game: cs
                  gamerTag: alexm_cs
              teamIds: []
      responses:
        '201':
          description: Created player
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Player'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Discord user already linked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreatePlayerRequest:
      type: object
      required:
        - organizationId
        - name
      properties:
        organizationId:
          type: string
        name:
          type: string
        gamerTags:
          type: array
          items:
            $ref: '#/components/schemas/GamerTagInput'
        mainGame:
          oneOf:
            - $ref: '#/components/schemas/Game'
            - type: 'null'
        role:
          type:
            - string
            - 'null'
        nationality:
          type:
            - string
            - 'null'
          description: ISO 3166-1 alpha-2 country code (lowercase). United Kingdom is `uk`.
          example: de
        teamIds:
          type: array
          items:
            type: string
        discordUserId:
          type:
            - string
            - 'null'
          description: Discord snowflake (17–20 digits)
    Player:
      type: object
      properties:
        id:
          type: string
        organizationId:
          type: string
        userId:
          type:
            - string
            - 'null'
        name:
          type: string
        role:
          type:
            - string
            - 'null'
        mainGame:
          oneOf:
            - $ref: '#/components/schemas/Game'
            - type: 'null'
        nationality:
          type:
            - string
            - 'null'
          description: ISO 3166-1 alpha-2 country code (lowercase). United Kingdom is `uk`.
          example: de
        discordUserId:
          type:
            - string
            - 'null'
        discordUsername:
          type:
            - string
            - 'null'
        archivedAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        gamerTagCount:
          type: integer
        teamCount:
          type: integer
        gamerTags:
          type: array
          items:
            $ref: '#/components/schemas/GamerTag'
        teams:
          type: array
          items:
            $ref: '#/components/schemas/PlayerTeamSummary'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Machine-readable error code
    GamerTagInput:
      type: object
      required:
        - game
        - gamerTag
      properties:
        game:
          $ref: '#/components/schemas/Game'
        gamerTag:
          type: string
    Game:
      type: string
      enum:
        - cs
        - valorant
        - overwatch
        - fortnite
        - minecraft
        - rocket-league
        - league
        - other
    GamerTag:
      type: object
      properties:
        id:
          type: string
        organizationId:
          type: string
        playerId:
          type: string
        game:
          $ref: '#/components/schemas/Game'
        gamerTag:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    PlayerTeamSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        game:
          oneOf:
            - $ref: '#/components/schemas/Game'
            - type: 'null'
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              value:
                error: unauthorized
            invalidApiKey:
              value:
                error: invalidApiKey
    Forbidden:
      description: Valid credentials but missing permission or feature
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              value:
                error: forbidden
            featureNotAvailable:
              value:
                error: featureNotAvailable
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Organization API key from Settings → API keys.

````