Skip to content

9Hits API#

The public API lets you manage campaigns, read account information and look up Viewer sessions over HTTP. This page covers authentication and the common response format, and lists every action.

Authentication#

Append your API key to the end of the URL with the ?key= parameter:

GET https://dash.9hits.com/api/profileGet?key=YOUR_API_KEY

The API key, the switch that turns the API on, and the IP whitelist are on the Profile page. When the API is off, every request is rejected. When the whitelist has IPs, only those IPs can call it. The API key is not the same as the access key the Viewer app uses to log in; don't mix them up.

Response format#

Every response, including errors, has the same shape:

{
    "status": "ok",
    "messages": ["Fetched 1"],
    "data": {}
}
  • status: "ok" or "error".
  • messages: an array of descriptive strings, or null.
  • data: the result. Its type depends on the action (object, array, string, number or null).

Example error:

{
    "status": "error",
    "messages": ["Not found your campaign with id #999999"],
    "data": null
}

Always HTTP 200

The server returns HTTP 200 even on errors. Check the status field in the body; don't rely on the HTTP status code.

Actions#

Action Method Description
profileGet GET/POST Account information: funds, points, slots, membership
siteGet GET/POST List campaigns, with filtering and pagination
siteAdd POST Create a new campaign
siteUpdate POST Partially update an existing campaign
siteDel POST Delete campaigns by a list of ids
uaGet GET/POST List your custom user-agent groups
sessionIPs GET/POST IPs of all running Viewer sessions
sessionCount GET/POST Count running Viewer sessions
transfer POST Transfer points to another account
fund POST Add funds for another member (reseller)

GET/POST: both methods work the same way. POST: POST only, with the data sent in the body.