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

# Create Location

> Creates a new location.

<Note>
  The `location`, `address`, `city`, `zip`, and `timezone_id` fields are required. All other fields are optional.
</Note>

<Tip>
  Use the `default_areas` field to associate areas with the location at creation time. Area IDs can be retrieved from the [Get Areas](/api-reference/v01.12.00/areas/get-areas) endpoint.
</Tip>


## OpenAPI

````yaml api-reference/v01.12.00/openapi-v01.12.00.json POST /locations
openapi: 3.0.0
info:
  title: Roosted
  version: 0.1.12
  contact:
    name: Support
    url: https://support.roostedhr.com/support/home
    email: support@roostedhr.com
  description: |-
    Enterprise API

    Sandbox keys and Production keys are requested from support
servers:
  - url: https://api.roostedhr.com/api/1_12
  - url: https://sandbox.roostedhr.com/api/1_12
security:
  - X-API-KEY: []
tags:
  - name: Announcements
  - name: Areas
  - name: Clients
  - name: Company
  - name: Configuration
  - name: Events
  - name: Locations
  - name: Payroll Groups
  - name: Rate Cards
  - name: Shifts
  - name: Skillsets
  - name: Time Tracking
  - name: Wage Rules
  - name: Workers
paths:
  /locations:
    post:
      tags:
        - Locations
      summary: Create Location
      description: Creates a new location.
      operationId: post-location
      requestBody:
        description: Location details
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LocationCreateRequest'
            examples:
              Create location:
                value:
                  location: Henry Park
                  address: 1325 S Ellis St, Wichita, KS 67211, USA
                  city: Wichita
                  zip: '67211'
                  color: '#DC136C'
                  location_comments: ''
                  timezone_id: 4
                  default_clients_id: hAjwQ
                  default_areas: []
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Location'
              examples:
                Created location:
                  value:
                    id: '78590'
                    location: Henry Park
                    addy_street_number: 1325 S Ellis St, Wichita, KS 67211, USA
                    addy_city: Wichita
                    addy_zip: '67211'
                    location_comments: null
                    default: null
                    saved: 1
                    color: '#DC136C'
                    timezone:
                      id: 4
                      name: America/Denver
                      offset: '-07:00'
                    companies_payroll_rulesets_id: null
                    payroll_rule_display: null
                    latitude: '37.669422'
                    longitude: '-97.320435'
                    default_clients_id: hAjwQ
                    default_areas: []
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Location name is required:
                  value:
                    code: LOC-100
                    error: Location name is required
                Address is required:
                  value:
                    code: LOC-200
                    error: Address is required
                City is required:
                  value:
                    code: LOC-300
                    error: City is required
                ZIP code is required:
                  value:
                    code: LOC-400
                    error: ZIP code is required
                Timezone is required:
                  value:
                    code: LOC-500
                    error: Timezone is required
                Invalid timezone ID:
                  value:
                    code: LOC-600
                    error: Invalid timezone ID
                Invalid client ID:
                  value:
                    code: LOC-700
                    error: Invalid client ID
                Invalid area ID:
                  value:
                    code: LOC-800
                    error: Invalid area ID
                Invalid color format:
                  value:
                    code: LOC-900
                    error: Invalid color format
                Location name exceeds maximum length:
                  value:
                    code: LOC-1000
                    error: Location name exceeds maximum length
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Invalid or missing API key:
                  value:
                    code: ATH-100
                    error: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Insufficient permissions to manage locations:
                  value:
                    code: LOC-1200
                    error: Insufficient permissions to manage locations
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                Location not found:
                  value:
                    code: LOC-1100
                    error: Location not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: Machine-readable error code.
                  error:
                    type: string
                    description: Human-readable error message.
              examples:
                An unexpected error occurred:
                  value:
                    code: LOC-1300
                    error: An unexpected error occurred
components:
  schemas:
    LocationCreateRequest:
      title: LocationCreateRequest
      type: object
      properties:
        location:
          type: string
          minLength: 1
          maxLength: 150
          description: Location name
        address:
          type: string
          minLength: 1
          maxLength: 150
          description: Street address
        city:
          type: string
          minLength: 1
          maxLength: 75
          description: City
        zip:
          type: string
          minLength: 1
          maxLength: 10
          description: ZIP/postal code
        color:
          type: string
          maxLength: 7
          description: Hex color code
        location_comments:
          type: string
          maxLength: 65535
          description: Additional comments
        timezone_id:
          type: integer
          maximum: 999
          description: Timezone identifier
        default_clients_id:
          type: string
          maxLength: 5
          description: Default client hashed ID
        default_areas:
          type: array
          description: Default area IDs
          items:
            type: string
      required:
        - location
        - address
        - city
        - zip
        - timezone_id
    Location:
      title: Location
      type: object
      properties:
        id:
          type: string
          description: Location identifier
        location:
          type: string
          description: Location name
        addy_street_number:
          type: string
          description: Street address
        addy_city:
          type: string
          description: City
        addy_zip:
          type: string
          description: ZIP/postal code
        location_comments:
          type: string
          nullable: true
          description: Additional comments
        default:
          type: integer
          nullable: true
          minimum: 0
          maximum: 1
          description: Whether this is the default location (0 or 1)
        saved:
          type: integer
          nullable: true
          minimum: 0
          maximum: 1
          description: Whether the location is saved (0 or 1)
        color:
          type: string
          nullable: true
          description: Hex color code
          example: '#DC136C'
        timezone:
          type: object
          description: Location timezone
          properties:
            id:
              type: integer
              nullable: true
              description: Timezone identifier
            name:
              type: string
              nullable: true
              description: Timezone name
            offset:
              type: string
              nullable: true
              description: UTC offset
        companies_payroll_rulesets_id:
          type: string
          nullable: true
          description: Associated payroll ruleset ID
        payroll_rule_display:
          type: string
          nullable: true
          description: Payroll rule display name
        latitude:
          type: string
          nullable: true
          description: GPS latitude coordinate
        longitude:
          type: string
          nullable: true
          description: GPS longitude coordinate
        default_clients_id:
          type: string
          nullable: true
          description: Default client hashed ID
        default_areas:
          type: array
          description: Default area IDs
          items:
            type: string
  securitySchemes:
    X-API-KEY:
      name: X-API-KEY
      type: apiKey
      in: header

````