{
  "swagger": "2.0",
  "info": {
    "title": "Hitsteps Whitelabel API Documentation",
    "version": "1.0",
    "description": "This documentation provide guideline on how to interact with Hitsteps whitelabel backend.",
    "contact": {
      "name": "Hitsteps",
      "url": "https://hitsteps.com",
      "email": "sales@hitsteps.com"
    }
  },
  "host": "hitsteps.com",
  "paths": {
    "/getToken": {
      "post": {
        "responses": {
          "200": {
            "description": "If there is error, msg will be provided:\nerror 1: Username/Password not found",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "main_account": {
                  "type": "string"
                },
                "token": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "main_account": "1234",
                "token": "b91267234abc2354b2324c134ad3454f2c"
              }
            }
          }
        },
        "summary": "Receive whitelabel token code",
        "description": "This API receive email and password of main account where whitelabel is purchased and return whitelabel token of the account.",
        "operationId": "GET_token",
        "tags": [
          "Initialization"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "username",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "password",
            "type": "string"
          }
        ]
      }
    },
    "/getwhitelabelID": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token authentication failed\nerror 2: Your account don't have any whitelabel brands",
            "schema": {
              "type": "object",
              "properties": {
                "0": {
                  "type": "object",
                  "properties": {
                    "whitelabel_id": {
                      "type": "string"
                    },
                    "whitelabel_brand": {
                      "type": "string"
                    },
                    "whitelabel_url": {
                      "type": "string"
                    }
                  }
                },
                "error": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "0": {
                  "whitelabel_id": "1",
                  "whitelabel_brand": "Hitsteps",
                  "whitelabel_url": "hitsteps.com"
                },
                "1": {
                  "whitelabel_id": "2",
                  "whitelabel_brand": "Hitsteps Whitelabel",
                  "whitelabel_url": "whitelabel.hitsteps.com"
                },
                "error": 0
              }
            }
          }
        },
        "summary": "Get whitelabel detail",
        "description": "Given Token and main account, return whitelabel detail",
        "operationId": "GET_whitelabel",
        "tags": [
          "Initialization"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "main_account",
            "type": "string"
          }
        ]
      }
    },
    "/getAccountIDfromEmail": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token authentication failed\nerror 2: Email not found under this whitelabel brand",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_account_id": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_account_id": "18"
              }
            }
          }
        },
        "summary": "Get account ID from email",
        "description": "Given email, return account ID",
        "operationId": "GET_accountid",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_email",
            "type": "string"
          }
        ]
      }
    },
    "/getAccountInfo": {
      "post": {
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          }
        ],
        "responses": {
          "200": {
            "description": "If error, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Account ID not found under this whitelabel brand.",
            "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"
                },
                "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": "22",
                "user_account_email": "sales@hitsteps.com",
                "user_timezone": "8",
                "user_country": "my",
                "user_language": "en",
                "user_nickname": "Hitsteps",
                "user_account_statusmode": "1",
                "user_license_code": "1",
                "user_trial_status": "0",
                "user_license_expiry": "1586041271"
              }
            }
          }
        },
        "summary": "Get account detail",
        "description": "Given accout ID, return account detail.",
        "operationId": "GET_Account",
        "tags": [
          "Account"
        ],
        "consumes": []
      }
    },
    "/getAccountIDfromTrackingAPIKey": {
      "post": {
        "responses": {
          "200": {
            "description": "If error, msg will be returned.\nerror 1: Token Authentication failed\nerror 2: Tracking API Key not found.",
            "schema": {
              "type": "object",
              "properties": {
                "user_account_id": {
                  "type": "integer"
                },
                "APIKey": {
                  "type": "string"
                },
                "error": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_account_id": 3,
                "APIKey": "b21345654321b4233232b"
              }
            }
          }
        },
        "summary": "Get account ID from API key",
        "description": "Given API key, return account ID",
        "operationId": "GET_accountmd5",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "tracking_api_key",
            "type": "string"
          }
        ]
      }
    },
    "/getAPIKeyFromWebsiteFullURL": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Domain name not found in your whitelabel account.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_email": {
                  "type": "string"
                },
                "user_account_id": {
                  "type": "string"
                },
                "website_name": {
                  "type": "string"
                },
                "website_url": {
                  "type": "string"
                },
                "website_id": {
                  "type": "string"
                },
                "APIKey": {
                  "type": "string"
                },
                "submission_date": {
                  "type": "string"
                },
                "total_pageviews": {
                  "type": "integer"
                },
                "total_visitors": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_email": "sales@hitsteps.com",
                "user_account_id": "33",
                "website_name": "Hitsteps",
                "website_url": "hitsteps.com",
                "website_id": "18",
                "APIKey": "34567645332b42354224a4242343544c345b",
                "submission_date": "1089804558",
                "total_pageviews": 1000,
                "total_visitors": 200
              }
            }
          }
        },
        "summary": "Get account and website detail given website URL",
        "description": "Given Website Full URL, return account and website detail.",
        "operationId": "GET_apikey_fullurl",
        "tags": [
          "Account",
          "Website"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "website_url",
            "type": "string"
          }
        ]
      }
    },
    "/getAPIKeyFromWebsiteURL": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Domain name not found in your whitelabel account.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_email": {
                  "type": "string"
                },
                "user_account_id": {
                  "type": "string"
                },
                "website_name": {
                  "type": "string"
                },
                "website_url": {
                  "type": "string"
                },
                "website_id": {
                  "type": "string"
                },
                "APIKey": {
                  "type": "string"
                },
                "submission_date": {
                  "type": "string"
                },
                "total_pageviews": {
                  "type": "integer"
                },
                "total_visitors": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_email": "sales@hitsteps.com",
                "user_account_id": "33",
                "website_name": "Hitsteps",
                "website_url": "hitsteps.com",
                "website_id": "18",
                "APIKey": "34567645332b42354224a4242343544c345b",
                "submission_date": "1089804558",
                "total_pageviews": 1000,
                "total_visitors": 200
              }
            }
          }
        },
        "summary": "Get account and website detail given website URL",
        "description": "Given Website URL, return account and website detail that match website domain.",
        "operationId": "GET_apikey_url",
        "tags": [
          "Account",
          "Website"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "website_url",
            "type": "string"
          }
        ]
      }
    },
    "/getTrackingSitefromAPIKey": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: API Key is invalid\nerror 3: This API Key doesn't belong to your whitelabel brand",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_email": {
                  "type": "string"
                },
                "user_account_id": {
                  "type": "string"
                },
                "website_name": {
                  "type": "string"
                },
                "website_url": {
                  "type": "string"
                },
                "website_id": {
                  "type": "string"
                },
                "APIKey": {
                  "type": "string"
                },
                "submission_date": {
                  "type": "string"
                },
                "total_pageviews": {
                  "type": "integer"
                },
                "total_visitors": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_email": "sales@hitsteps.com",
                "user_account_id": "33",
                "website_name": "Hitsteps",
                "website_url": "hitsteps.com",
                "website_id": "18",
                "APIKey": "34567645332b42354224a4242343544c345b",
                "submission_date": "1089804558",
                "total_pageviews": 1000,
                "total_visitors": 200
              }
            }
          }
        },
        "summary": "Get website detail from API key",
        "description": "Given API Key, return website detail associated with the API key.",
        "operationId": "GET_website_from_api",
        "tags": [
          "Website",
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "tracking_api_key",
            "type": "string"
          }
        ]
      }
    },
    "/getListofTrackingWebsites": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided:\nerror 1: Token Authentication failed\nerror 2: This account ID doesn't belong to your whitelabel brand.",
            "schema": {
              "type": "object",
              "properties": {
                "0": {
                  "type": "object",
                  "properties": {
                    "website_id": {
                      "type": "string"
                    },
                    "website_name": {
                      "type": "string"
                    },
                    "website_url": {
                      "type": "string"
                    },
                    "APIKey": {
                      "type": "string"
                    },
                    "submission_date": {
                      "type": "string"
                    },
                    "total_pageviews": {
                      "type": "integer"
                    },
                    "total_visitors": {
                      "type": "integer"
                    }
                  }
                },
                "1": {
                  "type": "object",
                  "properties": {
                    "website_id": {
                      "type": "string"
                    },
                    "website_name": {
                      "type": "string"
                    },
                    "website_url": {
                      "type": "string"
                    },
                    "APIKey": {
                      "type": "string"
                    },
                    "submission_date": {
                      "type": "string"
                    },
                    "total_pageviews": {
                      "type": "integer"
                    },
                    "total_visitors": {
                      "type": "integer"
                    }
                  }
                },
                "error": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "0": {
                  "website_id": "33",
                  "website_name": "Hitsteps",
                  "website_url": "hitsteps.com",
                  "APIKey": "bb3b12b3b5b6b532b436b",
                  "submission_date": "1084804558",
                  "total_pageviews": 1000,
                  "total_visitors": 200
                },
                "1": {
                  "website_id": "34",
                  "website_name": "Hitsteps Whitelabel",
                  "website_url": "whitelabel.hitsteps.com",
                  "APIKey": "b2b4536b5423b452b45b3",
                  "submission_date": "1001796422",
                  "total_pageviews": 900,
                  "total_visitors": 100
                },
                "error": 0
              }
            }
          }
        },
        "summary": "Get list of account websites",
        "description": "Given account id, return list of websites that are being tracked in an account",
        "operationId": "GET_list_tracking",
        "tags": [
          "Website"
        ]
      }
    },
    "/getListofAccounts": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided:\nerror 1: Token authentication failed\nerror 2: No accounts found",
            "schema": {
              "type": "object",
              "properties": {}
            },
            "examples": {
              "application/json": {
                "0": {
                  "user_account_id": "12",
                  "user_account_email": "account@example.com",
                  "user_nick": "Jack",
                  "user_account_statusmode": null,
                  "user_trial_status": "1",
                  "user_license_code": "0",
                  "user_license_expiry": "1007514389"
                },
                "1": {
                  "user_account_id": "13",
                  "user_account_email": "customer@example.com",
                  "user_nick": "John",
                  "user_account_statusmode": null,
                  "user_trial_status": "0",
                  "user_license_code": "3",
                  "user_license_expiry": "1230021058"
                },
                "error": 0
              }
            }
          }
        },
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          }
        ],
        "operationId": "GET_list_accounts",
        "tags": [
          "Account",
          "Initialization"
        ],
        "summary": "Get list of whitelabel brand accounts",
        "description": "Get list of accounts under a whitelabel brand"
      }
    },
    "/setEmail": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following codes will follow.\nerror 1: Token Authentication failed\nerror 2: New email cannot be empty\nerror 3: New email is already a main account in database as an account\nerror 4: New email is already a user in account.\nerror 5: Account not found or not under your whitelabel",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "oldemail": {
                  "type": "string"
                },
                "newemail": {
                  "type": "string"
                },
                "msg": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "oldemail": "old@example.com",
                "newemail": "new@example.com",
                "msg": "Email changed from old to new."
              }
            }
          }
        },
        "summary": "Change account email address",
        "description": "Update a customer account email address",
        "operationId": "PUT_emailaddress",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "new_email",
            "type": "string"
          }
        ]
      }
    },
    "/setPassword": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Account not found or not under your whitelabel\nerror 3: New password cannot be empty",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0
              }
            }
          }
        },
        "summary": "Change account password",
        "description": "Given account id and new password, update account's password.",
        "operationId": "PUT_password",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "new_password",
            "type": "string"
          }
        ]
      }
    },
    "/createAccount": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be provided.\nerror 1: Token invalid\nerror 2: Email address already exists\nerror 3: Email cannot be empty\nerror 4: Password cannot be empty\nerror 5: Nickname cannot be empty\nerror 8: Language cannot be empty. at least, set it default: en",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "user_account_id": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "user_account_id": 213,
                "msg": "Account created."
              }
            }
          }
        },
        "summary": "Register a new account",
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "email",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "password",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "nickname",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "language",
            "type": "string"
          }
        ],
        "description": "Create a new account under whitelabel brand.",
        "tags": [
          "Account"
        ],
        "operationId": "POST_newaccount"
      }
    },
    "/newTracking": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Account ID not found in your whitelabel database\nerror 3: This website already exists in this user's account. Please use API function of getAPIKeyFromWebsiteURL() next time to check first.\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": "Website added.",
                "APIKey": "b123b3432b5b23232ab324",
                "user_account_id": 32,
                "website_id": 34,
                "site_url": "hitsteps.com"
              }
            }
          }
        },
        "summary": "Add a site to track under an account",
        "description": "Add a new site to track under account.",
        "operationId": "POST_account_site",
        "tags": [
          "Website"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "site_name",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_url",
            "type": "string"
          }
        ]
      }
    },
    "/newTrackingFullURL": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Account ID not found in your whitelabel database\nerror 3: This website already exists in this user's account. Please use API function of getAPIKeyFromWebsiteURL() next time to check first.\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": "Website added.",
                "APIKey": "b123b3432b5b23232ab324",
                "user_account_id": 32,
                "website_id": 34,
                "site_url": "hitsteps.com"
              }
            }
          }
        },
        "summary": "Add a site to track under an account (Full URL)",
        "description": "Add a new site to track under account given Full URL.",
        "operationId": "POST_account_siteFullUrl",
        "tags": [
          "Website"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "site_name",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "site_url",
            "type": "string"
          }
        ]
      }
    },
    "/requestTrial": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be given.\nerror 1: Token Authentication failed\nerror 2: This Account doesn't belong to your whitelabel brand.\nerror 3: This account is registered more than 45 days ago. you cannot activate trial for it. consider buying a license.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "expire": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "expire": 123436234,
                "msg": "7-day trial activated successfully."
              }
            }
          }
        },
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "string"
          }
        ],
        "operationId": "PUT_freetrial",
        "tags": [
          "Billing"
        ],
        "summary": "Request free trial",
        "description": "Request a free 7-day trial activation for an account."
      }
    },
    "/requestFree": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will provided:\nerror 1: Token Authentication failed\nerror 2: not eligible. because hits exceed free plan limitation.\nerror 3: not eligible. because number of sites in this account exceed allowed sites of free license.\nerror 4: not eligible. because hits of this account and also number of sites in this account exceed free license allowance.\nerror 5: This account doesn't belong to your whitelabel brand.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "msg": "Free account activated"
              }
            }
          }
        },
        "summary": "Request free plan activation",
        "description": "Free plan provide limited functionality. An account can be converted to free account to avoid dashboard asking user to pay for basic analytics features.",
        "operationId": "PUT_freeaccount",
        "tags": [
          "Billing"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          }
        ]
      }
    },
    "/newLicense": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will appear.\nerror 1: Token Authentication failed\nerror 2: Plan ID is invalid. 0 is starter, 1 is basic, ... (use getPlans API to get list of available plans)\nerror 3: This Account doesn't belong to your whitelabel brand.",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                },
                "license_converted": {
                  "type": "integer"
                },
                "license_convert_old_plan": {
                  "type": "integer"
                },
                "license_convert_new_plan": {
                  "type": "integer"
                },
                "license_convert_old_price": {
                  "type": "integer"
                },
                "license_convert_new_price": {
                  "type": "number"
                },
                "license_convert_old_price_days": {
                  "type": "integer"
                },
                "license_convert_new_price_days": {
                  "type": "integer"
                },
                "license_convert_total_days": {
                  "type": "integer"
                },
                "hitsteps_share": {
                  "type": "number"
                },
                "license_plan_id": {
                  "type": "integer"
                },
                "license_plan_name": {
                  "type": "string"
                },
                "license_plan_months": {
                  "type": "integer"
                },
                "license_expiry": {
                  "type": "integer"
                },
                "license_expiry_processed": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "msg": "License activated",
                "license_converted": 0,
                "license_convert_old_plan": 0,
                "license_convert_new_plan": 3,
                "license_convert_old_price": 0,
                "license_convert_new_price": 9.99,
                "license_convert_old_price_days": 2,
                "license_convert_new_price_days": 28,
                "license_convert_total_days": 30,
                "hitsteps_share": 6.99,
                "license_plan_id": 3,
                "license_plan_name": "Pro",
                "license_plan_months": 12,
                "license_expiry": 1234623540,
                "license_expiry_processed": "2016-09-16"
              }
            }
          }
        },
        "summary": "Purchase a license for an account",
        "description": "Allow purchasing a license for an account under your whitelabel, and receive invoice to pay our share at end of the month.",
        "operationId": "POST_new_license",
        "tags": [
          "Billing"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "plan",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "duration",
            "type": "integer",
            "description": "months. for example 1, 3, 6, 9 or 12."
          }
        ]
      }
    },
    "/convertLicense": {
      "post": {
        "summary": "Convert an existing license to other license",
        "description": "Upgrade or downgrade an license without charging a fee by converting remaining days of a license to new license by pro rata calculation.",
        "operationId": "PUT_convertlicense",
        "tags": [
          "Billing"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "user_account_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "newplan",
            "type": "integer"
          }
        ],
        "responses": {
          "200": {
            "description": "If error occured, following codes will be provided.\nerror 1: Token authorization failed.\nerror 2: This Account doesn't belong to your whitelabel brand.\nerror 3: Plan ID is invalid. 0 is starter, 1 is basic, ... (use getPlans API to get list of available plans)\nerror 4: This user's license is already expired. You cannot convert remaining to new license. consider buying new license.\nerror 5: This user is still in trial period. you cannot convert trial to a paid license.",
            "examples": {
              "application/json": {
                "error": 0,
                "msg": "License converted successfully",
                "license_converted": 0,
                "license_convert_old_plan": 0,
                "license_convert_new_plan": 3,
                "license_convert_old_price": 0,
                "license_convert_new_price": 9.99,
                "license_convert_old_price_days": 2,
                "license_convert_new_price_days": 28,
                "license_convert_total_days": 30,
                "hitsteps_share": 0,
                "license_plan_id": 3,
                "license_plan_name": "Pro",
                "license_plan_months": 12,
                "license_expiry": 1234623540,
                "license_expiry_processed": "2016-09-16"
              }
            },
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "msg": {
                  "type": "string"
                },
                "license_converted": {
                  "type": "integer"
                },
                "license_convert_old_plan": {
                  "type": "integer"
                },
                "license_convert_new_plan": {
                  "type": "integer"
                },
                "license_convert_old_price": {
                  "type": "integer"
                },
                "license_convert_new_price": {
                  "type": "number"
                },
                "license_convert_old_price_days": {
                  "type": "integer"
                },
                "license_convert_new_price_days": {
                  "type": "integer"
                },
                "license_convert_total_days": {
                  "type": "integer"
                },
                "hitsteps_share": {
                  "type": "integer"
                },
                "license_plan_id": {
                  "type": "integer"
                },
                "license_plan_name": {
                  "type": "string"
                },
                "license_plan_months": {
                  "type": "integer"
                },
                "license_expiry": {
                  "type": "integer"
                },
                "license_expiry_processed": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/getPlans": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be returned:\nerror 1: Token Authentication failed\nerror 2: Unexpected internal error. Pricing not found for your whitelabel brand.",
            "schema": {
              "type": "object",
              "properties": {
                "0": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string"
                    },
                    "hit": {
                      "type": "string"
                    },
                    "hit_label": {
                      "type": "string"
                    },
                    "sites": {
                      "type": "string"
                    },
                    "history": {
                      "type": "string"
                    },
                    "goal": {
                      "type": "string"
                    },
                    "chat": {
                      "type": "string"
                    },
                    "chat_agent": {
                      "type": "string"
                    },
                    "https": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "social": {
                      "type": "string"
                    },
                    "heatmap_click": {
                      "type": "string"
                    },
                    "heatmap_days": {
                      "type": "string"
                    },
                    "uptime": {
                      "type": "string"
                    },
                    "uptime_credits": {
                      "type": "string"
                    },
                    "y2price": {
                      "type": "number"
                    },
                    "yprice": {
                      "type": "number"
                    },
                    "mo9price": {
                      "type": "number"
                    },
                    "mo6price": {
                      "type": "number"
                    }
                  }
                },
                "-1": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "price": {
                      "type": "string"
                    },
                    "hit": {
                      "type": "string"
                    },
                    "hit_label": {
                      "type": "string"
                    },
                    "sites": {
                      "type": "string"
                    },
                    "history": {
                      "type": "string"
                    },
                    "goal": {
                      "type": "string"
                    },
                    "chat": {
                      "type": "string"
                    },
                    "chat_agent": {
                      "type": "string"
                    },
                    "https": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "social": {
                      "type": "string"
                    },
                    "heatmap_click": {
                      "type": "string"
                    },
                    "heatmap_days": {
                      "type": "string"
                    },
                    "uptime": {
                      "type": "string"
                    },
                    "uptime_credits": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "examples": {
              "application/json": {
                "0": {
                  "id": "0",
                  "name": "Starter",
                  "price": "8",
                  "hit": "10000",
                  "hit_label": "10k/mo",
                  "sites": "2",
                  "history": "30",
                  "goal": "3",
                  "chat": "1",
                  "chat_agent": "1",
                  "https": "1",
                  "label": "3",
                  "social": "0",
                  "heatmap_click": "0",
                  "heatmap_days": "0",
                  "uptime": "0",
                  "uptime_credits": "0",
                  "y2price": 95.81,
                  "yprice": 53.89,
                  "mo9price": 41.53,
                  "mo6price": 28.44
                },
                "-1": {
                  "id": "-1",
                  "name": "Free",
                  "price": "0",
                  "hit": "2000",
                  "hit_label": "2k/mo",
                  "sites": "1",
                  "history": "14",
                  "goal": "0",
                  "chat": "0",
                  "chat_agent": "0",
                  "https": "1",
                  "label": "0",
                  "social": "0",
                  "heatmap_click": "0",
                  "heatmap_days": "0",
                  "uptime": "0",
                  "uptime_credits": "0"
                }
              }
            }
          }
        },
        "summary": "Return list of plans available for purchase",
        "description": "Return list of plans available for purchase along with the pricing set by whitelabel brand.",
        "operationId": "GET_plans",
        "tags": [
          "Billing"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          }
        ]
      }
    },
    "/get7daysHits": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be provided.\nerror 1: Token Authentication failed\nerror 2: Website ID not found in your whitelabel account.\nerror 3: This account doesn't belong to your whitelabel brand\nerror 4: This website don't have any visits yet.",
            "schema": {
              "type": "object",
              "properties": {
                "0": {
                  "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"
                    }
                  }
                },
                "1": {
                  "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"
                    }
                  }
                },
                "2": {
                  "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"
                    }
                  }
                },
                "3": {
                  "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"
                    }
                  }
                },
                "4": {
                  "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"
                    }
                  }
                },
                "5": {
                  "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"
                    }
                  }
                },
                "6": {
                  "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"
                    }
                  }
                },
                "error": {
                  "type": "integer"
                }
              }
            },
            "examples": {
              "application/json": {
                "0": {
                  "day": "20150122",
                  "date": "1379622402",
                  "visits": "320",
                  "pageviews": "1609",
                  "new_visits": "29",
                  "ref_from_sites": "22",
                  "ref_from_search": "10",
                  "ref_direct": "330",
                  "ref_socialmedia": "1",
                  "bouncerate": "19"
                },
                "1": {
                  "day": "20150121",
                  "date": "1379536001",
                  "visits": "433",
                  "pageviews": "1766",
                  "new_visits": "61",
                  "ref_from_sites": "32",
                  "ref_from_search": "23",
                  "ref_direct": "610",
                  "ref_socialmedia": "2",
                  "bouncerate": "21"
                },
                "2": {
                  "day": "20150120",
                  "date": "1379449662",
                  "visits": "436",
                  "pageviews": "1710",
                  "new_visits": "46",
                  "ref_from_sites": "15",
                  "ref_from_search": "9",
                  "ref_direct": "448",
                  "ref_socialmedia": "2",
                  "bouncerate": "27"
                },
                "3": {
                  "day": "20150119",
                  "date": "1379363201",
                  "visits": "389",
                  "pageviews": "1471",
                  "new_visits": "53",
                  "ref_from_sites": "20",
                  "ref_from_search": "15",
                  "ref_direct": "405",
                  "ref_socialmedia": "1",
                  "bouncerate": "28"
                },
                "4": {
                  "day": "20150118",
                  "date": "1379276801",
                  "visits": "357",
                  "pageviews": "1589",
                  "new_visits": "49",
                  "ref_from_sites": "20",
                  "ref_from_search": "10",
                  "ref_direct": "476",
                  "ref_socialmedia": "2",
                  "bouncerate": "24"
                },
                "5": {
                  "day": "20150117",
                  "date": "1379190581",
                  "visits": "403",
                  "pageviews": "1800",
                  "new_visits": "60",
                  "ref_from_sites": "30",
                  "ref_from_search": "8",
                  "ref_direct": "516",
                  "ref_socialmedia": "2",
                  "bouncerate": "27"
                },
                "6": {
                  "day": "20150116",
                  "date": "1379104001",
                  "visits": "393",
                  "pageviews": "1973",
                  "new_visits": "64",
                  "ref_from_sites": "40",
                  "ref_from_search": "13",
                  "ref_direct": "473",
                  "ref_socialmedia": "1",
                  "bouncerate": "30"
                },
                "error": 0
              }
            }
          }
        },
        "summary": "Get last 7 days statistics",
        "description": "Request last 7 days statistics of a website.",
        "operationId": "GET_7stats",
        "tags": [
          "Analytics"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          }
        ]
      }
    },
    "/shortlink": {
      "post": {
        "responses": {
          "200": {
            "description": "If error occured, following msg will be given.\nerror 1: Token Authentication failed\nerror 2: Please validate Website ID. We didn't find it\nerror 3: This account doesn't belong to your whitelabel brand.\nerror 4: Report name is wrong",
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "integer"
                },
                "autologin_url": {
                  "type": "string"
                },
                "simple_url": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "application/json": {
                "error": 0,
                "autologin_url": "http://whitelabel.brand/login.php?code=b123432433&service=dashboard",
                "simple_url": "http://whitelabel.brand/stats/34234/dashboard"
              }
            }
          }
        },
        "summary": "Get a direct link to specified service",
        "description": "Return direct link to specified services in whitelabel domain:\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",
        "operationId": "GET_directlink",
        "tags": [
          "Analytics",
          "Account"
        ],
        "parameters": [
          {
            "in": "formData",
            "name": "whitelabel_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "token",
            "type": "string"
          },
          {
            "in": "formData",
            "name": "website_id",
            "type": "integer"
          },
          {
            "in": "formData",
            "name": "reportname",
            "type": "string"
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Initialization"
    },
    {
      "name": "Account"
    },
    {
      "name": "Website"
    },
    {
      "name": "Billing"
    },
    {
      "name": "Analytics"
    }
  ],
  "parameters": {},
  "basePath": "/api/whitelabel",
  "schemes": [
    "https"
  ],
  "consumes": [
    "multipart/form-data"
  ],
  "produces": [
    "application/json"
  ]
}
