Vacation Tracker Docs
REST API v2API referenceLocations

Get a location

This API method returns a single location. Requires `locations:read`. Errors: `404 RESOURCE_NOT_FOUND` (the location does not exist or is outside the key's data reach).

GET
/v2/locations/{id}

Authorization

bearerAuth locations:read
AuthorizationBearer <token>

API key sent as Authorization: Bearer vt_live_<secret>. See the Authentication and Scopes sections at the top of this document for how keys are created, which scopes exist and how the key owner's role limits them.

In: header

Scope: locations:read

Path Parameters

id*string

resource ID.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v2/locations/string"
{
  "data": {
    "id": "location-79c77ac8-e5bf-479f-9488-648a58379ff1",
    "name": "Los Angeles",
    "timezone": "America/Los_Angeles",
    "isDefault": false,
    "createdAt": "2022-08-22T15:00:00.000Z"
  }
}
{
  "error": {
    "code": "UNAUTHORIZED",
    "name": "Unauthorized",
    "description": "The API key is missing, malformed or not recognized.",
    "resolution": "Send a valid API key in the Authorization header as Bearer followed by the full vt_live_ key.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}

{
  "error": {
    "code": "INSUFFICIENT_SCOPE",
    "name": "InsufficientScope",
    "description": "The API key does not have the scopes this request needs.",
    "resolution": "Add the scopes listed in details.requiredScopes to the key in the Vacation Tracker dashboard.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef",
    "details": {
      "requiredScopes": [
        "leaves:write"
      ]
    }
  }
}

{
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "name": "ResourceNotFound",
    "description": "The requested resource does not exist or is outside the data this key can access.",
    "resolution": "Check the ID of the resource named in details.resource and that the key owner can see it.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "RATE_LIMITED",
    "name": "RateLimited",
    "description": "Too many requests were sent in a short time.",
    "resolution": "Wait a few seconds and retry, using the same Idempotency-Key for writes.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}
{
  "error": {
    "code": "INTERNAL_ERROR",
    "name": "InternalError",
    "description": "Something went wrong on our side.",
    "resolution": "Retry later, and if it keeps happening, contact Vacation Tracker support and quote the requestId.",
    "requestId": "c6af9ac6-7b61-11e6-9a41-93e8deadbeef"
  }
}

Create a location

This API method creates a location. Requires `locations:write`. The acting user is the key owner, or the `X-On-Behalf-Of` user. It waits for the location to be created and returns it with `201`; if that takes longer than the wait window it returns `202 Accepted` with an operation to poll. - `name` and `timezone` (an IANA time zone name) are required. - `firstDayOfWeek` defaults to `1` (Monday), `resetQuotas` to `FISCAL_YEAR`, `yearStartMonth` and `yearStartDay` to `1`, `isDefault` to `false` and `userIds` to an empty array. `yearStartDay` must exist in `yearStartMonth` every year, so 29 February is rejected. - `userIds` moves those users into the new location. `isDefault: true` makes it the company's default location. - `workWeek` sets the initial work week, the same as `PUT /v2/locations/{id}/work-week` right after creation. When omitted, the work week is Monday to Friday with the default work hours. - Unknown fields and invalid values fail validation. Errors: `400 VALIDATION_ERROR` (`details.fields`), `400 INVALID_REQUEST_BODY`, `403 ON_BEHALF_OF_NOT_ALLOWED`, `403 FORBIDDEN`, `403 WORK_HOURS_LIMIT_REACHED` (`workWeek.workHours` needs a plan with custom work hours), `409 DUPLICATE_NAME` (another location already uses the name), `422 UNKNOWN_USER_IDS`, `422 PLAN_LIMIT_REACHED`, and the `Idempotency-Key` codes.

Update a location

This API method changes a location. Requires `locations:write`. The acting user is the key owner, or the `X-On-Behalf-Of` user. It waits for the change and returns the location with `200`, or `202 Accepted` with an operation to poll. Send only the fields you want to change; at least one field is required. Your changes are merged with the location's current state and members, so everything you do not send is kept: - `userIds`, when sent, **replaces the full membership**. Any user currently in this location whose ID is missing from the list is moved to the company's default location. - `isDefault: false` for the current default location fails with `409 DEFAULT_LOCATION_UNSET_FORBIDDEN`; set another location's `isDefault` to `true` instead. - `yearStartMonth` and `yearStartDay` are checked together with the current values: the day must exist in the month every year. - When brought-forward days expire is set per leave policy, not on the location (see the leave policy `broughtForwardExpiration`). Errors: `400 VALIDATION_ERROR` (`details.fields`), `400 INVALID_REQUEST_BODY`, `403 ON_BEHALF_OF_NOT_ALLOWED`, `403 FORBIDDEN`, `404 RESOURCE_NOT_FOUND` (the location does not exist or is outside the key's data reach), `409 DEFAULT_LOCATION_UNSET_FORBIDDEN`, `409 DUPLICATE_NAME`, `422 UNKNOWN_USER_IDS`, and the `Idempotency-Key` codes.