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

# Create Location

> Create a new location

export const permission_0 = 'element:create'

<Info>Requires permission: **{permission_0}**</Info>


## OpenAPI

````yaml POST /v1/location
openapi: 3.0.1
info:
  title: Variable API
  description: This is the Variable API
  version: 1.1.0
servers:
  - url: https://app.variable.global/api
security:
  - basicAuth: []
  - bearerAuth: []
  - oAuthNoScopes: []
paths:
  /v1/location:
    post:
      summary: Create a location
      description: >
        Create a named site. Anchor it to a geocoded point with `geoLocation` —
        a `{ uuid }` for an

        existing point or a `{ googleMapsId }` to resolve and persist one — or
        omit it for an

        address-only site. `ownerCompany` defaults to your company and may
        instead target an unclaimed

        supplier of yours; it is fixed at create.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewLocation'
      responses:
        '201':
          description: The created location
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Location'
        '400':
          description: >-
            Invalid request — e.g. a missing `name`, an invalid `type`, an
            unknown `geoLocation`, or an inaccessible `ownerCompany`.
        '401':
          description: ExpiredToken
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExpiredTokenResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    NewLocation:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          example: Tokyo factory
        type:
          type: string
          enum:
            - factory
            - warehouse
            - office
            - port
            - other
          example: factory
        address1:
          type: string
        address2:
          type: string
        postCode:
          type: string
        city:
          type: string
        state:
          type: string
        country:
          type: string
        ownerCompany:
          type: object
          required:
            - uuid
          description: >
            The company to own the site. Defaults to your own company; may
            instead reference an

            unclaimed supplier of yours. Returns `400` if the company is not
            accessible. Set at create

            only — it cannot be changed afterwards.
          properties:
            uuid:
              type: string
              format: uuid
        geoLocation:
          $ref: '#/components/schemas/LocationGeoLocationRef'
    Location:
      type: object
      description: >
        A named company site (factory / warehouse / office / port / other),
        optionally anchored to a

        geolocation for coordinates. Products, activities, and transport legs
        reference these internally

        as a physical origin / destination / location.
      properties:
        uuid:
          type: string
          format: uuid
        name:
          type: string
          example: Tokyo factory
        type:
          type: string
          enum:
            - factory
            - warehouse
            - office
            - port
            - other
          example: factory
        owner:
          allOf:
            - $ref: '#/components/schemas/IDAndName'
          description: >-
            The company that owns the site — your own company, or an unclaimed
            supplier you registered it for.
        address1:
          type: string
          example: 1-1 Marunouchi
        address2:
          type: string
        postCode:
          type: string
          example: 100-0005
        city:
          type: string
          example: Tokyo
        state:
          type: string
        country:
          type: string
          example: Japan
        geoLocation:
          $ref: '#/components/schemas/ApiGeoLocation'
    ExpiredTokenResponse:
      type: object
      properties:
        message:
          type: string
          example: token expired
    LocationGeoLocationRef:
      description: >
        A reference to the geolocation that anchors a site. Provide either an
        existing point's `uuid`,

        or a `googleMapsId` (resolved and persisted on your behalf, like `POST
        /v1/geolocation`).
      oneOf:
        - type: object
          required:
            - uuid
          properties:
            uuid:
              type: string
              format: uuid
        - type: object
          required:
            - googleMapsId
          properties:
            googleMapsId:
              type: string
              example: ChIJA4UGSG_xNIgRNBuiWqEV-Y0
    IDAndName:
      type: object
      properties:
        uuid:
          $ref: '#/components/schemas/UUID'
        name:
          type: string
          example: Name
    ApiGeoLocation:
      type: object
      properties:
        uuid:
          type: string
          format: uuid
          description: >-
            Present only on a persisted geolocation (the POST response); absent
            on search candidates.
        googleMapsId:
          type: string
          example: ChIJA4UGSG_xNIgRNBuiWqEV-Y0
        name:
          type: string
          description: The geocoder's formatted address.
          example: Syracuse, NY, USA
        countryCode:
          type: string
          example: US
        latitude:
          type: number
          example: 43.0481
        longitude:
          type: number
          example: -76.1474
        locationType:
          type: string
          example: APPROXIMATE
    UUID:
      type: string
      format: uuid
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    oAuthNoScopes:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /auth/token
          scopes: {}

````