---
title: "Add job site rules"
method: PUT
path: "/v2/job_sites/{job_site_id}/add_rules"
tags: ["job_sites"]
---

# Add job site rules

`PUT /v2/job_sites/{job_site_id}/add_rules`

## Request

- Base URL: `https://api.hubstaff.com`
- URL: `https://api.hubstaff.com/v2/job_sites/{job_site_id}/add_rules`
- Auth: OAuth 2
  - Authorization code: `https://account.hubstaff.com/authorizations/new`
  - Token URL: `https://account.hubstaff.com/access_tokens` scopes: `hubstaff:read`, `hubstaff:write`
- TypeScript: <https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/docs/v2/job_sites/:job_site_id/add_rules/put.ts> (a function with typed inputs; its response is checked against the schema)

Adds new rules to a job site.

Returns the updated job site.

## Path parameters

- `job_site_id` integer, required

## Request body

- PutV2JobSitesJobSiteIdAddRules: Add job site rules
  - `rules` object[], required: At least one rule; each rule needs user_ids or team_ids
    - `enter_action` 'none' | 'track' | 'notify': The enter action
    - `exit_action` 'none' | 'track' | 'notify': The exit action
    - `user_ids` integer[]: List of user IDs to set for this rule. Required unless team_ids is set
    - `team_ids` integer[]: List of team IDs to set for this rule. Required unless user_ids is set
    - `start_project_id` integer: Project ID to auto start when enter_action is set to track

## Response `201`

A job site

- object
  - `job_site` JobSite: JobSite model
    - `id` integer, required: Job Site ID
    - `organization_id` integer, required: Organization ID
    - `name` string, required: Job site name
    - `status` string, required: Job site status
    - `address` string, required: Job site address
    - `latitude` string, required: Job site latitude, a decimal string
    - `longitude` string, required: Job site longitude, a decimal string
    - `radius` integer, required: Job site radius
    - `created_at` string, date-time, required: When the record was created
    - `updated_at` string, date-time, required: When the record was last updated
    - `last_visited_at` string, date-time, required: Last visit time
    - `rules` JobSiteRule[]: Job site rules
      - `id` integer, required: Job Site Rule ID
      - `enter_action` string, required: The enter action
      - `exit_action` string, required: The exit action
      - `user_ids` integer[], required: List of user IDs to set for this rule
      - `team_ids` integer[], required: List of team IDs to set for this rule
      - `start_project_id` integer: Project ID to auto start when enter_action is set to track
      - `start_task_id` integer: Task ID to auto start when enter_action is set to track

## Other responses

- `400`: Invalid parameters
- `401`: Unauthorized
- `403`: API access is only for organizations on an active plan
- `404`: Could not find record
- `429`: Rate limit exceeded

## Changes

- **2026-11-06** `c6b90e4e4bdc`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/changes/v2/job_sites/:job_site_id/add_rules/put.md)

---

[API](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api.md) - [All operations](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hubstaff/apis/hubstaff-v2-api/revisions/c6b90e4e4bdc?raw)
