API

Single Dimensional Data

BambooHR system is infinitely customizable. Any number of custom tables and custom fields can be added to an account. This creates some interesting challenges when exposing this data in an API. Rather than use a fixed object model for the BambooHR API, we allow each method call to specify which subset of fields are to be referenced.

In the first version of the API, fields will only be referenced by field name. Available field names are documented below. In a future version, we will open up access to the underlying field id values which will enable access to custom fields.


List of field names

To view more details about the types for the below fields, click here.

API field name Type Description
address1 text The employee's first address line
address2 text The employee's second address line
age integer The employee's age. Not editable. To change update dateOfBirth, instead.
bestEmail email The employee's work email if set, otherwise their home email
birthday text The employee's month and day of birth. Not editable. To change update dateOfBirth, instead.
city text The employee's city
country country The employee's country
dateOfBirth date The date the employee was born
department list The employee's CURRENT department.
division list The employee's CURRENT division
eeo list The employee's EEO job category. These are defined by the U.S. Equal Employment Opportunity Commission
employeeNumber text Employee number (assigned by your company)
employmentStatus status DEPRECATED. Please use "status" instead. The employee's employee status (Active,Inactive)
employmentHistoryStatus list The employee's CURRENT employment status. Options are customized by account.
ethnicity list The employee's ethnicity
exempt list The FLSA employee exemption code (Exempt or Non-exempt)
firstName text The employee's first name
flsaCode list The employee's FLSA code. Ie: "Exempt", "Non-excempt"
fullName1 text Employee's first and last name. Example: John Doe. Ready only.
fullName2 text Employee's last and first name. Example: Doe, John. Read only.
fullName3 text Employee's full name with nickname. Example: Doe, John Quentin (JDog). Read only.
fullName4 text employee's full name without nickname. Last name first. Example: Doe, John Quentin. Read only
fullName5 text employee's full name without nickname. First name first. Example: John Quentin Doe. Read only
displayName text employee's name displayed in a format configured by the user. Read only
gender gender The employee's gender. Legal values are "Male", "Female"
hireDate date The date the employee was hired
homeEmail email The employee's home email address
homePhone phone The employee's home phone number
id integer Employee id (automatically assigned by BambooHR). Not editable.
jobTitle list The CURRENT value of the employee's job title, updating this field will create a new row in position history
lastChanged timestamp The date and time that the employee record was last changed
lastName text The employee's last name
location list The employee's CURRENT location
maritalStatus list The employee's marital status ("Single" or "Married")
middleName text The employee's middle name
mobilePhone phone The employee's mobile phone number
nickname text The employee's nickname
payChangeReason list The reason for the employee's last pay rate change.
payGroup list The custom pay group that the employee belongs to.
payGroupId integer The id value corresponding to the pay group that an employee belongs to
payRate currency The employee's CURRENT pay rate. ie: $8.25
payRateEffectiveDate date The date most recent change was made.
payType pay_type The employee's CURRENT pay type. ie: "hourly","salary","commission","exception hourly","monthly","piece rate","contract","daily"
ssn ssn The employee's social security number
sin sin The employee's Canadian Social Insurance Number
state state The employee's state/province
stateCode text The 2 character abbreviation for the employee's state (US only). Not editable.
status status "status" indicates whether you are using BambooHR to track data about this employee. Valid values are "Active", "Inactive".
supervisor employee The emloyee’s CURRENT supervisor. Not editable.
supervisorId integer The 'employeeNumber' of the employee's CURRENT supervisor. Not editable.
supervisorEId integer The 'id' of the employee's CURRENT supervisor. Not editable.
terminationDate date The date the employee was terminated
workEmail email The employee's work email address
workPhone phone The employee's work phone number, without extension
workPhonePlusExtension text The employee's work phone and extension. Not editable.
workPhoneExtension text The employees work phone extension (if any)
zipcode text The employee's zipcode
photoUploaded bool The employee has uploaded a photo
In addition, custom fields are now accessible by an alias. In general, an alias for a custom field will be "customFieldName" if the custom field's name is "Field Name". In the case of duplicate field names, a numeric suffix will be appended: "customFieldName", "customFieldName1", etc. These aliases are stable, and can be discovered through the metadata fields api.

Add an employee

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/employees/
Minimum required fields: firstName, lastName
Success response:
  • 201. Additionally, an HTTP Location: header that points to the new API URL for the new employee will be returned.
Failure responses:
  • 400 if the posted XML is invalid or the firstName/lastName fields are not provided.
Sample request:
<!-- Sample request that creates a new employee and sets their first and last names. -->
<employee>	
	<field id="firstName">John</field>	
	<field id="lastName">Doe</field>
</employee>

Get an employee

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/employees/{number}?fields={fieldList}
Parameters
  • The {fieldList} is a comma separated list of values taken from the official list of field names.
  • {number} is an employee id. The special employee id of zero (0) means to use the employee id associated with the API key (if any).
Response format The response for this resource is available in XML or JSON format. XML is the default. To request JSON data, set the HTTP header "Accept" to "application/json".
Compatability note For backwards compatability reasons the state field has an inconsistent behavior for just this API call. It will not return the full name of a state. Rather, it returns the two character US state abbreviation. For international addresses, the state will either be the plain text name if the user hand entered it, or the 2-3 character state/province abbreviation if they selected it from a drop down.
Success response:
  • 200. The response content will be an XML document with the requested information. Any fields that the API user does not have permission to see will be empty in the response.
Failure responses:
  • 403 if the API user does not have permission to see the requested employee
  • 404 if the employee does not exist
Sample URL: https://api.bamboohr.com/api/gateway.php/testcorp/v1/employees/123?fields=firstName,lastName
Sample response:
<employee id="123">
	<field id="firstName">John</field>
	<field id="lastName">Doe</field>
</employee>

Update an employee

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/employees/{number}
Success response:
  • 200. A successful response is possible even if one or more updates were dis-allowed because of permissions. As long as a single field is updated a 200 response will be returned.
Failure responses:
  • 400 if the provided XML is bad
  • 403 if the user doesn't have perms to see the employee
  • 403 if the user doesn't have perms to update ANY of the requested fields
  • 404 if the employee to be updated doesn't exist
Sample request:
<employee>
	<field id="firstName">John</field>
	<field id="lastName">Doe</field>
</employee>

Get a directory of employees

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/employees/directory
Response format The response for this resource is available in XML or JSON format. XML is the default. To request JSON data, set the HTTP header "Accept" to "application/json".
Success response:
  • 200. The response content will be an XML document with the directory information. Only configured fields will be included in the directory. This directory bypasses normal permissions, and shows information for all employees in the company.
Failure responses:
  • 403 if the directory has not been shared company-wide
Sample URL: https://api.bamboohr.com/testcorp/v1/employees/directory
Sample response:
<directory>
	<fieldset>
		<field id="displayName">Display name</field>
		<field id="firstName">First name</field>
		<field id="lastName">Last name</field>
		<field id="jobTitle">Job title</field>
		<field id="workPhone">Work Phone</field>
		<field id="workPhoneExtension">Work Extension</field>
	</fieldset>
	<employees>
		<employee id="123">
			<field id="displayName">John Doe</field>
			<field id="firstName">John</field>
			<field id="lastName">Doe</field>
			<field id="jobTitle">Customer Service Representative</field>
			<field id="workPhone">555-555-5555</field>
			<field id="workPhoneExtension"/>
		</employee>
	</employees>
</directory>

Request a company report

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/reports/{number}?format={format}&fd={yes|no}
Parameters
  • format - the output format for the report. Supported formats: csv, pdf, xls, xml, json
  • fd (optional) - yes=apply standard duplicate field filtering, no=return the raw results with no duplicate filtering. Default value is "yes".
Description: Use this resource to request one of your pre-existing company reports from the reporting section. You can get the report number by hovering over the report name on the reports page and grabbing the id. At present, only reports from the Company Reports section are supported. In the future we may implement reports from the Report Library section if there is enough demand for it. The report numbers used in this request are different in each company.
Success response:
  • 200 The report will be generated in the requested format. The HTTP Content-type header will be set with the mime type for the response.
Failure response:
  • 404 if you request a non-existant report number
Sample response:
<report>
	<title>This is my report</title>
	<!-- The "fields" section provides some metadata about the result set -->
	<fields>
		<field id="firstName" type="text" />
		<field id="lastName" type="text" />
	</fields>
	<data>
		<row>
			<!-- See the "fields" section above to determine field order -->
			<field>Jane</field>
			<field>Doe</field>
		</row>
		<row>
			<field>John</field>
			<field>Doe</field>
		</row>
	</data>
</report>

Request a custom report

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/reports/custom?format={format}
Supported formats: csv,pdf,xls,xml
Description: Use this resource to request BambooHR generate a report. You must specify a type of either "pdf","xls", "csv", or "xml" You must specify a list of fields to show on the report. The list of fields is available here.
Last changed filter

You may specify a filter section with a <lastChanged> tag (see below). If you add a filter then you must provide a date in ISO 8601 format and the report will only include those employees whose records have changed since that time.

Note: prior to June 2011, last change information was not tracked. Employees who have not changed since that time will always be returned in this API, unless you specify that the filter not include null changed dates. To hide null change dates set includeNull="no", as demonstrated in the example below.

Success response:
  • 200 The report will be generated in the requested format. The HTTP Content-type header will be set with the mime type for the response.
Sample request:
<report output="pdf">
	<title>This is my report</title>
	<!-- The filters section is optional -->	
	<filters>
		<lastChanged includeNull="no">2012-10-17T16:00:00Z</lastChanged>
	</filters>
	<!-- End optional section -->
	<fields>
		<field id="firstName" />
		<field id="lastName" />
	</fields>	
</report>
Sample response (for XML output):
<report>
	<title>This is my report</title>
	<!-- The "fields" section provides some metadata about the result set -->
	<fields>
		<field id="firstName" type="text" />
		<field id="lastName" type="text" />
	</fields>
	<data>
		<row>
			<!-- See the "fields" section above to determine field order -->
			<field>Jane</field>
			<field>Doe</field>
		</row>
		<row>
			<field>John</field>
			<field>Doe</field>
		</row>
	</data>
</report>

List employee files and categories

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/employees/{number}/files/view/
Success response:
  • 200 The response content will be an XML document with the requested information. The files will be contained within their category's xml wrapper.
Failure response:
  • 404 if no files are found for this employee.
  • 403 if the API user does not have permission to see the requested employee or the employee's files
Sample response:
<employee id="123">
	<category id="1">
		<name>New Hire Docs</name>
		<file id="1234">
			<name>Employee handbook</name>
			<originalFileName>employee_handbook.doc</originalFileName>
			<size>23552</size>
			<dateCreated>2011-06-28 16:50:52</dateCreated>
			<createdBy>John Doe</createdBy>
			<shareWithEmployee>yes</shareWithEmployee>
		</file>
	</category>
	<category id="112">
		<name>Training Docs</name>
	</category>
</employee>

Add an employee file category

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/employees/files/categories/
Success response:
  • 201 The category was created.
Failure response:
  • 403 if the API user does not have permission to create employee categories
  • 400 if the posted XML is invalid or there was no category name given
  • 500 there was an unknown server error.
Sample request:
<employee>
	<category>A new category</category>
</employee>

Update an employee file

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/employees/{number}/files/{fileId}/
File attributes that can be updated:
  • name: rename the file
  • categoryId: move the file to a different category
  • shareWithEmployee: update whether this file is shared or not
Success response:
  • 200 if the file was updated.
Failure response:
  • 403 if the API user does not have permission to see the requested employee or the employee's files
  • 400 if the posted XML is invalid
  • 404 if the employee file or category was not found
Sample request:
<file>
	<name>This is a new name for the file</name>
	<categoryId>4</categoryId>
	<shareWithEmployee>no</shareWithEmployee>
</file>

Download an employee file

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/employees/{number}/files/{fileId}/
Success response:
  • 200 if the file was successfully retrieved. Additionally, HTTP headers are sent that provide the Content-Type, Content-Length, and Content-Disposition for the file. The file contents will be contained in the response contents.
Failure response:
  • 403 if the API user does not have permission to see the requested employee or the employee's files
  • 404 if the employee file was not found

Upload an employee file

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/employees/{number}/files/
Submission fields
  • category - the category id to place the new file in.
  • fileName - the file name to associate with the file.
  • share - whether to make the file available to the employee (options are "yes" and "no")
  • file - the file to upload. Note that the field must be named "file".
Success response:
  • 201 if the file was successfully uploaded.
Failure response:
  • 403 if the API user does not have permission to see the requested employee or the employee's files
  • 404 if the category ID was not found
  • 413 if the file size exceeds 20 MB or the storage limit for the company
Special notes

The file upload methods accept multi-part forms. To build a multi-part form concatenate the individual sections together separated by a boundary. Then take the length of the resulting body and use that as the Content-Length for the submission. (See here, here, and here.)

Sample request (with http headers shown)
POST /api/gateway.php/sample/v1/employees/1/files/ HTTP/1.0
Host: api.bamboohr.com
Content-Type: multipart/form-data; boundary=----BambooHR-MultiPart-Mime-Boundary----
Content-Length: 520

------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="category"

112
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="fileName"

readme.txt
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="share"

yes
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="file"; filename="readme.txt"
Content-Type: text/plain

This is a sample text file.

------BambooHR-MultiPart-Mime-Boundary------
							

List company files and categories

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/files/view/
Success response:
  • 200 The response content will be an XML document with the requested information. The files will be contained within their category's xml wrapper.
Failure response:
  • 404 if no files or categories are found.
  • 403 if the API user does not have permission to see the company files
Sample response:
<files>
 <category id="20">
  <name>New Employee Docs</name>
  <file id="387">
   <name>Direct Deposit Form</name>
   <originalFileName>Direct Deposit Form.rtf</originalFileName>
   <size>57028</size>
   <dateCreated>2009-08-28 15:56:58</dateCreated>
   <createdBy></createdBy>
   <shareWithEmployee>no</shareWithEmployee>
  </file>
 </category>
</files>

Add a company file category

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/files/categories/
Success response:
  • 201 The category was created.
Failure response:
  • 403 if the API user does not have permission to see the company files
  • 400 if the posted XML is invalid or there was no category name given
  • 500 there was an unknown server error.
Sample request:
<files>
	<category>A new category</category>
</files>

Update a company file

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/files/{fileId}/
File attributes that can be updated:
  • name: rename the file
  • categoryId: move the file to a different category
  • shareWithEmployees: update whether this file is shared or not
Success response:
  • 200 if the file was updated.
Failure response:
  • 403 if the API user does not have permission to see the company files
  • 400 if the posted XML is invalid
  • 404 if the file or category was not found
Sample request:
<file>
	<name>This is a new name for the file</name>
	<categoryId>4</categoryId>
	<shareWithEmployees>no</shareWithEmployee>
</file>

Download a company file

HTTP Method: GET
Path: /api/gateway.php/{company}/v1/files/{fileId}/
Success response:
  • 200 if the file was successfully retrieved. Additionally, HTTP headers are sent that provide the Content-Type, Content-Length, and Content-Disposition for the file. The file contents will be contained in the response contents.
Failure response:
  • 403 if the API user does not have permission to see the company files
  • 404 if the file was not found

Upload a company file

HTTP Method: POST
Path: /api/gateway.php/{company}/v1/files/
Submission fields
  • category - the category id to place the new file in.
  • fileName - the file name to associate with the file.
  • share - whether to make the file available to employees (options are "yes" and "no")
  • file - the file to upload. Note that the field must be named "file".
Success response:
  • 201 if the file was successfully uploaded.
Failure response:
  • 403 if the API user does not have permission to see the company files
  • 404 if the category ID was not found
  • 413 if the file size exceeds 20 MB or the storage limit for the company
Special notes

The file upload methods accept multi-part forms. To build a multi-part form concatenate the individual sections together separated by a boundary. Then take the length of the resulting body and use that as the Content-Length for the submission. (See here, here, and here.)

Sample request (with http headers shown)
POST /api/gateway.php/sample/v1/files/ HTTP/1.0
Host: api.bamboohr.com
Content-Type: multipart/form-data; boundary=----BambooHR-MultiPart-Mime-Boundary----
Content-Length: 520

------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="category"

112
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="fileName"

readme.txt
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="share"

yes
------BambooHR-MultiPart-Mime-Boundary----
Content-Disposition: form-data; name="file"; filename="readme.txt"
Content-Type: text/plain

This is a sample text file.

------BambooHR-MultiPart-Mime-Boundary------
							

Have more questions? We're here to help, so please contact us.