# Area 2: Set up the organization

Generated 2026-12-01 from the Everee docs (branch v1.0). Part of https://files.everee.com/everee-payroll-infrastructure-explainer.md

```text
GOAL
Build the setup screens and sync that create a company's work locations, payroll calendar, approval groups, cost centers and pay codes, and keep the Everee IDs next to my own records.

READ FIRST (each page also has a Markdown version at the same URL with .md added; the docs index is https://developer.everee.com/llms.txt)
- https://developer.everee.com/docs/setting-up-the-company
- https://developer.everee.com/docs/setting-up-your-organization
- https://developer.everee.com/reference/add-work-location
- https://developer.everee.com/reference/create-payroll-calendar
- https://developer.everee.com/reference/add-approval-group
- https://developer.everee.com/reference/add-cost-center
- https://developer.everee.com/reference/pay-codes-api-guide
- https://developer.everee.com/reference/create-a-pay-code
- https://developer.everee.com/reference/list-workers-comp-classes

BUILD
- Screens to create and archive work locations (POST/GET/DELETE /work-locations), create payroll calendars (POST/GET /payroll-calendar), approval groups, cost centers, and custom pay codes (POST/GET /pay-codes).
- Create these in dependency order before the first worker or hour: work locations and payroll calendar, then approval groups and cost centers, then pay codes. Store each returned Everee ID or key.
- List workers' comp classes (read only) so the user can attach the right class code to hours. Everee enters them during onboarding.

OPERATIONS (all paths are under https://api.everee.com/integration/v1; each reference page, with .md added, lists its request and response fields)
- POST /work-locations | operationId add-work-location | https://developer.everee.com/reference/add-work-location.md
- GET /work-locations | operationId list-work-locations | https://developer.everee.com/reference/list-work-locations.md
- DELETE /work-locations/{workLocationId} | operationId archive-work-location | https://developer.everee.com/reference/archive-work-location.md
- POST /payroll-calendar | operationId create-payroll-calendar | https://developer.everee.com/reference/create-payroll-calendar.md
- GET /payroll-calendar | operationId list-payroll-calendars | https://developer.everee.com/reference/list-payroll-calendars.md
- POST /approval-groups | operationId add-approval-group | https://developer.everee.com/reference/add-approval-group.md
- GET /approval-groups | operationId list-approval-groups | https://developer.everee.com/reference/list-approval-groups.md
- POST /cost-centers | operationId add-cost-center | https://developer.everee.com/reference/add-cost-center.md
- POST /pay-codes | operationId list-pay-codes-1 | https://developer.everee.com/reference/create-a-pay-code.md
- GET /pay-codes | operationId list-pay-codes | https://developer.everee.com/reference/list-pay-codes.md
- GET /workers-comp | operationId list-workers-comp-class-codes | https://developer.everee.com/reference/list-workers-comp-classes.md

RULES
- Pay code keys use only uppercase letters, numbers and underscores. The type decides tax treatment, so make the user pick deliberately, and don't change a type once it is used.
- Archive rather than delete a work location that has history.
- Build every flow as a loop around reads that tell you what is left: make a change, read the state again (readiness.missing for onboarding, a run's blockers and the requirements behind them for payroll, a funding's status and resolutionInstructions), and act on what is left. Never hard-code the steps: codes appear and disappear. Map each code you know to a screen, and show resolutionInstructions for any you don't. Use webhooks (company-onboarding.status-changed, requirement.created, payroll-run.status-changed) to know when to read again, not instead of the read. A requirement does NOT open when a worker is created or changed: it opens only when a payroll calculation or a returned deposit finds the problem, so calculate runs early.
- Base URL https://api.everee.com/integration/v1. The partner key is the HTTP Basic user name for the Company Onboarding API: the test key (zk_test_...) creates and reaches only Sandbox companies and the production key (zk_prod_...), issued after Everee approves the integration, only Production companies. A company in the other environment returns 404. The company key (tsk_...) is the HTTP Basic user name for everything else, plus an x-everee-tenant-id header holding the company's id.
- Keep every key on the server. Everee rejects browser requests. Read keys from a secrets store, never log them, never hard-code them.
- Rate limit: 100 operations per 5 seconds per key (see the RateLimit-Policy header). Back off on 429.
- Only payables and payroll run items have an idempotency key (externalId). Make other creates safe yourself: look first, keep the Everee ID next to your own record.
- Test against a sandbox instance (tsk_test_... keys) before production. Nothing in a URL selects the environment; the key does. Sandbox company creation is limited (25 alive at once, 50 created in any rolling 7 days; evaluation access before the agreement is signed: 1 and 2, 14 days, companies created without an agreement), and each Sandbox company is limited to 250 workers, 100 off-cycle runs in 7 days and 100 payroll calculations in 24 hours: a refused request returns 429 with when the next can be created, and a sandbox company you no longer need can be retired.

DONE WHEN
- Every record I create appears in the matching list call, and my database holds the Everee ID for each.
- Creating a worker or an hour that refers to a missing record is blocked in my UI before it reaches the API.

TESTS TO WRITE
- Records are created in dependency order, and running the setup twice creates no duplicates.
- A pay code key with a lowercase letter or space is rejected by your form before the API call.
- Archiving a work location with history uses the archive call, not a delete.
- Every Everee ID is persisted next to the matching record of yours.

If a fact you need isn't in the docs, ask me. Don't guess endpoint paths, field names or business rules.
```
