This method returns a list of contractors listed for your organization.


Parameters

Your request data may contain the following parameters. GET or POST the object (as JSON) to https://api.kpaehs.com/v1/contractors.list.

Parameter TypeScript Example Required Description
token string "YOUR_TOKEN" Required Your API Token
pretty boolean true Optional true means the response json will include white space for readability. Default is false.
limit number 100 Optional The maximum number of contractors to return. Max 1000. Defaults to 100. Use page to fetch additional responses.
page number 1 Optional The page of contractors to return. Defaults to 1. The contractor field paging.last_page tells you what the last valid page number is.
status string "new" Optional Filters by the contractors Approval Status. Must be one of the following: 'new' | 'pending' | 'approved' | 'denied'

Example Request


Example Response

{
  "ok": true,
  "contractors": [
    {
      "id": "CF36F6E5-0A39-4BFC-9A0E-174A341B7E21",
      "name": "KPA Auto",
      "address": "123 Main St",
      "city": "Denver",
      "state": "CO",
      "zip": "55555",
      "approval_status": "New",
      "contractor_compliance_score": 0,
      "employee_compliance_score": 0,
      "tags": "East Building, Denver",
      "auto_approve": true
    },
    {
      "id": "D2C98A1B-20A1-4CC2-96DE-CEFA2946BBFF",
      "name": "ABC Industries",
      "address": "555 North Ave",
      "city": "Denver",
      "state": "CO",
      "zip": "55555",
      "approval_status": "Denied",
      "contractor_compliance_score": 0,
      "employee_compliance_score": 0,
      "tags": "Denver,Concrete",
      "auto_approve": true
    },
    {
      "id": "9F96F063-42F4-4D9B-9DC2-5EDBFC43382B",
      "name": "ACME Construction",
      "address": "721 Falcon Rd",
      "city": "Mesa",
      "state": "AZ",
      "zip": "88888",
      "approval_status": "Pending",
      "contractor_compliance_score": 0,
      "employee_compliance_score": 0,
      "tags": "Mesa",
      "auto_approve": true
    }
  ]
}

Errors

If an error occurs, the response JSON will have ok set to false:

{
  "ok": false,
  "error": "token_invalid",
  "description": "The token `YOUR_TOKEN` was not found."
}

The error field will contain one of the following error identifiers and there may also be a description field with a more detailed explanation:

Identifier Description
api_method_not_found The requested url did not match any KPA Flex API method.
request_method_invalid The requested method was not GET or POST.
request_data_invalid The request did not include a valid JSON request object.
rate_limit_exceeded This token is exceeding its request limit.
token_missing The request did not include a token.
token_invalid The request token was invalid.
token_inactive The request token was has been deactivated.
token_permission The request token does not have write permission.
account_inactive The request token was for an account that is not active.
parameter_unexpected The request data included a parameter that is not supported.
parameter_missing The request data failed to include a parameter which was required.
parameter_invalid The request data included a parameter which had a value that is not allowed.
server_error The server encountered an internal error.
content_not_found The requested content was not found.