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

# Toggle Location Active Status

> Activate or deactivate a location



## OpenAPI

````yaml patch /v1/locations/{location}
openapi: 3.1.1
info:
  title: HitPay API
  description: >-
    Accept PayNow, FPX, QRIS, GrabPay, cards, and 40+ payment methods with a
    single API. Production base URL: https://api.hit-pay.com, Sandbox:
    https://api.sandbox.hit-pay.com
  version: '1.0'
servers:
  - url: https://api.hit-pay.com
    description: Production
  - url: https://api.sandbox.hit-pay.com
    description: Sandbox
security: []
paths:
  /v1/locations/{location}:
    patch:
      tags:
        - Location
      summary: Toggle location active status
      description: >
        Activate or deactivate a location. A location must be deactivated before
        it can be deleted.


        Deactivation is blocked if:

        - the location is the only active location, or

        - the location is set as the main or back-order location
      operationId: PublicUpdateLocationActive
      parameters:
        - name: X-BUSINESS-API-KEY
          in: header
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
        - name: location
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Location ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - active
              properties:
                active:
                  type: boolean
                  description: Set to `false` to deactivate, `true` to activate
                  example: false
            example:
              active: false
      responses:
        '200':
          description: Location active status updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Location ID
                    example: 9c484458-b2a3-4f49-87ed-ad9ea71b0df3
                  business_id:
                    type: string
                    format: uuid
                    description: Business that owns this location
                    example: 8a1f2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d
                  name:
                    type: string
                    description: Name of the location
                    example: Main Store
                  street:
                    type: string
                    description: Street address
                    example: 123 Main St
                  city:
                    type: string
                    description: City
                    example: Singapore
                  state:
                    type: string
                    description: State or region
                    example: Singapore
                  country:
                    type: string
                    description: Country code or name
                    example: SG
                  postal_code:
                    type: string
                    description: Postal code
                    example: '123456'
                  active:
                    type: boolean
                    description: Whether the location is active
                    example: true
                  pickups:
                    type: array
                    description: >-
                      Pickup configurations linked to this location (empty when
                      not loaded)
                    items:
                      type: object
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
                required:
                  - id
                  - business_id
                  - name
                  - street
                  - city
                  - state
                  - country
                  - postal_code
                  - active
        '400':
          description: Cannot deactivate — only active location
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  errors:
                    type: array
        '401':
          description: Missing or invalid API key / OAuth token
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  errors:
                    type: array
        '403':
          description: Authenticated user cannot manage locations
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  errors:
                    type: array
        '422':
          description: >-
            Validation error (e.g. main/back-order location cannot be
            deactivated)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  errors:
                    type: array

````