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
- Employees
- Add an employee
- Get an employee
- Update an employee
- Get a directory of employees
- Reports
- Request a company report
- Request a custom report
- Employee files
- List employee files and categories
- Add an employee file category
- Update an employee file
- Download an employee file
- Upload an employee file
- Company files
- List company files and categories
- Add a company file category
- Update a company file
- Download a company file
- Upload a company file
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 | 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 | 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 | 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 |
Add an employee
| HTTP Method: | POST |
|---|---|
| Path: | /api/gateway.php/{company}/v1/employees/ |
| Minimum required fields: | firstName, lastName |
| Success response: |
|
| Failure responses: |
|
| 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 |
|
| 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: |
|
| Failure responses: |
|
| 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: |
|
| Failure responses: |
|
| 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: |
|
| Failure responses: |
|
| 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 |
|
| 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: |
|
| Failure response: |
|
| 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: |
|
| 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: |
|
| Failure response: |
|
| 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: |
|
| Failure response: |
|
| 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: |
|
| Success response: |
|
| Failure response: |
|
| 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: |
|
| Failure response: |
|
Upload an employee file
| HTTP Method: | POST |
|---|---|
| Path: | /api/gateway.php/{company}/v1/employees/{number}/files/ |
| Submission fields |
|
| Success response: |
|
| Failure response: |
|
| 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: |
|
| Failure response: |
|
| 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: |
|
| Failure response: |
|
| 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: |
|
| Success response: |
|
| Failure response: |
|
| 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: |
|
| Failure response: |
|
Upload a company file
| HTTP Method: | POST |
|---|---|
| Path: | /api/gateway.php/{company}/v1/files/ |
| Submission fields |
|
| Success response: |
|
| Failure response: |
|
| 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.