{
  "openapi": "3.0.3",
  "info": {
    "title": "onikora FIX Parsing API",
    "version": "1.0.0",
    "description": "HTTP API for parsing FIX messages. Single-message parsing returns the default human-readable JSON output, or the tag-based JSON output when type=tags. Batch parsing supports UFO, FFO, and sequence outputs."
  },
  "servers": [
    {
      "url": "https://www.onikora.com"
    }
  ],
  "paths": {
    "/api/fix/v1/messages/parse": {
      "post": {
        "summary": "Parse a single FIX message",
        "operationId": "parseFixMessage",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Optional override for single-message parsing. Omit it to return the default human-readable output. Use tags to return the hierarchical FIX field/tag output only.",
            "schema": {
              "type": "string",
              "enum": ["tags"]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SingleParseRequest"
              },
              "examples": {
                "singleParse": {
                  "value": {
                    "message": "8=FIX.4.4|9=61|35=A|49=CLIENT1|56=SERVER1|34=1|52=20260413-12:00:00.000|98=0|108=30|10=000|"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Parsed FIX message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SingleParseResponse"
                },
                "examples": {
                  "singleParseResponse": {
                    "value": {
                      "StandardHeader": {
                        "BeginString": "FIX.4.4",
                        "BodyLength": 61,
                        "MsgType": "A",
                        "SenderCompID": "CLIENT1",
                        "TargetCompID": "SERVER1",
                        "MsgSeqNum": 1,
                        "SendingTime": "20260413-12:00:00.000"
                      },
                      "EncryptMethod": "0",
                      "HeartBtInt": 30,
                      "StandardTrailer": {
                        "CheckSum": "000"
                      }
                    }
                  },
                  "singleParseTagsResponse": {
                    "value": {
                      "StandardHeader": {
                        "8": "FIX.4.4",
                        "9": 61,
                        "35": "A",
                        "49": "CLIENT1",
                        "56": "SERVER1",
                        "34": 1,
                        "52": "20260413-12:00:00.000"
                      },
                      "98": "0",
                      "108": 30,
                      "StandardTrailer": {
                        "10": "000"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Parse error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/fix/v1/messages/parse-batch": {
      "post": {
        "summary": "Parse multiple FIX messages in one request",
        "operationId": "parseFixBatch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchParseRequest"
              },
              "examples": {
                "batchParse": {
                  "value": {
                    "outputs": ["ufo", "ffo", "sequence"],
                    "messages": [
                      "8=FIX.4.4|9=164|35=8|49=MYSERVER|56=CLIENTLAT-EXT-1|34=59704|52=20260414-19:04:42.644|37=ORD-LAT-59701|11=LAT-59701|17=EX-LAT-59701|150=0|39=0|55=AAPL|54=1|38=100|151=100|14=0|6=0|10=030|",
                      "8=FIX.4.4|9=61|35=A|49=CLIENT1|56=SERVER1|34=1|52=20260413-12:00:00.000|98=0|108=30|10=000|"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Parsed FIX messages in request order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParseEnvelope"
                },
                "examples": {
                  "batchParseResponse": {
                    "value": {
                      "protocol": "fix",
                      "outputs": ["ufo", "ffo", "sequence"],
                      "count": 2,
                      "items": [
                        {
                          "index": 0,
                          "raw": "8=FIX.4.4|9=164|35=8|49=MYSERVER|56=CLIENTLAT-EXT-1|34=59704|52=20260414-19:04:42.644|37=ORD-LAT-59701|11=LAT-59701|17=EX-LAT-59701|150=0|39=0|55=AAPL|54=1|38=100|151=100|14=0|6=0|10=030|",
                          "messageName": "ExecutionReport",
                          "messageType": "8"
                        },
                        {
                          "index": 1,
                          "raw": "8=FIX.4.4|9=61|35=A|49=CLIENT1|56=SERVER1|34=1|52=20260413-12:00:00.000|98=0|108=30|10=000|",
                          "messageName": "Logon",
                          "messageType": "A"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "OutputList": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": ["ufo", "ffo", "sequence"]
        }
      },
      "SingleParseRequest": {
        "type": "object",
        "required": ["message"],
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "BatchParseRequest": {
        "type": "object",
        "required": ["messages"],
        "description": "If outputs is omitted, the API defaults to [\"ufo\", \"ffo\"].",
        "properties": {
          "outputs": {
            "$ref": "#/components/schemas/OutputList"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "SequenceItem": {
        "type": "object",
        "properties": {
          "time": {
            "type": "string"
          },
          "senderCompId": {
            "type": "string"
          },
          "targetCompId": {
            "type": "string"
          },
          "messageType": {
            "type": "string"
          },
          "messageName": {
            "type": "string"
          },
          "direction": {
            "type": "string"
          },
          "left": {
            "type": "string"
          },
          "right": {
            "type": "string"
          },
          "arrow": {
            "type": "string"
          },
          "flow": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ParseItem": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "raw": {
            "type": "string"
          },
          "messageName": {
            "type": "string"
          },
          "messageType": {
            "type": "string"
          },
          "ufo": {
            "type": "object"
          },
          "ffo": {
            "type": "object"
          },
          "sequence": {
            "$ref": "#/components/schemas/SequenceItem"
          }
        }
      },
      "SingleParseResponse": {
        "type": "object",
        "additionalProperties": true,
        "description": "Direct parsed message object. By default this is the human-readable hierarchical output. When type=tags is used, this is the hierarchical FIX field/tag output."
      },
      "ParseEnvelope": {
        "type": "object",
        "properties": {
          "protocol": {
            "type": "string"
          },
          "outputs": {
            "$ref": "#/components/schemas/OutputList"
          },
          "count": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ParseItem"
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
