Phason API (Version 1.0.3) API Reference

Welcome to the Phason API documentation. This API allows you to interact with Autoflex Connect devices, providing access to device data and control through RESTful endpoints.

Support Contact: support@phasoncontrols.com

Schemes: https

Base URL:

https://api.phasoncontrols.com/v1.0.3/


To access the Phason API Endpoints, use the following format:

https://api.phasoncontrols.com/v1.0.3/{api_endpoint_url_here}


Example Request:

To get a list of devices, send a GET request to:

https://api.phasoncontrols.com/v1.0.3/devices


Authentication

Authentication for the Phason API is performed using API keys. An API key is a unique identifier that grants access to the API.


Benefits of using API keys:

  • Security: API keys ensure that only authorized users with valid Phason Webservices accounts can access the API.
  • Control: API keys restrict access to devices registered under the same Phason user account, protecting your data from unauthorized access.
  • Integration: API keys provide a simple and straightforward method for authenticating API requests, making integration easier for developers.

Generating an API Key

To generate an API key for accessing Phason API, send a POST request to the Generate API Key endpoint. For more information, refer to the Generate API Key section.


Using an API Key

Include the API key in your REST API calls as an HTTP header parameter. Use the following format:


Phasonkey: Your API Key


Generate API Key

To create an API key, send a POST request to this endpoint. Ensure the key is kept secure by following these practices:

Securing an API Key

Keep API keys secure during storage and transmission to prevent unauthorized access:

  • Do not include API keys directly in your code. Use environment variables instead.
  • Delete unnecessary API keys and rotate them periodically to minimize risk.

POST /generate_key

This endpoint allows you to generate an API key for your Phason Webservices account. To authenticate, use Basic Authentication with your Phason Webservices account email and password. If you do not have an account, you can create one here.

Example Request:

api.phasoncontrols.com/v1.0.3/generate_key
Response Example (200 OK)
{
  "api_key": "555xx8a5ad2b00a6ca9874c66ac3xx5x",
  "message": "This key is only visible to you. Make sure to store it securely."
}
Username: (string)
in Basic Authentication

Enter Phason User Account Email.

Password: (string)
in Basic Authentication

Enter Phason User Account Password.

Successful operation.

400 Bad Request

Invalid User.

400 Bad Request

Invalid Password.

Device

GET /devices

Retrieves a current list of all Phason Connect devices linked to the Phason user account associated with the provided API key. This allows users to view all their devices through the API on their Webservices Account.


Example Request:

api.phasoncontrols.com/v1.0.3/devices
200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

Response Example (200 OK)
{
  "device_id": "5555",
  "device_name": "My AFX 2",
  "host_name": "AutoFlex-3AA2AA",
  "device_type": "AutoFlex Connect",
  "version": "3.08.01",
  "last_reported_on": "2024-07-23 05:55:55"
}

GET /time

Returns the current date and time along with the timezone of the specified device.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/8446/time
200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "datetime": "2024-09-19 09:18:12",
  "timezone": "America/Chicago"
}

Equipment Group

This endpoint provides detailed information on AutoFlex Equipment Groups, which are used to logically group similar types of equipment.

Group Type Description Unit
1 Temperature (includes Cooling and Heating Groups) °C
5 Static pressure Inches of water column (in WC)
9 Data only No valid readings
15 Windchill °C
16 Temperature Humidity Index THI
101 Ventilation Grid °C

GET /devices/{deviceId}/equipment_groups/history

Returns all latest equipment groups in one device.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9596/equipment_groups/history

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "group_id": "12402",
  "room_id": "1217",
  "group_type": "1",
  "group_type_description": "temperature",
  "group_name": "Group 1",
  "current_reading": "21.4",
  "alarm_code": "0",
  "alarm_time": "0",
  "target_value": "0",
  "target_lower_limit": "0",
  "target_upper_limit": "5",
  "reading_time": "2022-05-04 09:50:12"
}

GET /devices/{deviceId}/equipment_groups/history?start=yyyy-mm-dd&end=yyyy-mm-dd

Returns historical data for all equipment groups in one device between a start end and end date.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9596/equipment_groups/history?start=2024-07-20&end=2024-07-25
start: (yyyy-mm-dd)
in path

The start date for the device you want to get the settings for.

end: (yyyy-mm-dd)
in path

The end date for the device you want to get the settings for.

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "group_id": "12402",
  "room_id": "1217",
  "group_type": "1",
  "group_type_description": "temperature",
  "group_name": "Group 1",
  "current_reading": "21.4",
  "alarm_code": "0",
  "alarm_time": "0",
  "target_value": "0",
  "target_lower_limit": "0",
  "target_upper_limit": "5",
  "reading_time": "2022-05-04 09:50:12"
}

GET /devices/{deviceId}/equipment_groups/settings

Returns current equipment group settings including Master Setpoint, Room Settings Mode, Growth Curve Information (curve_id is 0 if not assigned) for a specific group.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9596/equipment_groups/settings?group_id=17347
group_id: integer
in path

The ID for the group you want to get the settings for.

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "message": "Success",
  "settings": [
    {
      "setting_num": 1,
      "settings_name": "Room settings mode 1",
      "master_setpoint": 23.4,
      "growth_curve_id": 3,
      "growth_curve_enabled": 1,
      "growth_curve_current_day": 14
    }
  ]
}

Output

This endpoint retrieves detailed information on AutoFlex Outputs, including their functions and supported modules. It provides data on various output types, such as cooling, heating, and misting, and their corresponding readings, helping users understand the output behavior and configuration of their devices.

Supported Modules: module_type: 2 (RM4-Relay output module), 3 (VDC4-Variable DC output module), 4 (VAC1-Variable AC output module) and 8 (RM2-Relay with current output module)

io_type Module Function
1 Cooling
2 Heating
3 Cooling duty cycle
4 Heating duty cycle
5 Timed events
6 Trigger relay
7 Follow variable
8 Follow relay
9 Heat mat 1k temperature probe
10 Heat mat 3k temperature probe
11 Heat mat 5k temperature probe
12 Misting and fogging
13 Follow lux sensor
14 Air curtain blower



Supported Modules: module_type: 5 (ACT1-Actuator output module), 12 (ACT1T-Time Feedback Actuator Module)

io_type Module Function
1 Potentiometer feedback
2 No feedback - time
5 Chaindisk
6 Timed feedback



Supported Modules: module_type: 9 (VCMDC1 - Variable chimney fan output module)

io_type Module Function
1 Feedback
2 No feedback


Output Types: The following table provides the meanings of the io_num values for various modules as returned by the Outputs API response. This helps in understanding the type of output and its corresponding reading.

module_type: 2 (RM4)

io_num Reading
All IO positions of module 0=Open
1=Closed



module_type: 3 (VDC4)

io_num Reading
All IO positions of module 0-100%



module_type: 4 (VAC1)

io_num Reading
1 0-100%
2 °C - If output type 9-11
3 Amps



module_type: 5 (ACT1) and 12 (ACT1T)

io_num Output type Reading
1 1,6 0-100%
1 2,5 0=Idle
1=Opening
2=Closing



module_type: 8 (RM2)

io_num Reading
1,2 0=open
1=closed
3,4 Amperage

GET /devices/{deviceId}/outputs/history?start=yyyy-mm-dd&end=yyyy-mm-dd

Returns the entire output history on all modules for one device within the specified start date and end date.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9596/outputs/history?start=2024-07-20&end=2024-07-25
deviceId: integer
in path

The ID of the device the outputs are in.

start: string
in query

Start date-time of the input history.

end: string
in query

End date-time of the input history.

200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

400 Bad Request

End date should be greater than start date.

Response Example (200 OK)
{
  "device_id": "9596",
  "module_num": "2",
  "io_num": "1",
  "group_id": "17042",
  "name": "Module 2 Output 1",
  "module_type": "2",
  "io_type": "1",
  "current_reading": "20.1",
  "alarm_code": "1",
  "alarm_time": "2024-07-23 17:58:47",
  "version_number": "1.02",
  "reading_time": "2024-07-23 17:58:47",
  "values": [
    {
      "reading": "23",
      "time": "2024-07-23 12:26:31"
    }
  ]
}

GET /devices/{deviceId}/outputs/settings?module_num={position_number}&io_num={position_number}

Returns current output settings for specified output of the module - based off on the module position number and the output position on that module.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9596/outputs/settings?module_num=1&io_num=1
deviceId: integer
in path

The ID of the device the outputs are in.

module_num: integer
in query

The module number of the output you want to retrieve.

io_num: integer
in query

The io number of the output you want to retrieve.

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

400 Bad Request
Possible Reason: Wrong Parameter

This module type is not supported.

Response Example (200 OK)
{
  "message": "Success",
  "fixed stage settings": [
    {
      "setpoint": "23"
    }
  ],
  "variable output settings": [
    {
      "setpoint": "21",
      "idle_setpoint": "23",
      "idle_speed": "50",
      "differential_setpoint": "26"
    }
  ],
  "Inlet no feedback settings": [
    {
      "setpoint": "20",
      "idle_band": "3",
      "open_runtime": "180",
      "open_idle_time": "240",
      "close_runtime": "120",
      "close_idle_time": "300"
    }
  ],
  "Inlet With Feedback Settings": [
    {
      "minimum": {
        "setpoint": "20",
        "position": "5"
      },
      "stage1": {
        "setpoint": "20",
        "position": "10",
        "differential_setpoint": "21"
      },
      "stage2": {
        "setpoint": "22",
        "position": "20",
        "differential_setpoint": "23"
      },
      "stage3": {
        "setpoint": "23",
        "position": "30",
        "differential_setpoint": "24"
      },
      "stage4": {
        "setpoint": "24",
        "position": "40",
        "differential_setpoint": "25"
      },
      "stage5": {
        "setpoint": "25",
        "position": "50",
        "differential_setpoint": "26"
      }
    }
  ],
  "Misting Order output settings": [
    {
      "misting_function": "1",
      "misting_order": "3"
    }
  ],
  "Timed Event/Follow Lux output settings": [
    {
      "schedule_id": "8",
      "schedule_current_day": "3" 
    }
  ]
}

Input

This endpoint retrieves information on AutoFlex Input Sensors. These sensors can be added to equipment groups to provide detailed data on various environmental parameters such as temperature, humidity, CO2 levels, and more.

io_type Unit
temperature °C
humidity %
co2 PPM
static_pressure wc
nh3 PPM
wind_speed km/h
wind_direction azimuth degrees
digital_input boolean(on/off)
rain_sensor boolean(rain/no rain)
pulse_counter pulse/min
light lux
barometric_pressure hPa

GET /devices/{deviceId}/inputs

Returns current and historical data for all input sensor data of a device, including the module position of each sensor and their readings within the specified date range. Make sure to have a higher end date than the start date.


Example Request:

​api.phasoncontrols.com/v1.0.3/devices/9710/inputs?start=2025-01-18 00:00:00&end=2025-01-19 00:00:00
deviceId: integer
in path

The ID of the device the inputs are in.

start: string
in query

Start date-time of the input history.

end: string
in query

End date-time of the input history.

200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "name": "Temp input",
  "io_num": "1",
  "module_number": "3",
  "io_type": "temperature",
  "values": [
    {
      "reading": "23",
      "time": "2019-11-25 20:20:00"
    }
  ]
}

Growth Curves

This endpoint provides detailed information on Growth Curves. Each Growth Curve consists of seven steps, with each step having a specific start day and setpoint. The Autoflex system automatically calculates the setpoints for the days between these steps and adjusts them daily at midnight, ensuring smooth transitions and optimal growth conditions.


Note: Available from Autoflex 2 Version 3.08.06

GET devices/{deviceId}/growth_curves

Retrieves all Growth Curves currently configured on a device, including those assigned to equipment groups and those unassigned.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9710/growth_curves
deviceId: integer
in path

The ID of the device.

200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "message": "API request successful.",
  "settings": [
    {
      "growth_curve_id": 23,
      "restart_day": 5,
      "curve_name": "Temperature_curve",
      "zone_type": 1
    },
    {
      "growth_curve_id": 24,
      "restart_day": 11,
      "curve_name": "StaticPress_curve",
      "zone_type": 5
    },
    {
      "growth_curve_id": 25,
      "restart_day": 9,
      "curve_name": "WindChill_curve",
      "zone_type": 15
    }
  ]
}

GET devices/{deviceId}/growth_curves/settings?growth_curve_id={growthCurveId}

Fetches detailed information of a specific Growth Curve set on a device, including all 7 steps with their respective days and values.


Example Request:

api.phasoncontrols.com/v1.0.3/devices/9710/growth_curves/settings?growth_curve_id=1
deviceId: integer
in path

The ID of the device.

growth_curve_id: integer
in query

Growth Curve ID for individual curve.

200 OK

Successful operation.

400 Bad Request
Possible Reason: Invalid Key Entered

API Key Authentication Failed.

400 Bad Request
Possible Reason: Wrong Device ID

Phason User Account does not exists on this device.

Response Example (200 OK)
{
  "message": "API request successful.",
  "growth_curve_id": "5",
  "settings": [
    {
      "day_num": 1,
      "curve_value": "80"
    },
    {
      "day_num": 2,
      "curve_value": "85"
    },
    {
      "day_num": 3,
      "curve_value": "90"
    },
    {
      "day_num": 4,
      "curve_value": "95"
    },
    {
      "day_num": 5,
      "curve_value": "100"
    },
    {
      "day_num": 6,
      "curve_value": "105"
    },
    {
      "day_num": 7,
      "curve_value": "110"
    }   
  ]
}

Schema Definitions

API Key: object

api_key: string
message: string
Response Example (200 OK)
{
"api_key": "555xx8a5ad2b00a6ca9874c66ac3xx5x",
"message": "This key is only visible to you. Make sure to store it securely."
}

Device: object

device_id: integer
device_name: string
host_name: string
device_type: string
version: string
last_reported_on: timestamp
Response Example (200 OK)
{
  "device_id": "5555",
  "device_name": "My AFX 2",
  "host_name": "AutoFlex-3AA2AA",
  "device_type": "AutoFlex Connect",
  "version": "3.08.01",
  "last_reported_on": "2024-07-23 05:55:55"
}

Equipment Group: object

group_id: integer
room_id: integer
group_type: integer
group_type_description: string
group_name: string
current_reading: double
alarm_code: integer
alarm_time: integer
target_value: integer
target_lower_limit: object
target_upper_limit: double
reading_time: string
Response Example (200 OK)
{
  "group_id": "12402",
  "room_id": "1217",
  "group_type": "1",
  "group_type_description": "temperature",
  "group_name": "Group 1",
  "current_reading": "21.4",
  "alarm_code": "0",
  "alarm_time": "0",
  "target_value": "0",
  "target_lower_limit": "0",
  "target_upper_limit": "5",
  "reading_time": "2022-05-04 09:50:12"
}

Equipment Group Settings: object

message: string
settings: object[]
object
setting_num: number
settings_name: number
master_setpoint: number
growth_curve_id: number
growth_curve_enabled: number
growth_curve_current_day: number
Response Example (200 OK)
{
  "message": "Success",
  "settings": [
    {
      "setting_num": 1,
      "settings_name": "Room settings mode 1",
      "master_setpoint": 23.4,
      "growth_curve_id": 3,
      "growth_curve_enabled": 1,
      "growth_curve_current_day": 14
    }
  ]
}

Output: object

device_id: integer
module_num: integer
io_num: integer
group_id: integer
name: string
module_type: integer
io_type: integer
current_reading: double
alarm_code: integer
alarm_time: timestamp
version_number: string
reading_time: timestamp
values: object[]
object
reading: number
time: string
Response Example (200 OK)
{
  "device_id": "645",
  "module_num": "2",
  "io_num": "1",
  "group_id": "17042",
  "name": "Module 2 Output 1",
  "module_type": "2",
  "io_type": "1",
  "current_reading": "20.1",
  "alarm_code": "1",
  "alarm_time": "2022-02-22 22:22:22",
  "version_number": "1.02",
  "reading_time": "2022-02-22 22:22:22",
  "values": [
    {
      "reading": "23",
      "time": "2019-11-25 20:20:00"
    }
  ]
}

Output Settings: object

message: string
fixed stage settings: object[]
object
setpoint: number
variable output settings: object[]
object
setpoint: number
idle_setpoint: number
idle_speed: number
differential_setpoint: number
Inlet no feedback settings: object[]
object
setpoint: number
idle_band: number
open_runtime: number
open_idle_time: number
close_runtime: number
close_idle_time: number
Inlet With Feedback Settings: object[]
object
minimum: object
setpoint: number
position: number
stage1: object
setpoint: number
position: number
differential_setpoint: number
stage2: object
setpoint: number
position: number
differential_setpoint: number
stage3: object
setpoint: number
position: number
differential_setpoint: number
stage4: object
setpoint: number
position: number
differential_setpoint: number
stage5: object
setpoint: number
position: number
differential_setpoint: number
Misting Order output settings: object[]
object
misting_function: number
misting_order: number
Response Example (200 OK)
{
  "message": "Success",
  "fixed stage settings": [
    {
      "setpoint": "23"
    }
  ],
  "variable output settings": [
    {
      "setpoint": "21",
      "idle_setpoint": "23",
      "idle_speed": "50",
      "differential_setpoint": "26"
    }
  ],
  "Inlet no feedback settings": [
    {
      "setpoint": "20",
      "idle_band": "3",
      "open_runtime": "180",
      "open_idle_time": "240",
      "close_runtime": "120",
      "close_idle_time": "300"
    }
  ],
  "Inlet With Feedback Settings": [
    {
      "minimum": {
        "setpoint": "20",
        "position": "5"
      },
      "stage1": {
        "setpoint": "20",
        "position": "10",
        "differential_setpoint": "21"
      },
      "stage2": {
        "setpoint": "22",
        "position": "20",
        "differential_setpoint": "23"
      },
      "stage3": {
        "setpoint": "23",
        "position": "30",
        "differential_setpoint": "24"
      },
      "stage4": {
        "setpoint": "24",
        "position": "40",
        "differential_setpoint": "25"
      },
      "stage5": {
        "setpoint": "25",
        "position": "50",
        "differential_setpoint": "26"
      }
    }
  ],
  "Misting Order output settings": [
    {
      "misting_function": "1",
      "misting_order": "3"
    }
  ]
}

Input: object

name: string
io_num: integer (int64)
module_number: integer (int64)
io_type: string
values: object[]
object
reading: number
time: string
Response Example (200 OK)
{
  "name": "Temp input",
  "io_num": "1",
  "module_number": "3",
  "io_type": "temperature",
  "values": [
    {
      "reading": "23",
      "time": "2019-11-25 20:20:00"
    }
  ]
}

All Growth Curves: object

settings: object[]
object
growth_curve_id: number
restart_day: number
curve_name: string
zone_type: number
Response Example (200 OK)
{
  "message": "API request successful.",
  "settings": [
    {
        "growth_curve_id": 23,
        "restart_day": 5,
        "curve_name": "Temperature_curve",
        "zone_type": 1
    },
    {
        "growth_curve_id": 24,
        "restart_day": 11,
        "curve_name": "StaticPress_curve",
        "zone_type": 5
    },
    {
        "growth_curve_id": 25,
        "restart_day": 9,
        "curve_name": "WindChill_curve",
        "zone_type": 15
    }
  ]
}

Specific Growth Curve: object

growth_curve_id: number
settings: object[]
object
day_num: number
curve_value: number
Response Example (200 OK)
{
  "message": "API request successful.",
  "growth_curve_id": "5",
  "settings": [
    {
        "day_num": 1,
        "curve_value": "80"
    },
    {
        "day_num": 2,
        "curve_value": "85"
    },
    {
        "day_num": 3,
        "curve_value": "90"
    },
    {
        "day_num": 4,
        "curve_value": "95"
    },
    {
        "day_num": 5,
        "curve_value": "100"
    },
    {
        "day_num": 6,
        "curve_value": "105"
    },
    {
        "day_num": 7,
        "curve_value": "110"
    } 
  ]
}