{
  "openapi": "3.0.1",
  "info": {
    "title": "API - Litlyx",
    "description": "Api specs to get started with Litlyx analytics API.",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.litlyx.com/api/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/visits": {
      "post": {
        "description": "Retrieve raw data for visits collected with Litlyx.",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Visits"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Visits_Success"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/events": {
      "post": {
        "description": "Retrieve raw data for events collected with Litlyx.",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Events"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "API response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Events_Success"
                }
              }
            }
          },
          "400": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Visits": {
        "required": [
          "rows"
        ],
        "type": "object",
        "properties": {
          "rows": {
            "description": "Array of strings selecting the rows you want the API to return. Possible values: `website`,`page`,`referrer`,`browser`,`country`,`continent`,`os`,`device`,`created_at`,`session`,`flowHash`.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limit": {
            "description": "How many element the API should return.",
            "type": "number",
            "default": 100
          },
          "from": {
            "description": "From what day the API will return the data. Format: ISO. ",
            "type": "string",
            "default": "`2024-01-01T00:00:00+0000`"
          },
          "to": {
            "description": "To what day the API will return the data. Format: ISO.",
            "type": "string",
            "default": "`current date as ISO`"
          }
        }
      },
      "Visits_Success": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "The response is of type `object[]`. The value depends on rows you will specify in the body. It will return an object with the specified rows."
      },
      "Events": {
        "required": [
          "rows"
        ],
        "type": "object",
        "properties": {
          "rows": {
            "description": "Array of strings selecting the rows you want the API to return. Possible values: `name`,`metadata`,`created_at`,`session`.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "limit": {
            "description": "How many element the API should return.",
            "type": "number",
            "default": 100
          },
          "from": {
            "description": "From what day the API will return the data. Format: ISO. ",
            "type": "string",
            "default": "`2024-01-01T00:00:00+0000`"
          },
          "to": {
            "description": "To what day the API will return the data. Format: ISO.",
            "type": "string",
            "default": "`current date as ISO`"
          }
        }
      },
      "Events_Success": {
        "type": "array",
        "items": {
          "type": "object"
        },
        "description": "The response is of type `object[]`. The value depends on rows you will specify in the body. It will return an object with the specified rows."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}