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

# Create a location

> Creates a location. For bulk imports only; Connect creates locations for you.



## OpenAPI

````yaml energy-api/reference/flatpeak-api-spec-energy-tariffs.json POST /locations
openapi: 3.0.3
info:
  description: >-
    The tariff functions of the Flatpeak Energy API: tariff connection, prices,
    forecasts and costs. Generated from the full Energy API spec by
    scripts/build-tariff-spec.py. Do not edit.
  version: 2027-01-01.busbar
  title: 'Flatpeak Energy API: Tariffs'
  termsOfService: https://flatpeak.com/legal
  contact:
    name: Technical Support
    email: support@flatpeak.com
    url: https://flatpeak.com/contact
  license:
    name: Apache 2.0
    url: https://flatpeak.com/legal
servers:
  - url: https://energy-api.flatpeak.com
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: >-
      Exchange your account credentials for a bearer token to authenticate API
      requests.
  - name: Connect
    description: >-
      Create and retrieve Connect sessions. Connect drives the user journeys for
      tariff connection and [tariff error
      reporting](/energy-api/reference/connect/tariff/error-report). What
      happens in those journeys reaches your backend as [Connect
      webhooks](/energy-api/guides/platform/events).
  - name: Users
    description: Create, retrieve, update, delete, and list users.
  - name: Locations
    description: Create, retrieve, update, delete, and list locations.
  - name: Devices
    description: >-
      Create, retrieve, update, delete and list devices; submit and retrieve
      their state; read and write their shared settings.
  - name: Meters
    description: Submit meter records and check batch status.
  - name: Tariffs
    description: Create, retrieve, delete, and list tariffs.
  - name: Prices
    description: Retrieve and audit calculated energy prices.
  - name: Costs
    description: Calculate the monetary cost of imported or exported energy.
  - name: Optimizations
    description: >-
      Rank the connected tariff to find the best times to consume or export
      energy, as inputs to your own scheduling.
  - name: Events
    description: Retrieve and list account events.
externalDocs:
  description: Documentation
  url: https://docs.flatpeak.com
paths:
  /locations:
    parameters: []
    post:
      tags:
        - Locations
      summary: Create a location
      description: >-
        Creates a location. For bulk imports only; Connect creates locations for
        you.
      operationId: create-location
      parameters: []
      requestBody:
        $ref: '#/components/requestBodies/LocationCreate'
      responses:
        '201':
          $ref: '#/components/responses/Location'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '422':
          $ref: '#/components/responses/422'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
components:
  requestBodies:
    LocationCreate:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/LocationCreate'
      required: true
  responses:
    '400':
      description: >-
        400 Bad Request: the request was malformed or a required field is
        missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: '401 Unauthorized: authentication credentials are missing or invalid.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '403':
      description: '403 Forbidden: you do not have permission to access this resource.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '404':
      description: '404 Not Found: the requested resource does not exist.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '409':
      description: >-
        409 Conflict: the resource conflicts with existing data, for example a
        duplicate reference.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '422':
      description: >-
        422 Unprocessable Entity: the request is well-formed but cannot be
        processed, for example missing required data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '429':
      description: '429 Too Many Requests: the rate limit has been exceeded.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: >-
        500 Internal Server Error: an unexpected error occurred. Safe to retry
        with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '503':
      description: >-
        503 Service Unavailable: the service is temporarily down for
        maintenance. Retry after the indicated delay.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Location:
      description: Location response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Location'
  schemas:
    LocationCreate:
      type: object
      title: LocationEditNew
      description: A supply address.
      additionalProperties: false
      properties:
        reference_id:
          type: string
          description: Your own reference, for example an ID from your system.
          example: LOC1234567890
        user_id:
          type: string
          description: >-
            Flatpeak ID of the user this location belongs to. Every location is
            owned by a user.
          example: usr_65e421d1daa4a24082b4f590
          pattern: ^[a-z]{2,4}_[A-Za-z0-9]+$
        postal_address:
          description: Postal address of the location.
          allOf:
            - $ref: '#/components/schemas/PostalAddressCreate'
      required:
        - user_id
    Location:
      type: object
      title: Location
      description: A supply address.
      properties:
        id:
          type: string
          description: Flatpeak Location ID.
          example: loc_641b90b758fb8e6293716e40
          pattern: ^[a-z]{2,4}_[A-Za-z0-9]+$
        object:
          type: string
          description: Object type.
          example: location
          enum:
            - location
          default: location
        live_mode:
          type: boolean
          description: '`true` for live data, `false` for test data.'
        reference_id:
          type: string
          description: Your own reference, for example an ID from your system.
          example: LOC1234567890
        user_id:
          type: string
          description: >-
            Flatpeak ID of the user this location belongs to. Every location is
            owned by a user.
          example: usr_65e421d1daa4a24082b4f590
          pattern: ^[a-z]{2,4}_[A-Za-z0-9]+$
        timezone:
          type: string
          description: Timezone at the location, tz database name such as `Europe/Berlin`.
          example: Europe/London
        currency_code:
          type: string
          description: Currency at the location in ISO 4217.
          example: EUR
          pattern: ^[A-Z]{3}$
        postal_address_verified:
          type: boolean
          description: >-
            `true` when Flatpeak has verified the address and resolved its
            `timezone`, `currency_code` and `geo_location`.
        postal_address:
          description: Postal address of the location.
          allOf:
            - $ref: '#/components/schemas/PostalAddress'
        geo_location:
          description: Geographic coordinates of the location.
          allOf:
            - $ref: '#/components/schemas/GeoLocation'
        device_ids:
          type: array
          description: Flatpeak IDs of the devices at this location.
          items:
            type: string
            example: dev_63a6087272941ef077a8fd3e
        time_created:
          type: string
          description: Time when the object was created, in UTC.
          format: date-time
        account_id:
          type: string
          example: acc_661677911f2197045e6cf1b1
          description: Flatpeak Account ID.
          pattern: ^[a-z]{2,4}_[A-Za-z0-9]+$
      required:
        - id
        - object
        - live_mode
        - user_id
    Error:
      type: object
      description: Standard error envelope returned by every non-2xx response.
      required:
        - object
        - type
        - code
        - message
      properties:
        object:
          type: string
          enum:
            - error
          default: error
          description: Object type.
        type:
          type: string
          description: High-level error category.
          example: invalid_request
        code:
          type: string
          description: Machine-readable error code, safe to branch on.
          example: not_found
        message:
          type: string
          description: Human-readable description of the error.
          example: The requested resource could not be found.
        context:
          type: string
          description: Optional originating context, for example `api.price_get`.
          example: api.price_get
        live_mode:
          type: boolean
          description: Whether the error occurred against live or test data.
        time_created:
          type: string
          format: date-time
          description: Time the error was generated (RFC 3339).
          example: '2026-01-01T00:00:00Z'
    PostalAddressCreate:
      title: PostalAddressCreate
      type: object
      description: Information on the postal address.
      additionalProperties: false
      properties:
        address_line1:
          type: string
          description: Address line 1 (for example street, PO Box, or company name).
          example: 1-3
        address_line2:
          type: string
          description: Address line 2 (for example apartment, suite, unit, or building).
          example: Strand
        city:
          type: string
          description: City, district, suburb, town, or village.
          example: London
        state:
          type: string
          example: NSW
          description: >-
            State, county, province or region. For Australia, Canada and the US,
            use ISO 3166-2 codes.
        post_code:
          type: string
          description: ZIP or postal code.
          example: WC2N 5EH
        country_code:
          type: string
          description: >-
            Two-letter country code in [ISO 3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
          example: GB
          pattern: ^[A-Z]{2}$
    PostalAddress:
      title: PostalAddress
      type: object
      description: Information on the postal address.
      properties:
        address_line1:
          type: string
          description: Address line 1 (for example street, PO Box, or company name).
          example: 1-3
        address_line2:
          type: string
          description: Address line 2 (for example apartment, suite, unit, or building).
          example: Strand
        city:
          type: string
          description: City, district, suburb, town, or village.
          example: London
        state:
          type: string
          example: NSW
          description: >-
            State, county, province or region. For Australia, Canada and the US,
            use ISO 3166-2 codes.
          nullable: true
        post_code:
          type: string
          description: ZIP or postal code.
          example: WC2N 5EH
        country_code:
          type: string
          description: >-
            Two-letter country code in [ISO 3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
          example: GB
          pattern: ^[A-Z]{2}$
    GeoLocation:
      title: GeoLocation
      type: object
      description: >-
        Latitude and longitude of the location, resolved by Flatpeak from the
        `postal_address`. Used to determine market price and carbon regions.
      properties:
        lat:
          type: number
          example: 50.12345
          description: Latitude in decimal degrees.
        lng:
          type: number
          example: -1.23456
          description: Longitude in decimal degrees.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token obtained from POST /auth/tokens.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.