Migrating from v1 to v2
REST API v1 continues to operate exactly as it does today. Existing integrations are not forced to change, and the move to v2 can happen on your own schedule. The trade-off is that v1 is sealed: it remains read-only and receives no new endpoints or fields. New features, write access and webhooks exist only in v2. This guide explains what changes, how to adapt your code, and how to retire the old key safely.
What changes between v1 and v2
The biggest shift is not the URL but the permission model. A v1 key belongs to the workspace and sees everything. A v2 key belongs to the person who created it, carries explicit scopes, and can only see data that person can see. Scopes never exceed the owner's role. The dashboard no longer creates v1 keys; existing v1 keys keep working and appear as legacy keys on the Open API add-on page, where they can be deleted. A v1 key does not work on v2 — v2 requires a key beginning with vt_live_..., created on the same Open API add-on page.
The table below summarizes the structural differences. Treat the base paths, header names and envelope shapes as exact contract values.
Success responses
In v1, a successful response wraps its payload in a status field set to ok. In v2 that wrapper is removed: the payload sits directly under data. If your client checks status === "ok" before reading the body, that check must be removed or it will fail on every v2 response. Read data (and nextToken, when present) directly, and rely on the HTTP status code to determine success or failure.
Errors
Every v2 error — including authentication failures and requests to unknown paths — uses a single envelope with a nested error object. The fields are: code, a stable identifier you should branch on rather than the human-readable text; name, a short label; description, what went wrong; resolution, what to do about it; requestId, which you should include when contacting support; and details, optional extra data such as the invalid fields.
A useful distinction for triage: the HTTP status code remains the source of truth for whether the call succeeded or failed, exactly as in v1. The error.code value is what you switch on to decide how to recover. Do not parse description or message text for control flow.
Endpoint mapping and field differences
Each of the six v1 endpoints has a v2 counterpart. The v2 version takes the same query parameters and returns the same fields, apart from the exceptions in the mapping table. The most consequential changes are in leaves and expanded users. In v2, reason requires the leaves:read-reason scope (which also covers TOIL) and is null without it; v1 always returned the reason. v2 leaves also add statusReason and approvedLevel, and fill in createdAt, which v1 left empty. When you use expand, the embedded user and approver use the v2 user shape: departmentId instead of teamId, and no role.
Single-resource reads such as GET /v2/<resource>/{id} are new in v2 and are not available in v1. Departments and locations gain extra fields on the single-resource endpoint; labels always return a numeric userCount (zero when no user has the label); leave types add position and calendarStatus.
v2 also validates query parameters that v1 passed through. Invalid input returns 400 VALIDATION_ERROR with the offending fields in details. limit must be an integer between 1 and 1000, and startDate and endDate on GET /v2/leaves must be YYYY-MM-DD dates without a time component.
Key ownership and data reach
Because a v2 key is tied to its creator, the same integration can return different results depending on who owns the key. An administrator-owned key sees the whole workspace, matching v1. A location admin sees only the locations they manage. An approver sees only the departments they approve and cannot read departments, locations or labels. A regular user sees only themselves and likewise cannot read departments, locations or labels.
If the integration must keep the full visibility it had under v1, issue the v2 key from an administrator account. Note that a v2 key's reach can be narrower than what its owner sees in the product interface, and the Visibility add-on does not lift that ceiling. When results are missing after migration, check both the key's scopes and the owner's data reach before assuming a bug.
Migration checklist
- Create a v2 key. On the Open API add-on page, grant the scopes your v1 integration uses:
departments:read,locations:read,labels:read,leave-types:read,leaves:read,users:readandholidays:read. These match what a v1 key can read. Create the key as an administrator if the integration needs the whole workspace. Copy the secret immediately — it is shown only once.
- Switch the base URL and header. Change
$API_BASE_URL/v1to$API_BASE_URL/v2, and replace thex-api-key: <key>header withAuthorization: Bearer vt_live_....
- Rework how you read responses. Drop the
status: "ok"check and readdata(plusnextTokenwhen present) directly. For failures, branch onerror.coderather than themessagetext. If your parser is strict about leave types, leaves or expanded users, apply the field differences from the endpoint mapping.
- Test against v2 and compare results with v1. If data is missing, check the key's scopes and the owner's data reach.
- Retire the v1 key. Once the integration is confirmed on v2, remove the legacy v1 key on the Open API add-on page. Removal is permanent: the key stops working and cannot be reissued.
| — | v1 | v2 |
|---|---|---|
| Base path | $API_BASE_URL/v1 | $API_BASE_URL/v2 |
| Authentication | x-api-key: <key> header | Authorization: Bearer vt_live_... header |
| Keys | Company-wide, unscoped | Owned by a user, with scopes (for example leaves:read) that never exceed the owner's role. A key sees only the data its owner can see. |
| Success envelope | { "status": "ok", "data": ... } | { "data": ... } |
| Error envelope | { "status": "error", "message": "..." } or { "message": "..." } | { "error": { "code", "name", "description", "resolution", "requestId", "details" } } |
| Pagination | limit and nextToken | Same: limit and nextToken, with nextToken at the top level next to data |
| Access | Read only | Read and write, plus webhooks |
| Single resources | Not available | GET /v2/<resource>/{id} |
Exact contract values; do not alter base paths, header names or envelope shapes.
| Field | Description |
|---|---|
| code | Stable error code. Branch on this, not on the text. |
| name | Short name of the error |
| description | What went wrong |
| resolution | How to fix it |
| requestId | Include it when you contact support |
| details | Optional extra data, for example the invalid fields |
The HTTP status code remains the source of truth for success or failure.
| v1 | v2 | Scope | Differences |
|---|---|---|---|
| GET /v1/departments | GET /v2/departments | departments:read | Same fields. GET /v2/departments/{id} also returns parentId and approvers. |
| GET /v1/locations | GET /v2/locations | locations:read | Same fields. GET /v2/locations/{id} also returns the year start, first day of the week, quota reset and rollover expiry settings. |
| GET /v1/labels | GET /v2/labels | labels:read | Same fields. userCount is always a number (0 when no user has the label). |
| GET /v1/leave-types | GET /v2/leave-types | leave-types:read | Adds position and calendarStatus. |
| GET /v1/leaves | GET /v2/leaves | leaves:read, plus leaves:read-reason for the reasons and the read scope of each expand value | Adds reason, statusReason and approvedLevel, and fills in createdAt, which v1 leaves empty. v1 always returned the reason; in v2 it needs leaves:read-reason (which covers TOIL too) and is null without it. With expand, the embedded user and approver use the v2 user shape (departmentId instead of teamId, no role). |
| GET /v1/users | GET /v2/users | users:read, plus the read scope of each expand value | Same fields. employeeId, startDate and endDate are null when not set, as in v1. |
All six v1 endpoints have a v2 equivalent accepting the same query parameters and returning the same fields, except as listed.
| Key owner role | v1 key | v2 key |
|---|---|---|
| Administrator | The whole workspace | The whole workspace |
| Location admin | The whole workspace | Only the locations they manage |
| Approver | The whole workspace | Only the departments they approve. The key cannot read departments, locations or labels. |
| User | The whole workspace | Only themselves. The key cannot read departments, locations or labels. |
A v2 key can see less than its owner sees in the product interface; the Visibility add-on does not change this ceiling.
Frequently asked questions
Will my existing v1 integration stop working?
No. v1 keeps working as it does today, and existing v1 keys keep working. The dashboard no longer creates new v1 keys, and v1 receives no new endpoints or fields. New features, write access and webhooks are v2 only.
Can I use my v1 key on v2?
No. v1 keys do not work on v2. Create a v2 key beginning with vt_live_... on the Open API add-on page. The secret is shown only once, so copy it immediately.
Why does v2 return less data than v1 for the same request?
A v1 key belongs to the workspace and sees everything. A v2 key belongs to its creator and is limited to that person's data reach. An approver or regular user key cannot read departments, locations or labels. Create the v2 key as an administrator to preserve full-workspace visibility.
Should I branch on the HTTP status or the error code?
Use the HTTP status code to decide whether the call succeeded or failed, as in v1. Use error.code to decide how to recover. Do not parse description or message text for control flow.
Can a deleted v1 key be recreated?
No. A deleted v1 key stops working and cannot be recreated. Delete it only after the integration is confirmed to run on v2.
{
"status": "ok",
"data": [{ "id": "...", "name": "Engineering", "isDefault": false, "createdAt": "..." }]
}{
"data": [{ "id": "...", "name": "Engineering", "isDefault": false, "createdAt": "..." }]
}{
"error": {
"code": "...",
"name": "...",
"description": "Example post details.",
"resolution": "What to do about it.",
"requestId": "...",
"details": {}
}
}# v1
curl $API_BASE_URL/v1/departments \
-H "x-api-key: your-api-key"
# v2
curl $API_BASE_URL/v2/departments \
-H "Authorization: Bearer vt_live_..."