{
  "openapi": "3.0.4",
  "info": {
    "title": "myPOS POS API V2",
    "version": "v2",
    "description": "Terminal management and receipt retrieval. Based on the POS V2 Swagger definition. Public gateway URLs follow the existing POS documentation; confirm V2 availability for your integration before sending requests."
  },
  "servers": [
    { "url": "https://demo-api-gateway.mypos.com", "description": "Demo gateway (confirm V2 availability)" },
    { "url": "https://api-gateway.mypos.com", "description": "Production gateway (confirm V2 availability)" }
  ],
  "paths": {
    "/pos/v2/terminals": {
      "get": {
        "tags": ["Terminal"],
        "operationId": "get-terminals-v2",
        "summary": "Get Terminals",
        "description": "Retrieve a paginated terminal list. Optionally filter by status, outlet or model. Use terminal_id from an item to retrieve its details; tid is a separate field. Follow has_next_page and total_pages when loading additional pages. The specification does not define page/size defaults, limits or whether page numbering starts at zero or one.",
        "parameters": [
          { "name": "page", "in": "query", "schema": { "type": "integer", "format": "int32" } },
          { "name": "size", "in": "query", "schema": { "type": "integer", "format": "int32" } },
          { "name": "status", "in": "query", "schema": { "$ref": "#/components/schemas/Domain.Enums.MposTerminalStatus" } },
          { "name": "outlet", "in": "query", "schema": { "type": "string" } },
          { "name": "model", "in": "query", "schema": { "type": "string" } },
          { "name": "X-Session", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Application-Id", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Partner-Id", "in": "header", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiGatewayLibrary.Models.PaginatedList`1[Application.Common.Models.DTO.TerminalV2DTO]" } } } },
          "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails" } } } },
          "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } }
        }
      }
    },
    "/pos/v2/terminals/{terminal_id}": {
      "get": {
        "tags": ["Terminal"],
        "operationId": "get-terminal-details-v2",
        "summary": "Get Terminal Details",
        "description": "Retrieve terminal identity, settlement account, outlet, permissions and receipt settings. Supply terminal_id from Get Terminals, not tid or serial_number. The list returns terminal_id as int64, while this path parameter and the details response represent it as a string.",
        "parameters": [
          { "name": "terminal_id", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "X-Session", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Application-Id", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Partner-Id", "in": "header", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Application.Common.Models.DTO.GetTerminalDetailsV2ResponseDTO" } } } },
          "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails" } } } },
          "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } }
        }
      }
    },
    "/pos/v2/terminals/models": {
      "get": {
        "tags": ["Terminal"],
        "operationId": "get-terminal-models-v2",
        "summary": "Get Terminal Models",
        "description": "Retrieve terminal model codes, descriptions and ordering positions. Use the model code as the model filter in Get Terminals. The response is an array, not the paginated envelope returned by Get Terminals.",
        "parameters": [
          { "name": "X-Session", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Application-Id", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Partner-Id", "in": "header", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Application.Common.Models.DTO.TerminalModelV2ResponseDTO" } } } } },
          "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails" } } } },
          "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } }
        }
      }
    },
    "/pos/v2/terminals/receipt/{transaction_id}": {
      "get": {
        "tags": ["Terminal"],
        "operationId": "get-receipt-by-transaction-id-v2",
        "summary": "Get Receipt by Transaction ID",
        "description": "Retrieve receipt template data (tpl_data) and template name (tpl_name) for a numeric int64 transaction_id. This response is JSON, not a PDF, image or rendered receipt. Do not substitute an ePOS payment_id or a transaction UUID for transaction_id.",
        "parameters": [
          { "name": "transaction_id", "in": "path", "required": true, "schema": { "type": "integer", "format": "int64" } },
          { "name": "X-Session", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Application-Id", "in": "header", "required": true, "schema": { "type": "string" } },
          { "name": "X-Partner-Id", "in": "header", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Application.Common.Models.DTO.GetReceiptResponseDTO" } } } },
          "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails" } } } },
          "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } },
          "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApiGatewayLibrary.Models.PaginatedList`1[Application.Common.Models.DTO.TerminalV2DTO]": {
        "type": "object",
        "properties": {
          "items": { "type": "array", "items": { "$ref": "#/components/schemas/Application.Common.Models.DTO.TerminalV2DTO" }, "nullable": true },
          "page": { "type": "integer", "format": "int32" },
          "page_size": { "type": "integer", "format": "int32" },
          "total_pages": { "type": "integer", "format": "int32" },
          "total_count": { "type": "integer", "format": "int32" },
          "has_previous_page": { "type": "boolean", "readOnly": true },
          "has_next_page": { "type": "boolean", "readOnly": true }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.GetReceiptResponseDTO": {
        "type": "object",
        "properties": {
          "tpl_data": { "$ref": "#/components/schemas/Application.Common.Models.DTO.ReceiptData" },
          "tpl_name": { "type": "string", "nullable": true }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.GetTerminalDetailsV2ResponseDTO": {
        "type": "object",
        "properties": {
          "terminal_id": { "type": "string", "nullable": true, "example": "123456" },
          "custom_name": { "type": "string", "nullable": true, "example": "Main Terminal" },
          "model": { "type": "string", "nullable": true, "example": "A920Pro" },
          "serial_number": { "type": "string", "nullable": true, "example": "A920P123456" },
          "tid": { "type": "string", "nullable": true, "example": "30000001" },
          "status": { "$ref": "#/components/schemas/Domain.Enums.MposTerminalStatus" },
          "currency": { "type": "string", "nullable": true, "example": "EUR" },
          "billing_descriptor": { "type": "string", "nullable": true, "example": "MY STORE" },
          "settlement_account_id": { "type": "string", "nullable": true, "example": "123456" },
          "outlet": { "$ref": "#/components/schemas/Application.Common.Models.DTO.TerminalOutletResponseDTO" },
          "is_fiscal": { "type": "boolean", "nullable": true, "example": false },
          "is_rented": { "type": "boolean", "nullable": true, "example": false },
          "is_unattended": { "type": "boolean", "nullable": true, "example": false },
          "permissions": { "$ref": "#/components/schemas/Application.Common.Models.DTO.TerminalPermissionsResponseDTO" },
          "receipt": { "$ref": "#/components/schemas/Application.Common.Models.DTO.TerminalReceiptSettingsResponseDTO" }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.OutletResponseDTO": {
        "type": "object",
        "properties": { "outlet_id": { "type": "integer", "format": "int64" }, "name": { "type": "string", "nullable": true } },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.ReceiptData": {
        "type": "object",
        "properties": {
          "tran_uuid": { "type": "string", "nullable": true },
          "is_approved": { "type": "boolean", "nullable": true },
          "is_pending": { "type": "boolean", "nullable": true },
          "is_declined": { "type": "boolean", "nullable": true },
          "merch_name": { "type": "string", "nullable": true },
          "address_line1": { "type": "string", "nullable": true },
          "address_line2": { "type": "string", "nullable": true },
          "term_id": { "type": "string", "nullable": true },
          "merch_id": { "type": "string", "nullable": true },
          "date": { "type": "string", "nullable": true },
          "time": { "type": "string", "nullable": true },
          "card_scheme": { "type": "string", "nullable": true },
          "pan": { "type": "string", "nullable": true },
          "emboss_name": { "type": "string", "nullable": true },
          "operation_type": { "type": "string", "nullable": true },
          "amount": { "type": "number", "format": "double", "nullable": true },
          "currency": { "type": "string", "nullable": true },
          "sign_row1": { "type": "string", "nullable": true },
          "sign_row2": { "type": "string", "nullable": true },
          "sign_row3": { "type": "string", "nullable": true },
          "tx_status": { "type": "string", "nullable": true },
          "stan": { "type": "string", "nullable": true },
          "auth_code": { "type": "string", "nullable": true },
          "rrn": { "type": "string", "nullable": true },
          "aid": { "type": "string", "nullable": true },
          "lang": { "type": "string", "nullable": true },
          "logo_type": { "$ref": "#/components/schemas/Domain.Enums.Receipt.LogoType" },
          "logo_guid": { "type": "string", "nullable": true },
          "default_logo_version": { "type": "string", "nullable": true },
          "default_logo_guid": { "type": "string", "nullable": true },
          "preauth_code": { "type": "string", "nullable": true },
          "card_type": { "type": "string", "nullable": true },
          "receipt_footer_type": { "type": "string", "nullable": true },
          "receipt_footer_row1": { "type": "string", "nullable": true },
          "receipt_footer_row2": { "type": "string", "nullable": true },
          "dcc_available": { "type": "boolean", "nullable": true },
          "amount_dcc": { "type": "number", "format": "double", "nullable": true },
          "currency_dcc": { "type": "string", "nullable": true },
          "pl_card_balance": { "type": "number", "format": "double", "nullable": true },
          "pl_card_balance_currency": { "type": "string", "nullable": true },
          "is_private_label": { "type": "boolean", "nullable": true },
          "hide_extra_tran_data": { "type": "boolean", "nullable": true },
          "show_balance": { "type": "boolean", "nullable": true },
          "operator_code": { "type": "string", "nullable": true },
          "amount_tip": { "type": "number", "format": "double", "nullable": true },
          "amount_total": { "type": "number", "format": "double", "nullable": true },
          "proc_code": { "type": "string", "nullable": true },
          "tran_type_sms": { "type": "string", "nullable": true },
          "declined_message": { "type": "string", "nullable": true },
          "resp_code": { "type": "string", "nullable": true },
          "is_void": { "type": "boolean", "nullable": true },
          "is_giftcard_sale": { "type": "boolean", "nullable": true },
          "reference_number": { "type": "string", "nullable": true },
          "reference_number_type": { "type": "string", "nullable": true },
          "receipt_layout_version": { "type": "string", "nullable": true },
          "application_preferred_name": { "type": "string", "nullable": true },
          "exchange_rate_translation": { "type": "string", "nullable": true },
          "exchange_rate": { "type": "number", "format": "double", "nullable": true },
          "show_exchange_rate": { "type": "boolean", "nullable": true },
          "show_footer": { "type": "boolean", "nullable": true },
          "installment_type": { "type": "string", "nullable": true },
          "installment_number": { "type": "integer", "format": "int32", "nullable": true },
          "installment_int_rate": { "type": "number", "format": "double", "nullable": true },
          "installment_first_amount": { "type": "number", "format": "double", "nullable": true },
          "installment_subseq_amount": { "type": "number", "format": "double", "nullable": true },
          "installment_annual_perc_rate": { "type": "number", "format": "double", "nullable": true },
          "installment_fee_rate": { "type": "number", "format": "double", "nullable": true },
          "installment_total_amount": { "type": "number", "format": "double", "nullable": true },
          "is_moto": { "type": "boolean", "nullable": true },
          "is_contactless": { "type": "boolean", "nullable": true },
          "transaction_data_source": { "type": "string", "nullable": true },
          "receipt_v1": { "type": "boolean", "nullable": true },
          "receipt_address_preference": { "type": "string", "nullable": true },
          "trn": { "type": "string", "nullable": true },
          "transaction_reference": { "type": "string", "nullable": true },
          "acq_scheme": { "type": "string", "nullable": true },
          "is_qr_payment": { "type": "boolean", "nullable": true }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.TerminalModelV2ResponseDTO": {
        "type": "object",
        "properties": {
          "model": { "type": "string", "nullable": true, "example": "A920Pro" },
          "description": { "type": "string", "nullable": true, "example": "PAX A920Pro" },
          "order_position": { "type": "integer", "format": "int32", "example": 1 }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.TerminalOutletResponseDTO": {
        "type": "object",
        "properties": { "outlet_id": { "type": "string", "nullable": true, "example": "1001" }, "name": { "type": "string", "nullable": true, "example": "Main Store" } },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.TerminalPermissionsResponseDTO": {
        "type": "object",
        "properties": {
          "moto": { "type": "boolean", "example": true },
          "refund": { "type": "boolean", "example": true },
          "reversal": { "type": "boolean", "example": true },
          "settings_menu": { "type": "boolean", "example": false },
          "transactions_menu": { "type": "boolean", "example": true }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.TerminalReceiptSettingsResponseDTO": {
        "type": "object",
        "properties": {
          "footer_type": { "type": "string", "nullable": true, "example": "default" },
          "footer_lines": { "type": "array", "items": { "type": "string" }, "nullable": true, "example": ["Thank you for your purchase", "www.mypos.com"] }
        },
        "additionalProperties": false
      },
      "Application.Common.Models.DTO.TerminalV2DTO": {
        "type": "object",
        "properties": {
          "terminal_id": { "type": "integer", "format": "int64", "example": 123456 },
          "tid": { "type": "string", "nullable": true, "example": "30000001" },
          "custom_name": { "type": "string", "nullable": true, "example": "Front desk terminal" },
          "model": { "type": "string", "nullable": true, "example": "A920Pro" },
          "serial_number": { "type": "string", "nullable": true, "example": "A920P123456" },
          "status": { "$ref": "#/components/schemas/Domain.Enums.MposTerminalStatus" },
          "currency": { "type": "string", "nullable": true, "example": "EUR" },
          "outlet": { "$ref": "#/components/schemas/Application.Common.Models.DTO.OutletResponseDTO" },
          "is_fiscal": { "type": "boolean", "example": false },
          "is_rented": { "type": "boolean", "nullable": true, "example": false },
          "is_unattended": { "type": "boolean", "example": false }
        },
        "additionalProperties": false
      },
      "Domain.Enums.MposTerminalStatus": { "enum": ["Active", "Deactivated", "Reset", "ToBeConfigured", "Initial", "DoNotActivate"], "type": "string" },
      "Domain.Enums.Receipt.LogoType": { "enum": ["NoLogo", "DefaultLogo", "CustomLogo"], "type": "string" },
      "Microsoft.AspNetCore.Mvc.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 }
        },
        "additionalProperties": {}
      },
      "Microsoft.AspNetCore.Mvc.ValidationProblemDetails": {
        "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 },
          "errors": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } }, "nullable": true }
        },
        "additionalProperties": {}
      }
    },
    "securitySchemes": {
      "Bearer": { "type": "http", "description": "Input your Bearer token to access this API", "scheme": "Bearer", "bearerFormat": "JWT" }
    }
  },
  "security": [{ "Bearer": [] }]
}