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

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
  }
}

POST customers

Request Structure

  • type: string ("business""individual")
  • name: string (Only applies to "business" type)
  • first_name: string, required
  • last_name: string, required
  • email: string, required
  • password: string, required
  • password_again: string, required
  • address: string, required
  • city: string, required
  • region: string, required
  • post_code: string, required
  • country: string, required
  • mobile_number: string
  • telephone_number: string

Example Request

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

{
    "type": "business",
    "name": "New Customer",
    "first_name": "Customer",
    "last_name": "User",
    "email": "customeruser@example.com",
    "password": "validpass123",
    "password_again": "validpass123",
    "address": "123 Example Address",
    "city": "Example City",
    "region": "Example Region",
    "post_code": "123 EXAMPLE",
    "country": "US"
}

Response Structure

  • success: bool
  • messages: string (optional)
  • data: object
    • customer_id: int

Example Response

{
  "success":true,
  "messages":"Business customer created",
  "data":{
    "customer_id":2
  }
}

GET customers/{id}

Example Request

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

Response Structure

  • data: object
    • id: int
    • 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")

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":"",
    "created_at":"2020-12-31T00:00:00+00:00",
    "updated_at":"2020-12-31T00:00:00+00:00"
  }
}

PUT customers/{id}/update_business

Request Structure
  • name: string, required
  • address: string, required
  • city: string, required
  • region: string, required
  • post_code: string, required
  • country: string, required
  • mobile_number: string
  • telephone_number: string
  • billing_address: string
  • billing_city: string
  • billing_region: string
  • billing_post_code: string
  • billing_company_registration_number: string
  • billing_vat_number: string
Example Request
PUT /api/v1/customers/1/update_business HTTP/1.1
Host: tph.io
X-Token: c9c0a840-b5f1-4e0e-84da-e8a4eedfc63b
Content-Type: application/json

{
    "name": "Example Customer",
    "address": "123 Example Address",
    "city": "Example City",
    "region": "Example Region",
    "post_code": "123 EXAMPLE",
    "country": "US",
    "mobile_number": "001122334455"
}
Response Structure
  • data: object
    • id: int
    • 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-12-31T00:00:00+00:00")
    • updated_at: string ("2020-12-31T00:00:00+00:00")
Example Response
{
  "data":{
    "id":1,
    "name":"Example Customer",
    "type":"business",
    "telephone_number":null,
    "mobile_number":"001122334455",
    "address":"123 Example Address",
    "country":"US",
    "region":"Example Region",
    "city":"Example City",
    "post_code":"123 EXAMPLE",
    "billing_address":null,
    "billing_country":null,
    "billing_region":null,
    "billing_city":null,
    "billing_post_code":null,
    "billing_vat_number":null,
    "billing_company_registration_number":null,
    "created_at":"2020-01-01T00:00:00+00:00",
    "updated_at":"2020-01-01T00:00:00+00:00"
  }
}

PUT customers/{id}/update_individual

Request Structure

  • first_name: string, required
  • last_name: string, required
  • address: string, required
  • city: string, required
  • region: string, required
  • post_code: string, required
  • country: string, required
  • mobile_number: string
  • telephone_number: string
  • billing_address: string
  • billing_city: string
  • billing_region: string
  • billing_post_code: string
  • billing_company_registration_number: string
  • billing_vat_number: string

Example Request

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

{
    "first_name": "Individual",
    "last_name": "User",
    "address": "321 Example Address",
    "city": "Example City",
    "region": "Example Region",
    "post_code": "321 EXAMPLE",
    "country": "US"
}

Response Structure

  • data: object
    • id: int
    • 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-12-31T00:00:00+00:00")
    • updated_at: string ("2020-12-31T00:00:00+00:00")

Example Response

{
  "data":{
    "id":3,
    "name":"Individual User",
    "type":"individual",
    "telephone_number":null,
    "mobile_number":null,
    "address":"321 Example Address",
    "country":"US",
    "region":"Example Region",
    "city":"Example City",
    "post_code":"321 EXAMPLE",
    "billing_address":null,
    "billing_country":"",
    "billing_region":null,
    "billing_city":null,
    "billing_post_code":null,
    "billing_vat_number":null,
    "billing_company_registration_number":null,
    "created_at":"2020-01-01T00:00:00+00:00",
    "updated_at":"2020-01-01T00:00:00+00:00"
  }
}

POST /customers/{id}/app/activate

Request Structure

  • app: int, required

Example Request

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

{
    "app": 1
}

Response Structure

  • success: bool
  • messages: string

Example Response

{
  "success":true,
  "messages":"App successfully activated."
}

POST /customers/{id}/app/deactivate

Request Structure

  • app: int, required

Example Request

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

{
    "app": 1
}

Response Structure

  • success: bool
  • messages: string

Example Response

{
  "success":true,
  "messages":"App successfully deactivated."
}

GET /accounts

Example Request

GET /api/v1/accounts 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
    • suspended: bool
    • archived: bool
    • 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":2,
      "first_name":"Example",
      "last_name":"User",
      "suspended":false,
      "archived":false,
      "created_at":"2018-04-27T15:10:27+00:00",
      "updated_at":"2018-04-27T15:10:27+00:00"
    }
  ],
  "meta":{
    "first_url":"https://tph.io/api/v1/accounts",
    "last_url":"https://tph.io/api/v1/accounts?page=1",
    "next_url":"https://tph.io/api/v1/accounts?page=1",
    "previous_url":"https://tph.io/api/v1/accounts?page=1",
    "total":1,
    "per_page":25,
    "current_page":1,
    "last_page":1,
    "from":1,
    "to":1
  }
}

GET p8auth/subscribers

Example Request

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

Response Structure

  • data: array[object]
    • id: int
    • reseller: string
    • company: string
    • username: string
    • product: string
    • network: string
    • ip_address: string
    • provider: string
    • sim_number: string
    • is_capped: bool
    • is_suspended: bool
    • has_schedule: bool
    • status: string
    • has_quota: bool
    • quota_is_capped: bool
    • created_at: string ("2020-01-01T00:00:00+00:00")
    • updated_at: string ("2020-01-01T00:00:00+00:00")
    • labels: array[object]
      • data: array[object]
        • id: int
        • name: string
        • type_id: int
  • 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": 3,
      "reseller": "Example Reseller",
      "company": "Example Customer",
      "username": "1212121212",
      "product": "Example APN Product",
      "network": "Network 1",
      "ip_address": "192.168.0.2",
      "provider": "Provider 1",
      "sim_number": "0123456789",
      "is_capped": false,
      "is_suspended": false,
      "has_schedule": false,
      "status": "Enabled",
      "has_quota": false,
      "quota_is_capped": false,
      "created_at": "2018-04-24T16:13:35+00:00",
      "updated_at": "2018-04-25T10:35:24+00:00",
      "labels": {
        "data": [
          {
            "id": 1,
            "name": "Label 1",
            "type_id": 1
          }
        ]
      }
    },
  ]
  "meta": {
    "first_url": "https://tph.io/api/v1/p8auth/subscribers",
    "last_url": "https://tph.io/api/v1/p8auth/subscribers?page=1",
    "next_url": "https://tph.io/api/v1/p8auth/subscribers?page=1",
    "previous_url": "https://tph.io/api/v1/p8auth/subscribers?page=1",
    "total": 1,
    "per_page": 50,
    "current_page": 1,
    "last_page": 1,
    "from": 1,
    "to": 1
  }
}