API Path

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

Headers

All API requests made must include an 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.

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

GET /members

Example Request

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

Response Structure

  • data: array[object]
    • id: int
    • first_name: string
    • last_name: string
    • email: string
    • telephone_number: string
    • mobile_number: string
    • is_active: bool
    • is_enabled: true
    • last_login: string ("2020-12-31 00:00:00")
    • created_at: string ("2020-12-31 00:00:00+00:00")
    • roles: object
      • data: object
        • id: int
        • name: string

Example Response

{
  "data":[
    {
      "id":1,
      "first_name":"Reseller Admin",
      "last_name":"Example",
      "email":"reselleradmin@example.com",
      "telephone_number":null,
      "mobile_number":null,
      "is_active":true,
      "is_enabled":true,
      "last_login":"2018-04-25 14:57:11",
      "created_at":"2018-04-11T10:10:17+00:00",
      "roles":{
        "data":{
          "id":4,
          "name":"Reseller Admin"
        }
      }
    },
    {
      "id":3,
      "first_name":"Reseller Staff",
      "last_name":"Example",
      "email":"resellerstaff@example.com",
      "telephone_number":null,
      "mobile_number":null,
      "is_active":true,
      "is_enabled":true,
      "last_login":null,
      "created_at":"2018-04-11T10:10:17+00:00",
      "roles":{
        "data":{
          "id":5,
          "name":"Reseller Staff"
        }
      }
    }
  ]
}

GET /members/{id}

Example Request

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

Response Structure

  • data object
    • id: int
    • first_name: string
    • last_name: string
    • email: string
    • telephone_number: string
    • mobile_number: string
    • is_active: bool
    • is_enabled: true
    • last_login: string ("2020-12-31 00:00:00")
    • created_at: string ("2020-12-31 00:00:00+00:00")
    • roles: object
      • data: object
        • id: int
        • name: string

Example Response

"data":{
  "id":1,
  "first_name":"Reseller Admin",
  "last_name":"Example",
  "email":"reselleradmin@example.com",
  "telephone_number":null,
  "mobile_number":null,
  "is_active":true,
  "is_enabled":true,
  "last_login":"2018-04-25 14:57:11",
  "created_at":"2018-04-11T10:10:17+00:00",
  "roles":{
    "data":{
      "id":4,
      "name":"Reseller Admin"
    }
  }
}

POST /members

Request Structure

  • first_name: string, required
  • last_name: string, required
  • email: string, required
  • telephone_number: string
  • mobile_number: string

Example Request

POST /api/v1/members HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b
Content-Type: application/json

{
    "first_name": "Reseller Staff",
    "last_name": "Example Two",
    "email": "resellerstaff2@example.com",
}

Response Structure

  • success: bool
  • messages: string
  • data: object
    • data: object
      • id: int
      • first_name: string
      • last_name: string
      • email: string
      • telephone_number: string
      • mobile_number: string
      • is_active: bool
      • is_enabled: true
      • last_login: string ("2020-12-31 00:00:00")
      • created_at: string ("2020-12-31 00:00:00+00:00")
      • roles: object
        • data: object
          • id: int
          • name: string

Example Response

{
  "success":true,
  "messages":"Member added to company.",
  "data":{
    "data":{
      "id":3,
      "first_name":"Reseller Staff",
      "last_name":"Example Two",
      "email":"resellerstaff2@example.com",
      "telephone_number":null,
      "mobile_number":null,
      "is_active":false,
      "is_enabled":true,
      "last_login":null,
      "created_at":"2018-04-27T10:33:11+00:00",
      "roles":{
        "data":{
          "id":5,
          "name":"Reseller Staff"
        }
      }
    }
  }
}

PUT /members/{id}

Request Structure

  • first_name: string, required
  • last_name: string, required
  • email: string, required
  • telephone_number: string
  • mobile_number: string

Example Request

PUT /api/v1/members/3 HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b
Content-Type: application/json

{
    "first_name": "Example Staff",
    "last_name": "Member Two",
    "email": "staffmember2@example.com",
    "telephone_number": "8899777666"
}

Response Structure

  • success: bool
  • messages: string
  • data: object
    • data: object
      • id: int
      • first_name: string
      • last_name: string
      • email: string
      • telephone_number: string
      • mobile_number: string
      • is_active: bool
      • is_enabled: true
      • last_login: string ("2020-12-31 00:00:00")
      • created_at: string ("2020-12-31 00:00:00+00:00")

Example Response

{
  "success":true,
  "messages":"Member updated.",
  "data":{
    "data":{
      "id":3,
      "first_name":"Reseller Staff",
      "last_name":"Example Two",
      "email":"resellerstaff2@example.com",
      "telephone_number":"8899777666",
      "mobile_number":null,
      "is_active":false,
      "is_enabled":true,
      "last_login":null,
      "created_at":"2018-04-27T10:33:11+00:00"
    }
  }
}

DELETE /members/{id}

Example Request

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

Response Structure

  • success: bool
  • messages: string
  • data object

Example Response

{
  "success":true,
  "messages":"Member deleted.",
  "data":{
    "member_id":"3"
  }
}

PUT /members/{id}/password

Request Structure

  • new_password: string, required
  • new_password_again: string, required

Example Request

PUT /api/v1/members/1/password HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b
Content-Type: application/json

{
    "new_password": "newpassword123",
    "new_password_again": "newpassword123"
}

Response Structure

  • success: bool
  • messages: string
  • data: object
    • data: object
      • id: int
      • first_name: string
      • last_name: string
      • email: string
      • telephone_number: string
      • mobile_number: string
      • is_active: bool
      • is_enabled: true
      • last_login: string ("2020-12-31 00:00:00")
      • created_at: string ("2020-12-31 00:00:00+00:00")

Example Response

{
  "success":true,
  "messages":"Password updated.",
  "data":{
    "data":{
      "id":1,
      "first_name":"Reseller Admin",
      "last_name":"Example",
      "email":"reselleradmin@example.com",
      "telephone_number":null,
      "mobile_number":null,
      "is_active":true,
      "is_enabled":true,
      "last_login":"2018-04-25 14:57:11",
      "created_at":"2018-04-11T10:10:17+00:00"
    }
  }
}

PUT /members/{id}/role

Request Structure

  • role_id: int, required

Example Request

PUT /api/v1/members/2/role HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b
Content-Type: application/json

{
    "role_id": 4
}

Response Structure

  • success: bool
  • messages: string
  • data: object
    • data: object
      • id: int
      • first_name: string
      • last_name: string
      • email: string
      • telephone_number: string
      • mobile_number: string
      • is_active: bool
      • is_enabled: true
      • last_login: string ("2020-12-31 00:00:00")
      • created_at: string ("2020-12-31 00:00:00+00:00")
      • roles: object
        • data: object
          • id: int
          • name: string

Example Response

{
  "success":true,
  "messages":"Member role updated.",
  "data":{
    "data":{
      "id":3,
      "first_name":"Reseller Staff",
      "last_name":"Example",
      "email":"resellerstaff@example.com",
      "telephone_number":null,
      "mobile_number":null,
      "is_active":true,
      "is_enabled":true,
      "last_login":null,
      "created_at":"2018-04-11T10:10:17+00:00",
      "roles":{
        "data":{
          "id":4,
          "name":"Reseller Admin"
        }
      }
    }
  }
}

GET /roles/valid

Example Request

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

Response Structure

  • data: array[object]
    • id: int
    • name: string

Example Response

{
  "data":[
    {
      "id":4,
      "name":"Reseller Admin"
    },
    {
      "id":5,
      "name":"Reseller Staff"
    }
  ]
}

GET customers

Example Request

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

Response Structure

  • data: array[object]
    • id: int
    • type: string ("business""individual")
    • name: string
    • telephone_number: string
    • mobile_number: string
    • address: string
    • country: string
    • region: string
    • city: string
    • post_code: string
    • billing_address: string
    • billing_country: string
    • billing_region: string
    • billing_city: string
    • billing_post_code: string
    • billing_vat_number: string
    • billing_company_registration_number: string
    • created_at: string ("2020-01-01T00:00:00+00:00")
    • updated_at: string ("2020-01-01T00:00:00+00:00")
  • meta: object
    • first_url: string
    • last_url: string
    • next_url: string
    • previous_url: string
    • total: int
    • per_page: int
    • current_page: int
    • last_page: int
    • from: int
    • to: int

Example Response

{
  "data":[
    {
      "id":1,
      "name":"Example Customer",
      "type":"business",
      "telephone_number":"0123456789",
      "mobile_number":"0987654321",
      "address":"123 Example Address",
      "country":"US",
      "region":"Example Region",
      "city":"Example City",
      "post_code":"123 EXAMPLE",
      "billing_address":"",
      "billing_country":"",
      "billing_region":"",
      "billing_city":"",
      "billing_post_code":"",
      "billing_vat_number":"",
      "billing_company_registration_number":""
    }
  ],
  "meta":{
    "first_url":"https://tph.io/api/v1/customers",
    "last_url":"https://tph.io/api/v1/customers?page=1",
    "next_url":"https://tph.io/api/v1/customers?page=1",
    "previous_url":"https://tph.io/api/v1/customers?page=1",
    "total":1,
    "per_page":25,
    "current_page":1,
    "last_page":1,
    "from":1,
    "to":1
  }
}