Justworks Partner API (1.7.2)

Download OpenAPI specification:

API Support: [email protected]

Overview

Partner API is a public-facing API provided by Justworks to partners and customers who want to integrate with Justworks.

Our V1 API uses OAuth2 authentication.

The base URL for the V1 API is https://public-api.justworks.com.

To obtain access to the API, please contact partner-api@justworks.com.

OAuth Scopes

Our API uses scoped tokens. When a token is assigned a scope, it will inherit all the access permissions of its "child scope(s)".

Scope Name Child Scope(s)
company.detail:read company.basic:read
company.basic:read
company.bank_account:read
member.detail:read member.basic:read
member.basic:read
member.dob:read
member.sex:read
member.employment:read
member.pay:read
member.tax_id:read
payroll:read
paystub:read
time_off:read
deductions:write deductions:read
deductions:read

Formatting Notes

Currencies

Currency values are represented as zero-decimal.

Fixed amounts use 2 significant digits. For example, $45.00 would be represented in the API as 4500.

Percentage amounts use 4 significant digits. For example, 3.7% would be represented as 37000.

Empty values

Our API design follows the guidelines below regarding empty values:

  • Single-value types are omitted from responses if they have empty values
  • Array types are included in responses as empty arrays if they have no values
  • Complex types (i.e., objects) are omitted from responses if they are completely empty or null.
    • If any of a complex type's nested fields have values, that field and any of its populated nested fields will be included.
    • Any of its empty nested fields will be omitted.
  • A field is marked required in our API docs if we always expect it to have a value. These fields will never be omitted from responses.

Internationalization

Formats and Data Structures

The V1 API is built with international data in mind. This includes addresses, phone numbers and money fields.

There are also more complex structures that require specific shapes of data and fieldsets that vary from country to country. Such structures include a company's legal corporate structure, tax identifiers and member employment information.

On these types you'll find a hashmap keyed by country code. This map contains typed structures that match the way specific countries track things like corporate legal structure, tax IDs and employment status.

We represent country codes using the ISO 3166-1 alpha-2 standard.

International Members

International members (members with a type of international_employee or employee_eor) are now included in List Members and Get Member datasets.

These members contain a limited subset of datapoints, including the following:

  • ids
  • name
  • type
  • active status
  • emails
  • employment information
  • department
  • job title
  • employment start date
  • office
  • manager

Integration With the API

Justworks's Public API is built around an Authorization Code Flow; customers must explicitly authorize integrations to access their data.

Step 1: Getting a new OAuth Application

Creation of OAuth Applications for our API is not self-service, but the Justworks team is happy to help set one up for you.

We will need the following information:

  • Redirect URI: a callback URL the customer will be redirected to after authorizing your application (an OAuth application can have multiple associated redirect URIs)
  • Scopes: the set of data your application will need to have access to (see Available Scopes)
  • Name: how you want your app identified to your customers (most likely your company/product)

We also support the following optional info, shown to customers when they authorize your application:

  • Logo URL
  • Terms of Service URL
  • Privacy Policy URL

Once created, you will be provided with a client_id and client_secret for your application, along with the Justworks auth url customers should be directed to.

Step 2: Customer Authorization

You will need to construct a URL and direct customers to it, so that they can authorize you to access their information. A common way to do this is to have a button in your UI saying something like "Connect to Justworks".

It is recommended to use an OAuth library to construct the URL, but it will look something like https://payroll.justworks.com/oauth/authorize?response_type=code&client_id=CLIENT_ID&state=STATE_PARAM&scope=SPACE_DELIMITED_SCOPES&redirect_uri=REDIRECT_URI, where:

  • response_type: should always be code
  • client_id: the client ID of the OAuth application obtained in Step 2
  • state: an arbitrary parameter your team can use in validating authenticity of responses from our OAuth server
  • scope: a space-delimited list of scopes (see available scopes)
  • redirect_uri: one of the callback URLs you provided, to redirect the user to when the flow is complete (success or failure).

The customer will access this link in their browser, log into their Justworks account, and authorize your application to access their information.

Once this is successful, they will be redirected to the specified redirect_uri, with the generated authorization code in the code query string parameter and the state parameter returned for verification.

Step 3: Get an OAuth token

The redirect will call your callback URL with an authorization code; your system can now call the API directly, and exchange this for an OAuth Token.

curl --location 'https://public-api.justworks.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=CLIENT_ID' \
--data-urlencode 'client_secret=CLIENT_SECRET' \
--data-urlencode 'redirect_uri=REDIRECT_URI' \
--data-urlencode 'code=AUTHORIZATION_CODE'

The parameters for this request:

  • grant_type should always be authorization_code when obtaining a token for the first time (i.e., not refreshing a token)
  • client_id is the client ID of the OAuth application obtained in Step 1
  • client_secret the client secret of the OAuth application obtained in Step 1
  • redirect_uri should match the Redirect URI used in the previous step
  • code is the authorization code obtained in the previous step

Sample Response: { "access_token": "ACCESS_TOKEN", "refresh_token": "REFRESH_TOKEN", "scope": "SPACE DELIMITED SCOPES", "expires_at": "2024-12-11T13:09:16.688468-06:00" }

Access tokens are valid for 24 hours. Refresh tokens are valid for 30 days.

Step 4: Using the tokens

You can now access the API to retrieve customer data. Simply add the access token to the header with the Bearer prefix:

curl --location 'https://public-api.justworks.com/v1/company' --header 'Authorization: Bearer ACCESS_TOKEN'

Because the access token is short-lived, the refresh token will need to be regularly used to obtain a new access token.

Example refresh request:

curl --location 'https://public-api.justworks.com/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=CLIENT_ID' \
--data-urlencode 'client_secret=CLIENT_SECRET' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token=REFRESH_TOKEN'

Parameters:

  • grant_type should always be refresh_token when refreshing a token
  • client_id is the client ID of the OAuth application obtained in Step 1
  • client_secret is the client secret of the OAuth application obtained in Step 1
  • refresh_token the refresh_token value from the original token response in Step 3

Response:

{
  "access_token": "ACCESS_TOKEN",
  "refresh_token": "REFRESH_TOKEN",
  "scope": "SPACE DELIMITED SCOPES",
  "expires_at": "2024-12-11T13:09:16.688468-06:00"
}

Revoking access token on disconnect

When a customer disconnects your application, you should revoke the access token to prevent further access to their data.

curl --location 'https://public-api.justworks.com/v1/oauth/revoke' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=CLIENT_ID' \
--data-urlencode 'client_secret=CLIENT_SECRET' \
--data-urlencode 'token={ACCESS_TOKEN|REFRESH_TOKEN}' \
--data-urlencode 'token_type_hint={access_token|refresh_token}'

The parameters for this request:

  • client_id is the client ID of the OAuth application obtained in Step 1
  • client_secret is the client secret of the OAuth application obtained in Step 1
  • token is the access token or refresh token you want to revoke
  • token_type_hint is optional, but recommended. Both access_token and refresh_token will be looked up at the best effort, but specifying the type will allow us to optimize the lookup.
    • If you are revoking an access token, use access_token
    • If you are revoking a refresh token, use refresh_token

Note: The older /oauth/revoke endpoint is deprecated and will be removed in the future. Please always use /v1/oauth/revoke

Authorization

Revoke OAuth Token

Authorizations:
OAuth2Application
Request Body schema: application/x-www-form-urlencoded
required
token
required
string <= 255 characters

Token

token_type_hint
string
Enum: "access_token" "refresh_token"

Token type hint

Responses

Obtain OAuth Token

Authorizations:
OAuth2Application
Request Body schema: application/x-www-form-urlencoded
required
client_id
required
string

Client ID

client_secret
required
string

Client secret

grant_type
required
string
Enum: "authorization_code" "refresh_token"

Grant type

scope
required
string

Requested scopes (space-delimited list)

redirect_uri
required
string

Redirect URI

code
string

Code (include if grant_type is authorization_code)

refresh_token
string

Refresh token (include if grant_type is refresh_token)

Responses

Response samples

Content type
application/json
{
  • "token_type": "string",
  • "access_token": "string",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "refresh_token": "string",
  • "scope": "string"
}

V1 Revoke OAuth Token

Authorizations:
OAuth2Application
Request Body schema: application/x-www-form-urlencoded
required
client_id
required
string

Client ID

client_secret
required
string

Client secret

token
required
string

Token

token_type_hint
required
string
Enum: "access_token" "refresh_token"

Token type hint

Responses

Company

Get Company

Returns data about the current company.

Scope Enforcement Level
company.basic:read REQUIRED Endpoint
company.detail:read OPTIONAL Field

See response field descriptions for details about field level requirements.

Authorizations:
OAuth2Application

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "tax_id": "string",
  • "display_name": "string",
  • "legal_name": "string",
  • "addresses": [
    ],
  • "departments": [
    ],
  • "offices": [
    ],
  • "phones": [
    ],
  • "country_data": {
    },
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Get Company Bank Account

Returns the current company's bank account information.

Scope Status Info
company.bank_account:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application

Responses

Response samples

Content type
application/json
{
  • "bank_name": "string",
  • "account_type": "string",
  • "account_number_tail": "string",
  • "routing_number": "string"
}

List Company Custom Fields

List custom fields for the current company.

Scope Status Info
company.detail:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Members

List Members

Returns a list of the current company's members.

Scope Enforcement Level
member.basic:read REQUIRED Endpoint
member.detail:read OPTIONAL Field
member.employment:read OPTIONAL Field
member.pay:read OPTIONAL Field

See response field descriptions for details about field level requirements.

Authorizations:
OAuth2Application
query Parameters
cursor
string
Example: cursor=cursor

Cursor

limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

status
string
Example: status=active

Status

updated_at
string <date>
Example: updated_at=2021-01-22

Date format: YYYY-MM-DD

updated_at_gt
string <date>
Example: updated_at_gt=2021-01-22

Date format: YYYY-MM-DD

updated_at_gte
string <date>
Example: updated_at_gte=2021-01-22

Date format: YYYY-MM-DD

updated_at_lt
string <date>
Example: updated_at_lt=2021-01-22

Date format: YYYY-MM-DD

updated_at_lte
string <date>
Example: updated_at_lte=2021-01-22

Date format: YYYY-MM-DD

updated_at_ne
string <date>
Example: updated_at_ne=2021-01-22

Date format: YYYY-MM-DD

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

Get Member

Get a member by ID within the current company.

Scope Enforcement Level
member.basic:read REQUIRED Endpoint
member.detail:read OPTIONAL Field
member.dob:read OPTIONAL Field
member.sex:read OPTIONAL Field
member.employment:read OPTIONAL Field
member.pay:read OPTIONAL Field

See response field descriptions for details about field level requirements.

Authorizations:
OAuth2Application
path Parameters
member_id
required
string
Example: member_01j6feh5sp5jr16vtnp95kyqby

Member ID

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "company_id": "string",
  • "work_id": "string",
  • "name": {
    },
  • "active": true,
  • "employment_location_type": "remote",
  • "type": "unpaid_owner",
  • "addresses": [
    ],
  • "emails": [],
  • "employment_history": [
    ],
  • "pay_history": [
    ],
  • "phones": [
    ],
  • "current_employment": {
    },
  • "current_pay": {
    },
  • "current_pay_frequency": "semimonthly",
  • "date_added_to_justworks": "2019-08-24",
  • "date_of_birth": "2019-08-24",
  • "department": {
    },
  • "employment_start_date": "2019-08-24",
  • "employment_termination_date": "2019-08-24",
  • "job_title": "string",
  • "manager": {
    },
  • "office": {
    },
  • "sex_assigned_at_birth": "",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List Member Custom Field Values

List custom field values for a given memberId for the current company.

Scope Status Info
member.detail:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
member_id
required
string
Example: member_01j6feh5sp5jr16vtnp95kyqby

Member ID

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Get Member Tax ID

Get the Tax ID of the specified member.

Scope Status Info
member.tax_id:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
member_id
required
string
Example: member_01j6feh5sp5jr16vtnp95kyqby

Member ID

Responses

Response samples

Content type
application/json
{
  • "US": {
    }
}

Payroll

List Payrolls

List payrolls for the current company.

Scope Status Info
payroll:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
query Parameters
start_date
required
string
Example: start_date=2021-01-01

Start Date

end_date
required
string
Example: end_date=2021-01-31

End Date

limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

cursor
string
Example: cursor=cursor

Cursor

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

List Fees for Payroll

List fees for a given payrollId for the current company.

Scope Status Info
payroll:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
payroll_id
required
string
Example: payroll_01j6feh5sp5jr16vtnp95kyqby

Payroll ID

query Parameters
limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

cursor
string
Example: cursor=cursor

Cursor

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

List Paystubs for Payroll

List paystubs for a given payrollId for the current company.

Scope Status Info
paystub:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
payroll_id
required
string
Example: payroll_01j6feh5sp5jr16vtnp95kyqby

Payroll ID

query Parameters
limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

cursor
string
Example: cursor=cursor

Cursor

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

Get Paystub

Get a paystub within the current company by ID.

Scope Status Info
paystub:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
paystub_id
required
string
Example: c1f7d719-c2c0-4b55-9cf7-85de2f4c6498

Paystub ID

Responses

Response samples

Content type
application/json
{
  • "member_id": "string",
  • "paystub_id": "string",
  • "gross_pay": 2147483647,
  • "net_pay": 2147483647,
  • "earnings": [
    ],
  • "employee_deductions": [
    ],
  • "employer_contributions": [
    ],
  • "currency": "string",
  • "pay_date": "string",
  • "pay_group": "string",
  • "pay_period_end": "string",
  • "pay_period_start": "string"
}

Deductions

List Deduction Types

List deduction types for the current company.

Scope Status Info
deductions:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application

Responses

Response samples

Content type
application/json
[
  • {
    }
]

List Deductions

List deductions for the current company.

Scope Status Info
deductions:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
query Parameters
deduction_type
string
Example: deduction_type=health_insurance

Deduction Type

frequency
string
Example: frequency=one_time

Frequency

description
string
Example: description=description

Description

member_id
string
Example: member_id=member_01j6feh5sp5jr16vtnp95kyqby

Member ID

cursor
string
Example: cursor=cursor

Cursor

limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

Create Deductions

Create deduction for a given company member.

Scope Status Info
deductions:write REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
Request Body schema: application/json
required

Request body

Array of objects (CreateDeductionsRequestItem)

Responses

Request samples

Content type
application/json
{
  • "items": [
    ]
}

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Update Deductions

Update deductions by ID.

Scope Status Info
deductions:write REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
Request Body schema: application/json
required

Request body

Array of objects (UpdateDeductionsRequestItem)

Responses

Request samples

Content type
application/json
{
  • "items": [
    ]
}

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Cancel Deductions

Cancel deductions by ID.

Scope Status Info
deductions:write REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
Request Body schema: application/json
required

Request body

deduction_ids
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "deduction_ids": [
    ]
}

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Documentation

Get OpenAPI Docs

Get the OpenAPI documentation for the API.

Authorizations:
OAuth2Application
query Parameters
format
string
Example: format=html

Format of the documentation. Options: html, yaml. Defaults to html.

Responses

Response samples

Content type
application/json
"string"

Legacy ID Translation

Get Company Canonical ID

Get the canonical ID for a company given a legacy company ID.

NOTE: This endpoint is only available temporarily, and will be removed in the future. It is intended to help partners transition to the new ID format, but not to be integrated into ongoing API usage.

Authorizations:
OAuth2Application
path Parameters
legacy_company_id
required
string
Example: 2fcbdb33-35ce-4c51-af3d-67cee0bf7a42

Legacy Company ID

Responses

Response samples

Content type
application/json
{
  • "id": "string"
}

Get Member Canonical ID

Get the canonical ID for a member given a legacy member ID.

NOTE: This endpoint is only available temporarily, and will be removed in the future. It is intended to help partners transition to the new ID format, but not to be integrated into ongoing API usage.

Authorizations:
OAuth2Application
path Parameters
legacy_member_id
required
string
Example: 2fcbdb33-35ce-4c51-af3d-67cee0bf7a42

Legacy Member ID

Responses

Response samples

Content type
application/json
{
  • "id": "string"
}

Time Off

Create Time Off Balances Report

Generate a time off balances report for the current company.

Scope Status Info
time_off:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
Request Body schema: application/json
required

Request body

member_id
string
policy_id
string
object (date.Date)

Responses

Request samples

Content type
application/json
{
  • "member_id": "string",
  • "policy_id": "string",
  • "as_of_date": {
    }
}

Response samples

Content type
application/json
{
  • "report_id": "string"
}

Get Time Off Balances Report

Get a time off balances report for the current company.

Scope Status Info
time_off:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
path Parameters
report_id
required
string
Example: 01ARZ3NDEKTSV4RRFFQ69G5FAV

Report ID

Responses

Response samples

Content type
application/json
{
  • "status": "pending",
  • "items": [
    ],
  • "message": "string"
}

List Time Off Policies

List time off policies for the current company.

Scope Status Info
time_off:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
query Parameters
status
string
Example: status=active

Status

limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

cursor
string
Example: cursor=cursor

Cursor

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}

List Time Off Requests

List time off requests for the current company.

Scope Status Info
time_off:read REQUIRED Endpoint level requirement.
Authorizations:
OAuth2Application
query Parameters
start_date
required
string
Example: start_date=2021-01-01

Start Date

end_date
required
string
Example: end_date=2021-01-31

End Date

member_id
string
Example: member_id=member_01j6feh5sp5jr16vtnp95kyqby

Member ID

policy_id
string
Example: policy_id=policy_01j6feh5sp5jr16vtnp95kyqby

Policy ID

status
string
Example: status=requested

Status

limit
integer <int32> [ 1 .. 100 ]
Example: limit=10

Limit

cursor
string
Example: cursor=cursor

Cursor

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "next_cursor": "string"
}