Accessing the API

API Path

All API endpoints listed should be preceded with api/v1/.

Headers

All API requests made must include the following headers:

X-Token header, which is a UUIDv4. This token will either be a token to access the admin-level API, or a token specific to a reseller to access the reseller-level of the API.

Accept header, with the value application/json is required to generate a JSON response.

Reseller-level

The reseller-level token is found under the API menu item, in the API Token tab.

Admin-level

The admin-level token is supplied manually and is not visible within the application.

Example Request

An example API request using X-Token:

GET /api/v1/licenses HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b

Missing X-Token

When no X-Token header is supplied, the following error response will be given:

{
  "status": false,
  "errors": [
    [
      "Missing token"
    ]
  ]
}

Invalid X-Token

When the X-Token value is invalid, the following error response will be given:

{
  "status": false,
  "errors": [
    [
      "Invalid API credentials"
    ]
  ]
}

Failure Responses

If a request to an API endpoint fails, the following structure will be returned:

  • success: bool
  • data: object
  • errors: array|object