# API reference

> Five endpoints, one header, JSON in and out.

| | |
| --- | --- |
| Base URL | `https://api.paycaptain.com` |
| Authentication | `X-API-Key` header on every request |
| Format | JSON request and response bodies |
| Transport | HTTPS, TLS 1.2 or higher |
| Specification | [OpenAPI 3.0](https://developer.paycaptain.com/openapi.json) |

## POST /employee

Create or update an employee.

Request body: one [Employee](https://developer.paycaptain.com/fields/employee) object.

Responses: `200` Success · `400` Error. Fix the record; do not retry unchanged.

## GET /employees

Get employees, 50 per page.

Returns: an array of [Employee](https://developer.paycaptain.com/fields/employee) objects.

| Query parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `company` | string | Yes | Your PayCaptain company code. |
| `lastModifiedDate` | string (YYYY-MM-DD) | No | Only employees modified after this date (YYYY-MM-DD). |
| `includeFormer` | boolean | No | Include former employees. Default: `false`. |
| `page` | integer | No | Page number. |

Responses: `200` A page of employees · `204` No more pages · `400` Error

## POST /shift

Create, update or archive a shift.

Request body: one [Shift](https://developer.paycaptain.com/fields/shift) object.

Responses: `200` Success · `400` Error. Fix the record; do not retry unchanged.

## POST /payment

Create, update or archive a pay element.

Request body: one [Payment](https://developer.paycaptain.com/fields/payment) object.

Responses: `200` Success · `400` Error. Fix the record; do not retry unchanged.

## GET /payslips

Get payslips and their lines for a pay period, 50 per page.

Returns: an array of [Payslip](https://developer.paycaptain.com/fields/payslip) objects.

| Query parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `company` | string | Yes | Your PayCaptain company code. |
| `payPeriod` | string | Yes | Pay Period reference, as shown in the PayCaptain app. |
| `page` | integer | No | Page number. |

Responses: `200` A page of payslips · `204` No more pages · `400` Error


## Status codes

| Code | Meaning | What to do |
| --- | --- | --- |
| `200` | Success. Data returned or record accepted. | Continue. |
| `204` | No more pages. | Stop paginating. |
| `400` | The request was rejected. | Fix the record. Do not retry it unchanged. |
| `429` | Rate limited. | [Back off and retry](https://developer.paycaptain.com/reliability#retries). |
| `5xx` | Server error. | [Back off and retry](https://developer.paycaptain.com/reliability#retries). |
