> ## 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.

# Persist a Geolocation

> Persist a chosen candidate (or a manual point) and get back its uuid.

export const permission_0 = 'element:create'

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


## OpenAPI

````yaml POST /v1/geolocation
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/geolocation:
    post:
      summary: Persist a geolocation
      description: >
        Persist a `GeoLocation` and return it with a `uuid` you can reference on
        a

        transport leg. Provide **either** `{ googleMapsId }` — a candidate
        chosen from

        `GET /v1/geolocation` — **or** a manual `{ name, latitude, longitude,
        countryCode? }`.

        A geocoded candidate keeps its `googleMapsId`; a manual point has none.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - googleMapsId
                  properties:
                    googleMapsId:
                      type: string
                      pattern: ^[A-Za-z0-9_-]{1,300}$
                      example: ChIJA4UGSG_xNIgRNBuiWqEV-Y0
                - type: object
                  required:
                    - name
                    - latitude
                    - longitude
                  properties:
                    name:
                      type: string
                      example: Syracuse, NY, USA
                    latitude:
                      type: number
                      example: 43.0481
                    longitude:
                      type: number
                      example: -76.1474
                    countryCode:
                      type: string
                      example: US
      responses:
        '201':
          description: The persisted geolocation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiGeoLocation'
        '401':
          description: ExpiredToken
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExpiredTokenResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    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
    ExpiredTokenResponse:
      type: object
      properties:
        message:
          type: string
          example: token expired
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    oAuthNoScopes:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /auth/token
          scopes: {}

````