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

# Create a location

> Create a location in the authorized organization. Aggregation isn't available for locations.



## OpenAPI

````yaml /en/api-reference/openapi.en-v2.json post /v2/organizations/{organization_id}/locations
openapi: 3.0.3
info:
  title: API Publica Portal
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.flexxible.net/
    description: Portal API
security:
  - bearerAuth: []
tags:
  - name: Solve
    description: Flexxible Solve ticket visibility and management
  - name: Digital activity
    description: Core process group creation by organization
  - name: Locations
    description: Location management (FWS)
  - name: Roles
    description: Role creation endpoint for organization
  - name: Users
    description: User creation endpoint for organization
  - name: Workspace groups
    description: Management endpoints for workspace groups
  - name: Networks
    description: Network management (FWS)
  - name: WiFi Networks
    description: Wi-Fi network management (FWS)
  - name: Workspaces
    description: Workspace deletion endpoint for the organization
  - name: Event logs
    description: Workspace event logs query
  - name: Installed apps
    description: Installed application detail endpoint for the organization
  - name: Authentication
    description: Session context and authentication endpoints
  - name: Microservices
    description: Details of microservices by organization
  - name: Operations
    description: Detail queries for operations by organization
  - name: Organization
    description: Organization operations
  - name: Patch policy targets
    description: Patch policy objective management endpoints
  - name: Product configurations
    description: Product configuration management endpoints
  - name: Reporting Groups
    description: Operations on reporting groups
  - name: Sessions
    description: Session detail endpoint for the organization
  - name: Tenants
    description: Tenant management endpoints
  - name: Workspace Connection Logs
    description: Workspace connection logs query
  - name: Workspace GPO
    description: Query GPOs applied to a session
  - name: Workspace Notifications
    description: Workspace notifications query
paths:
  /v2/organizations/{organization_id}/locations:
    post:
      tags:
        - Locations
      summary: Create a location
      description: >-
        Create a location in the authorized organization. Aggregation isn't
        available for locations.
      operationId: createLocation
      parameters:
        - name: organization_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{24}$
            minLength: 24
            maxLength: 24
          description: Organization identifier.
          example: 507f1f77bcf86cd799439011
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLocationRequestV2'
            examples:
              create_with_address:
                summary: Create location with address
                value:
                  name: HQ
                  address: Calle Ejemplo 1
                  latitude: 41.3874
                  longitude: 2.1686
              create_without_address:
                summary: Create location without address
                value:
                  name: Warehouse
                  latitude: 40.4168
                  longitude: -3.7038
      responses:
        '201':
          description: Location created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationItemV2'
              examples:
                created:
                  summary: Resource created
                  value:
                    id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    name: HQ
                    address: Calle Ejemplo 1
                    latitude: 41.3874
                    longitude: 2.1686
                    organization_id: 507f1f77bcf86cd799439011
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_body:
                  summary: Invalid request body
                  value:
                    error:
                      message: Cuerpo de solicitud inválido
                      code: bad_request
                      details: >-
                        name, latitude y longitude son obligatorios y deben
                        cumplir el formato esperado.
        '401':
          description: Not authorized or without access to the organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            SWSTenant unresolved for the organization, or resource not found
            post creation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateLocationRequestV2:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: Location name.
        address:
          type: string
          nullable: true
          maxLength: 500
          description: Location address.
        latitude:
          type: number
          minimum: -90
          maximum: 90
          description: Location latitude.
        longitude:
          type: number
          minimum: -180
          maximum: 180
          description: Location longitude.
      required:
        - name
        - latitude
        - longitude
      description: Location creation body.
    LocationItemV2:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Location Id (FWS Location.Oid).
        name:
          type: string
          nullable: true
          description: Location name.
        address:
          type: string
          nullable: true
          description: Location address.
        latitude:
          type: number
          nullable: true
          description: Location latitude.
        longitude:
          type: number
          nullable: true
          description: Location longitude.
        organization_id:
          type: string
          nullable: true
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Associated Portal organization Id.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````