{
  "swagger": "2.0",
  "info": {
    "title": "Callback API",
    "version": "1.0",
    "contact": {
      "name": "Hitsteps",
      "url": "https://hitsteps.com",
      "email": "sales@hitsteps.com"
    },
    "description": "This documentation provide guideline on how to interact with Hitsteps analytics backend."
  },
  "host": "hitsteps.com",
  "paths": {
    "/getAPI": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following messages will be shown.\nerror 1: Username/Password not found\nerror 2: No website added. Please add a website to account first.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "main_account": {
                  "type": "string"
                },
                "apicode": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "main_account": "18",
                "apicode": "b213324b32424242b25b12b"
              }
            }
          }
        },
        "summary": "Get an account API Key",
        "description": "Given email and password, return account ID and API key.",
        "operationId": "GET_apikey",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "username",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "password",
            "type": "string"
          }
        ]
      }
    },
    "/getAccountInfo": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occur, following msg will be given.\nerror 1: API Code Authentication failed/API Code failed/API Code Auth failed",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_account_id": {
                  "type": "string"
                },
                "user_account_email": {
                  "type": "string"
                },
                "user_timezone": {
                  "type": "string"
                },
                "user_country": {
                  "type": "string"
                },
                "user_language": {
                  "type": "string"
                },
                "user_nickname": {
                  "type": "string"
                },
                "website_id": {
                  "type": "string"
                },
                "website_name": {
                  "type": "string"
                },
                "website_url": {
                  "type": "string"
                },
                "user_account_statusmode": {
                  "type": "string"
                },
                "user_license_code": {
                  "type": "string"
                },
                "user_trial_status": {
                  "type": "string"
                },
                "user_license_expiry": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_account_id": "18",
                "user_account_email": "sales@hitsteps.com",
                "user_timezone": "8",
                "user_country": "my",
                "user_language": "en",
                "user_nickname": "Hitsteps",
                "website_id": "32",
                "website_name": "Hitsteps",
                "website_url": "hitsteps.com",
                "user_account_statusmode": "1",
                "user_license_code": "1",
                "user_trial_status": "0",
                "user_license_expiry": "1386041271"
              }
            }
          }
        },
        "summary": "Return API key detail",
        "description": "Given API key, return account and website detail.",
        "operationId": "GET_website_api",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          }
        ]
      }
    },
    "/getListofTrackingWebsites": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be given.\nerror 1: API Code Authentication failed",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "website_id": {
                        "type": "string"
                      },
                      "website_name": {
                        "type": "string"
                      },
                      "website_url": {
                        "type": "string"
                      },
                      "website_thumb": {
                        "type": "string"
                      },
                      "website_favicon": {
                        "type": "string"
                      },
                      "APIKey": {
                        "type": "string"
                      },
                      "submission_date": {
                        "type": "string"
                      },
                      "total_pageviews": {
                        "type": "integer"
                      },
                      "total_visitors": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": [
                  {
                    "website_id": "18",
                    "website_name": "Hitsteps",
                    "website_url": "hitsteps.com",
                    "website_thumb": "https://www.hitsteps.com/thumb/thumb.php?u=http://hitsteps.com",
                    "website_favicon": "https://www.hitsteps.com/favicon/?u=http://hitsteps.com",
                    "APIKey": "b12343536b5312b433ab139",
                    "submission_date": "1084804558",
                    "total_pageviews": 1000,
                    "total_visitors": 200
                  }
                ]
              }
            }
          }
        },
        "summary": "Return list of websites accessible for API key",
        "description": "Given API key of a website, return list of all websites accessible by owner of API key.",
        "operationId": "GET_list_api",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          }
        ]
      }
    },
    "/newTrackingAPI": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be given.\nerror 1: API Code Authentication failed\nerror 2: Account ID not found\nerror 3: This website already exists in this user's account\nerror 4: User License Error. User have reached capacity of allowed websites in his account. Consider upgrading license",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                },
                "APIKey": {
                  "type": "string"
                },
                "user_account_id": {
                  "type": "integer"
                },
                "website_id": {
                  "type": "integer"
                },
                "site_url": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "msg": "Added",
                "APIKey": "b124235432431b324a2b",
                "user_account_id": 18,
                "website_id": 213,
                "site_url": "hitsteps.com"
              }
            }
          }
        },
        "summary": "Add a new website to account via API key",
        "description": "Add a new tracking website to the account given API key.",
        "operationId": "POST_newsite",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_name",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_url",
            "type": "string"
          }
        ]
      }
    },
    "/newTrackingUser": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be given.\nerror 2: Account ID not found\nerror 3: This website already exists in this user's account\nerror 4: User License Error. User have reached capacity of allowed websites in his account. Consider upgrading license",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                },
                "APIKey": {
                  "type": "string"
                },
                "user_account_id": {
                  "type": "integer"
                },
                "website_id": {
                  "type": "integer"
                },
                "site_url": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "msg": "Added",
                "APIKey": "b124235432431b324a2b",
                "user_account_id": 18,
                "website_id": 213,
                "site_url": "hitsteps.com"
              }
            }
          }
        },
        "summary": "Add a new website to account via login info",
        "description": "Given email and password, add a new website to an account.",
        "operationId": "POST_new_site_user",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "username",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "password",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_name",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_url",
            "type": "string"
          }
        ]
      }
    },
    "/getXdaysHits": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occur, following msg will be given.\nerror 1: API invalid.\nerror 2: Website ID invalid.\nerror 3: This account doesn't belong to you.\nerror 4: This website don't have any visits in specified daterange",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string"
                      },
                      "visits": {
                        "type": "string"
                      },
                      "pageviews": {
                        "type": "string"
                      },
                      "new_visits": {
                        "type": "string"
                      },
                      "ref_from_sites": {
                        "type": "string"
                      },
                      "ref_from_search": {
                        "type": "string"
                      },
                      "ref_direct": {
                        "type": "string"
                      },
                      "ref_socialmedia": {
                        "type": "string"
                      },
                      "bouncerate": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": [
                  {
                    "day": "20100101",
                    "date": "1279708801",
                    "visits": "200",
                    "pageviews": "1000",
                    "new_visits": "20",
                    "ref_from_sites": "10",
                    "ref_from_search": "5",
                    "ref_direct": "2",
                    "ref_socialmedia": "3",
                    "bouncerate": "6"
                  }
                ]
              }
            }
          }
        },
        "summary": "Get daily statistics for past X days",
        "description": "Given number of days, return daily statistics of website.",
        "operationId": "GET_daily_x_hits",
        "tags": [
          "Statistics"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "days",
            "type": "integer"
          }
        ]
      }
    },
    "/now": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occurs, following msg will be given.\nerror 1: API invaid\nerror 2: Site ID not found\nerror 3: Account does not belong to you",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "object",
                  "properties": {
                    "online": {
                      "type": "integer"
                    },
                    "online_active": {
                      "type": "integer"
                    },
                    "online_idle": {
                      "type": "integer"
                    },
                    "online_mobile": {
                      "type": "integer"
                    },
                    "online_desktop": {
                      "type": "integer"
                    },
                    "unread": {
                      "type": "integer"
                    },
                    "unread_me": {
                      "type": "integer"
                    },
                    "total_pageviews": {
                      "type": "integer"
                    },
                    "total_visitors": {
                      "type": "integer"
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": {
                  "online": 10,
                  "online_active": 9,
                  "online_idle": 1,
                  "online_mobile": 3,
                  "online_desktop": 7,
                  "unread": 10,
                  "unread_me": 3,
                  "total_pageviews": 1000,
                  "total_visitors": 200
                }
              }
            }
          }
        },
        "summary": "Return online and realtime data",
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          }
        ],
        "description": "Given website ID, return current online, total visitors and chat unread messages belong to user for that website and belong all users in website.",
        "operationId": "GET_now",
        "tags": [
          "Statistics"
        ]
      }
    },
    "/secondlyhits": {
      "post": {
        "responses": {
          "200": {
            "description": "Second column return HH-MM-SS.\nIf error occured, following msg will be given.\nerror 1: API invalid\nerror 2: Website ID not found\nerror 3: Account do not belong to you.\nerror 4: This website don't have any visits in specified daterange",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string"
                      },
                      "second": {
                        "type": "string"
                      },
                      "visits": {
                        "type": "string"
                      },
                      "pageviews": {
                        "type": "string"
                      },
                      "new_visits": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": [
                  {
                    "day": "20100122",
                    "date": "1279707017",
                    "second": "153017",
                    "visits": "0",
                    "pageviews": "1",
                    "new_visits": "0"
                  },
                  {
                    "day": "20100122",
                    "date": "1279707069",
                    "second": "153109",
                    "visits": "0",
                    "pageviews": "1",
                    "new_visits": "0"
                  },
                  {
                    "day": "20100122",
                    "date": "1279707120",
                    "second": "153200",
                    "visits": "0",
                    "pageviews": "1",
                    "new_visits": "0"
                  },
                  {
                    "day": "20100122",
                    "date": "1279707135",
                    "second": "153215",
                    "visits": "0",
                    "pageviews": "1",
                    "new_visits": "0"
                  },
                  {
                    "day": "20100122",
                    "date": "1279707213",
                    "second": "153333",
                    "visits": "1",
                    "pageviews": "1",
                    "new_visits": "0"
                  }
                ]
              }
            }
          }
        },
        "summary": "Return second by second statistics",
        "description": "Activate second by second analytics for specified website and return second by second website statistics.\nDate range is linux timestamp in account specified date timezone.",
        "operationId": "GET_secondly",
        "tags": [
          "Statistics"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "starttime",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "endtime",
            "type": "integer"
          }
        ]
      }
    },
    "/hourlyhits": {
      "post": {
        "responses": {
          "200": {
            "description": "Second column return HH-MM-SS.\nIf error occured, following msg will be given.\nerror 1: API invalid\nerror 2: Website ID not found\nerror 3: Account do not belong to you.\nerror 4: This website don't have any visits in specified daterange",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string"
                      },
                      "hour": {
                        "type": "string"
                      },
                      "visits": {
                        "type": "string"
                      },
                      "pageviews": {
                        "type": "string"
                      },
                      "new_visits": {
                        "type": "string"
                      },
                      "ref_from_sites": {
                        "type": "integer"
                      },
                      "ref_from_search": {
                        "type": "integer"
                      },
                      "ref_direct": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": [
                  {
                    "day": "20100122",
                    "date": "1279707017",
                    "hour": "15",
                    "visits": "1",
                    "pageviews": "2",
                    "new_visits": "0",
                    "ref_from_sites": 0,
                    "ref_from_search": 0,
                    "ref_direct": 1
                  }
                ]
              }
            }
          }
        },
        "summary": "Return hour by hour statistics",
        "description": "Return hour by hour website statistics.\nDate range is linux timestamp in account specified date timezone.",
        "operationId": "GET_hourly",
        "tags": [
          "Statistics"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "starttime",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "endtime",
            "type": "integer"
          }
        ]
      }
    },
    "/dailyhits": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occur, following msg will be given.\nerror 1: API invalid.\nerror 2: Website ID invalid.\nerror 3: This account doesn't belong to you.\nerror 4: This website don't have any visits in specified daterange",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "day": {
                        "type": "string"
                      },
                      "date": {
                        "type": "string"
                      },
                      "visits": {
                        "type": "string"
                      },
                      "pageviews": {
                        "type": "string"
                      },
                      "new_visits": {
                        "type": "string"
                      },
                      "ref_from_sites": {
                        "type": "string"
                      },
                      "ref_from_search": {
                        "type": "string"
                      },
                      "ref_direct": {
                        "type": "string"
                      },
                      "ref_socialmedia": {
                        "type": "string"
                      },
                      "bouncerate": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "data": [
                  {
                    "day": "20100101",
                    "date": "1279708801",
                    "visits": "200",
                    "pageviews": "1000",
                    "new_visits": "20",
                    "ref_from_sites": "10",
                    "ref_from_search": "5",
                    "ref_direct": "2",
                    "ref_socialmedia": "3",
                    "bouncerate": "6"
                  }
                ]
              }
            }
          }
        },
        "summary": "Get daily statistics for past X days",
        "operationId": "POST_dailyhits",
        "tags": [
          "Statistics"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "startday",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "endday",
            "type": "string"
          }
        ],
        "description": "Given date range, return daily statistics of website.\nDate range is in YYYYMMDD format."
      }
    },
    "/shortlink": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided. \nerror 1: API Authentication failed \nerror 2: Invalid website ID\nerror 3: This account do not belong to you\nerror 4: Report link requested is invalid",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "autologin_url": {
                  "type": "string"
                },
                "simple_url": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "autologin_url": "http://hitsteps.com/login.php?code=b123432433&service=dashboard",
                "simple_url": "http://hitsteps.com/stats/34234/dashboard"
              }
            }
          }
        },
        "summary": "Generate direct link to specified services",
        "description": "Return direct link to specified services:\n* dashboard\n* livemap\n* onlineusers\n* recentpageviews\n* popularpages\n* topentrypages\n* topexitpages\n* downloads\n* downloadactivity\n* chat\n* users\n* departments\n* shortcuts\n* chatsettings\n* overview\n* recentvisitors\n* loyalvisitors\n* uniquevisitors\n* topcountry\n* visitormap\n* averagetraffic\n* excludeip\n* exportcsv\n* browseros\n* resolution\n* language\n* cookie\n* cpu\n* timezone\n* recentreferral\n* topreferral\n* socialmedia\n* blockreferral\n* exitlink\n* exitlinkactivity\n* searchengine\n* keywordanalysis\n* recentkeywords\n* keywordtrends\n* labels\n* newlabel\n* goals\n* newgoal\n* campaigns\n* newcampaign\n* sitesetting\n* accountsetting\n* listmysites",
        "tags": [
          "Account"
        ],
        "operationId": "GET_links",
        "parameters": [
          {
            "in": "formData",
            "name": "apicode",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "reportname",
            "type": "string"
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Account"
    },
    {
      "name": "Statistics"
    }
  ],
  "basePath": "/api/callback",
  "schemes": [
    "https"
  ],
  "consumes": [
    "multipart/form-data"
  ],
  "produces": [
    "application/json"
  ]
}