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

# Create locations

> Create locations



## OpenAPI

````yaml https://spec.speakeasy.com/idalia-r5y/idalia/api-documentation-with-code-samples post /locations
openapi: 3.0.0
info:
  title: API Documentation
  version: 1.0.0
  description: This is the OpenAPI specification for your project.
servers:
  - url: https://idalia.app/api
    description: Idalia API server
security: []
paths:
  /locations:
    post:
      tags:
        - Locations
      summary: Create locations
      description: Create locations
      operationId: createLocations
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LocationsCreateParams'
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationsQueryResponse'
        '400':
          $ref: '#/components/responses/400'
        '500':
          $ref: '#/components/responses/500'
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Idalia } from "idalia";

            const idalia = new Idalia({
              apiKeyAuth: process.env["IDALIA_API_KEY_AUTH"] ?? "",
            });

            async function run() {
              const result = await idalia.locations.create();

              console.log(result);
            }

            run();
components:
  schemas:
    LocationsCreateParams:
      type: array
      items:
        $ref: '#/components/schemas/CreateLocationSchema'
    LocationsQueryResponse:
      type: array
      items:
        $ref: '#/components/schemas/LocationResponse'
    CreateLocationSchema:
      type: object
      properties:
        name:
          type: string
          description: Name of the location
        latitude:
          type: number
          nullable: true
          description: Latitude of the location's coordinates
        longitude:
          type: number
          nullable: true
          description: Longitude of the location's coordinates
        address1:
          type: string
          nullable: true
          description: Address 1 of the location
        address2:
          type: string
          nullable: true
          description: Address 2 of the location
        city:
          type: string
          nullable: true
          description: City the location is in
        state:
          type: string
          nullable: true
          description: State the location is in
        postalCode:
          type: string
          nullable: true
          description: Postal code the location is in
        country:
          type: string
          nullable: true
          description: Country the location is in
        externalIds:
          type: object
          additionalProperties:
            type: string
          nullable: true
      required:
        - name
    LocationResponse:
      type: object
      properties:
        id:
          type: string
          description: ID of the location
        createdAt:
          type: string
          description: Datetime when the location was created
        updatedAt:
          type: string
          description: Datetime when the location was last updated
        workspaceId:
          type: string
          description: ID of the workspace the location belongs to
        name:
          type: string
          description: Name of the location
        latitude:
          type: number
          nullable: true
          description: Latitude of the location's coordinates
        longitude:
          type: number
          nullable: true
          description: Longitude of the location's coordinates
        address1:
          type: string
          nullable: true
          description: Address 1 of the location
        address2:
          type: string
          nullable: true
          description: Address 2 of the location
        city:
          type: string
          nullable: true
          description: City the location is in
        state:
          type: string
          nullable: true
          description: State the location is in
        postalCode:
          type: string
          nullable: true
          description: Postal code the location is in
        country:
          type: string
          nullable: true
          description: Country the location is in
        externalIds:
          type: object
          additionalProperties:
            type: string
          nullable: true
      required:
        - id
        - createdAt
        - updatedAt
        - workspaceId
        - name
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid request parameters
              code:
                type: string
                example: '400'
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: An unexpected error occurred
              code:
                type: string
                example: '500'

````