{
  "openapi": "3.1.1",
  "info": {
    "title": "PayNow Game Server API",
    "description": "The GameServer API facilitates integration with game servers, enabling command executions and server linking.It provides the necessary functionality to connect your store with game servers, manage in-game actions, and synchronize data between your store and game environments.This API must be called using a token created by creating a Game Server.",
    "termsOfService": "https://paynow.gg/terms-of-use",
    "contact": {
      "name": "PayNow Services, Inc.",
      "url": "https://paynow.gg",
      "email": "support@paynow.gg"
    },
    "version": "v1"
  },
  "paths": {
    "/v1/delivery/gameserver/link": {
      "post": {
        "tags": [
          "delivery"
        ],
        "summary": "Update the link information for a Gameserver",
        "operationId": "DeliveryGameServer_LinkGameServer",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkGameServerRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkGameServerRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LinkGameServerRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkGameServerResponseDto"
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/delivery/command-queue": {
      "get": {
        "tags": [
          "delivery"
        ],
        "summary": "Retrieve the queue of commands to execute for a Gameserver",
        "operationId": "DeliveryCommandQueue_GetQueuedCommands",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QueuedCommandDto"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "delivery"
        ],
        "summary": "Retrieve the queued commands, while supplying the online players for a gameserver",
        "operationId": "DeliveryCommandQueue_GetQueuedCommandsWithOnlinePlayers",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetQueuedCommandsWithOnlinePlayersRequestDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/GetQueuedCommandsWithOnlinePlayersRequestDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/GetQueuedCommandsWithOnlinePlayersRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/QueuedCommandDto"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "delivery"
        ],
        "summary": "Mark commands as executed in bulk",
        "operationId": "DeliveryCommandQueue_MarkQueuedCommandExecutedBulk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/delivery/command-queue/{attemptId}": {
      "delete": {
        "tags": [
          "delivery"
        ],
        "summary": "Mark a queued command as executed",
        "operationId": "DeliveryCommandQueue_MarkQueuedCommandExecuted",
        "parameters": [
          {
            "name": "attemptId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/FlakeId"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/delivery/command-queue/acknowledge": {
      "post": {
        "tags": [
          "delivery"
        ],
        "summary": "Mark commands as executed in bulk via a POST request",
        "description": "Mark commands as executed in bulk via a POST request.\nSome HTTP clients don't support bodies in DELETE requests, so for compatibility we have a POST route.\nPlease use the DELETE route if your HTTP client supports it.",
        "operationId": "DeliveryCommandQueue_MarkQueuedCommandExecutedBulkViaPost",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MarkQueuedCommandAsExecutedDto"
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/delivery/events": {
      "post": {
        "tags": [
          "delivery"
        ],
        "operationId": "DeliveryEvents_ReportGameServerEvents",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReportGameServerEventsEntryDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReportGameServerEventsEntryDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ReportGameServerEventsEntryDto"
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayNowError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AddressFamily": {
        "enum": [
          "unspecified",
          "unix",
          "inter_network",
          "imp_link",
          "pup",
          "chaos",
          "ns",
          "iso",
          "ecma",
          "data_kit",
          "ccitt",
          "sna",
          "dec_net",
          "data_link",
          "lat",
          "hyper_channel",
          "apple_talk",
          "net_bios",
          "voice_view",
          "fire_fox",
          "banyan",
          "atm",
          "inter_network_v6",
          "cluster",
          "ieee12844",
          "irda",
          "network_designers",
          "max",
          "packet",
          "controller_area_network",
          "unknown"
        ],
        "type": "string"
      },
      "FlakeId": {
        "type": "string",
        "additionalProperties": false,
        "format": "flake-id",
        "example": "411486491630370816"
      },
      "GameServerEventDto": {
        "enum": [
          "invalid",
          "player_join"
        ],
        "type": "string",
        "description": "Represents the types of events that can occur on a game server.",
        "x-enumDescriptions": {
          "invalid": "Invalid or unspecified event type. Used as the default value.",
          "player_join": "Indicates a player has joined the game server."
        }
      },
      "GetQueuedCommandsWithOnlinePlayersRequestDto": {
        "type": "object",
        "properties": {
          "steam_ids": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/SteamId"
            }
          },
          "minecraft_uuids": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          },
          "customer_names": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false
      },
      "IPAddress": {
        "type": "string",
        "additionalProperties": false,
        "format": "ip-address",
        "example": "127.0.0.1"
      },
      "LinkGameServerRequestDto": {
        "required": [
          "hostname",
          "ip",
          "platform",
          "version"
        ],
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "version": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "LinkGameServerResponseDto": {
        "required": [
          "gameserver",
          "update_available"
        ],
        "type": "object",
        "properties": {
          "update_available": {
            "type": "boolean"
          },
          "latest_version": {
            "type": [
              "null",
              "string"
            ]
          },
          "previously_linked": {
            "$ref": "#/components/schemas/PreviousGameServerLinkDto"
          },
          "gameserver": {
            "$ref": "#/components/schemas/StorefrontGameServerDto"
          }
        },
        "additionalProperties": false
      },
      "MarkQueuedCommandAsExecutedDto": {
        "required": [
          "attempt_id"
        ],
        "type": "object",
        "properties": {
          "attempt_id": {
            "$ref": "#/components/schemas/FlakeId"
          }
        },
        "additionalProperties": false
      },
      "PayNowError": {
        "required": [
          "code",
          "message",
          "status"
        ],
        "type": "object",
        "properties": {
          "status": {
            "type": "integer",
            "description": "The HTTP status code.",
            "format": "int32",
            "example": 400
          },
          "code": {
            "type": "string",
            "description": "The PayNow parseable error code.",
            "example": "bad-request"
          },
          "message": {
            "type": "string",
            "description": "The human-readable error message.",
            "example": "Bad Request Example"
          },
          "trace_id": {
            "type": [
              "null",
              "string"
            ],
            "description": "A distributed trace ID used for debugging.",
            "example": "234a5bcd543ef3fa53ce929d0e0e4736"
          },
          "errors": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "description": "An array of multiple errors. Only used by some API services."
          }
        },
        "additionalProperties": false,
        "description": "Represents a PayNow error"
      },
      "PreviousGameServerLinkDto": {
        "required": [
          "host_name",
          "ip",
          "last_linked_at"
        ],
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "host_name": {
            "type": "string"
          },
          "last_linked_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "QueuedCommandDto": {
        "required": [
          "attempt_id",
          "command",
          "online_only",
          "queued_at"
        ],
        "type": "object",
        "properties": {
          "attempt_id": {
            "$ref": "#/components/schemas/FlakeId"
          },
          "steam_id": {
            "$ref": "#/components/schemas/SteamId"
          },
          "minecraft_uuid": {
            "type": [
              "null",
              "string"
            ],
            "description": "The Minecraft UUID of the customer, if applicable."
          },
          "customer_name": {
            "type": [
              "null",
              "string"
            ],
            "description": "The name of the customer, if applicable."
          },
          "command": {
            "type": "string",
            "description": "The command to be executed."
          },
          "online_only": {
            "type": "boolean",
            "description": "Indicates if the command should be executed only if the customer is online (Connected to the gameserver)"
          },
          "queued_at": {
            "type": "string",
            "description": "Represents when the command was queued.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "Represents a command to be executed on a Gameserver"
      },
      "ReportGameServerEventsEntryDto": {
        "required": [
          "event",
          "timestamp"
        ],
        "type": "object",
        "properties": {
          "event": {
            "$ref": "#/components/schemas/GameServerEventDto"
          },
          "player_join": {
            "$ref": "#/components/schemas/ReportGameServerEventsEntryPlayerJoinDto"
          },
          "timestamp": {
            "type": "string",
            "description": "When did this event occur.",
            "format": "date-time"
          }
        },
        "additionalProperties": false,
        "description": "Represents a single game server event entry in a report."
      },
      "ReportGameServerEventsEntryPlayerJoinDto": {
        "required": [
          "ip_address"
        ],
        "type": "object",
        "properties": {
          "ip_address": {
            "$ref": "#/components/schemas/IPAddress"
          },
          "steam_id": {
            "$ref": "#/components/schemas/SteamId"
          },
          "minecraft_uuid": {
            "type": [
              "null",
              "string"
            ],
            "description": "The Minecraft UUID of the player."
          },
          "minecraft_name": {
            "maxLength": 128,
            "type": [
              "null",
              "string"
            ],
            "description": "The Minecraft username of the player."
          }
        },
        "additionalProperties": false,
        "description": "Contains detailed information about a player joining a game server."
      },
      "SteamId": {
        "type": "string",
        "additionalProperties": false,
        "description": "A 64-bit Steam account identifier. Accepts string or numeric format.",
        "format": "steam-id",
        "example": "76561197960287930"
      },
      "StorefrontGameServerDto": {
        "required": [
          "enabled",
          "id",
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/FlakeId"
          },
          "name": {
            "type": "string",
            "description": "The display name of the game server."
          },
          "enabled": {
            "type": "boolean",
            "description": "Indicates whether the game server is currently enabled."
          }
        },
        "additionalProperties": false,
        "description": "Represents a simplified view of a game server for storefront display purposes."
      },
      "ValidationError": {
        "required": [
          "code",
          "message",
          "path",
          "validation"
        ],
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The parseable error code."
          },
          "message": {
            "type": "string",
            "description": "The human-readable error message."
          },
          "path": {
            "type": "string",
            "description": "The path leading to the validation error."
          },
          "validation": {
            "type": "string",
            "description": "Type of the validation that failed."
          }
        },
        "additionalProperties": false,
        "description": "A validation error."
      }
    },
    "securitySchemes": {
      "APIKey": {
        "type": "apiKey",
        "description": "An API Key token generated in the Dashboard in the format 'APIKey TOKEN_HERE'.",
        "name": "Authorization",
        "in": "header",
        "x-gitbook-prefix": "APIKey",
        "x-gitbook-token-placeholder": "TOKEN_HERE"
      },
      "Customer": {
        "type": "apiKey",
        "description": "A Customer token generated using an API Key in the format 'Customer TOKEN_HERE'.",
        "name": "Authorization",
        "in": "header",
        "x-gitbook-prefix": "Customer",
        "x-gitbook-token-placeholder": "TOKEN_HERE"
      }
    }
  },
  "tags": [
    {
      "name": "delivery"
    }
  ]
}