> ## Documentation Index
> Fetch the complete documentation index at: https://partners.usehammock.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Take one employee from roster to a funded payroll in the sandbox.

This walkthrough uses a sandbox key and the [test helpers](https://partners.usehammock.co/guides/testing.md), which stand in for
the hosted flows and the waiting periods. Every request goes to the sandbox:

```bash theme={null}
export HAMMOCK_API=https://api.sandbox.usehammock.co
export HAMMOCK_KEY=hmk_test_...
```

**1. Create an employer**

```bash theme={null}
curl $HAMMOCK_API/employers \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "name": "Acme Robotics",
    "external_id": "company_8f2k1",
    "primary_contact": {
      "first_name": "Dana",
      "last_name": "Whitfield",
      "email": "dana@acmerobotics.example"
    }
  }'
```

The employer starts in `onboarding`. In production you would now send its admin through an
[employer link](https://partners.usehammock.co/guides/employers.md). In the sandbox, skip ahead:

```bash theme={null}
curl -X POST $HAMMOCK_API/test_helpers/employers/empr_1Qx8Zt2eZvKYlo2C/activate \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "benefit_types": ["hsa", "dependent_care_fsa"] }'
```

**2. Add a pay schedule and an employee**

```bash theme={null}
curl $HAMMOCK_API/pay_schedules \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "employer": "empr_1Qx8Zt2eZvKYlo2C",
    "frequency": "semimonthly",
    "pay_date_offset_days": 4
  }'

curl $HAMMOCK_API/employees \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "employer": "empr_1Qx8Zt2eZvKYlo2C",
    "external_id": "wrk_4821",
    "email": "jordan.lee@acmerobotics.example",
    "first_name": "Jordan",
    "last_name": "Lee",
    "pay_schedule": "ps_7Hn3Kd9sLq2W"
  }'
```

**3. Enroll the employee**

In production the employee enrolls through an [enrollment link](https://partners.usehammock.co/guides/employees.md). In the
sandbox, enroll them directly. List the employer's benefits to find the HSA's ID first.

```bash theme={null}
curl "$HAMMOCK_API/benefits?employer=empr_1Qx8Zt2eZvKYlo2C&type=hsa" \
  -H "Authorization: Bearer $HAMMOCK_KEY"

curl $HAMMOCK_API/test_helpers/employees/emp_5Tg7Rw2nBx8P/enroll \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "benefit": "ben_4Df8Gh2jKl6M", "annual_employee_amount": 360000 }'
```

Hammock creates an election and a standing deduction, and sends `election.created` and
`deduction.created` events.

**4. Read what to withhold**

Ask for the deductions that apply to your next payday.

```bash theme={null}
curl "$HAMMOCK_API/deductions?employer=empr_1Qx8Zt2eZvKYlo2C&pay_date=2027-03-19" \
  -H "Authorization: Bearer $HAMMOCK_KEY"
```

```json theme={null}
{
  "object": "list",
  "url": "/deductions",
  "has_more": false,
  "data": [
    {
      "id": "ded_2Lp9Xc4vNm7K",
      "object": "deduction",
      "employee": "emp_5Tg7Rw2nBx8P",
      "benefit_type": "hsa",
      "category": "contribution",
      "tax_treatment": "pre_tax",
      "status": "active",
      "employee_amount": 15000,
      "employer_amount": 5000,
      "currency": "usd",
      "effective_date": "2027-03-19",
      "end_date": null,
      "upcoming_change": null,
      "variable": false
    }
  ]
}
```

**5. Report the payroll**

```bash theme={null}
curl $HAMMOCK_API/payrolls \
  -H "Authorization: Bearer $HAMMOCK_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "employer": "empr_1Qx8Zt2eZvKYlo2C",
    "external_id": "payroll_2027_03_19",
    "pay_schedule": "ps_7Hn3Kd9sLq2W",
    "pay_period": { "start_date": "2027-03-01", "end_date": "2027-03-15" },
    "pay_date": "2027-03-19",
    "deductions": [
      { "deduction": "ded_2Lp9Xc4vNm7K", "employee_amount": 15000, "employer_amount": 5000 }
    ]
  }'
```

The payroll comes back `reported`, with a `voidable_until` time and the `pull` that will
fund it.

**6. Watch it fund**

In production the pull starts on the pay date and settles three business days later. In the
sandbox, advance it yourself. The first call starts the pull and the second settles it.

```bash theme={null}
curl -X POST $HAMMOCK_API/test_helpers/payrolls/pay_6Mn2Bv8cXz4L/advance \
  -H "Authorization: Bearer $HAMMOCK_KEY"
```

The payroll moves to `funding`, then `completed`, and you receive `payroll.funding_started`,
`pull.settled` and `payroll.completed` events.

## What to build next

* [Onboard employers](https://partners.usehammock.co/guides/employers.md) with hosted setup.
* [Keep the roster in sync](https://partners.usehammock.co/guides/employees.md) and link employees into enrollment.
* [Listen for events](https://partners.usehammock.co/webhooks/overview.md) so deduction changes reach payroll before the lock date.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.