
{
  "openapi": "3.1.0",
  "info": {
    "title": "Connect Locations API",
    "description": "The Connect Locations API manages organization locations and places.",
    "version": "1.0"
  },
  "servers": [
    {
      "description": "Cambrionix Connect",
      "url": "/api"
    }
  ],
  "tags": [
    {
      "name": "Organization Locations",
      "description": "Endpoints for managing organization locations."
    }
  ],
  "paths": {
    "/locations/v1/location": {
      "post": {
        "summary": "Create a new organization location.",
        "description": "Create a new organization location.",
        "tags": [
          "Organization Locations"
        ],
        "parameters": [],
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateANewOrganizationLocationRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": [
              "Organization.Locations.Write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/OrganizationLocation"
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "createANewOrganizationLocation"
      }
    },
    "/locations/v1/locations": {
      "get": {
        "summary": "Get all organization locations.",
        "description": "Get all organization locations.",
        "tags": [
          "Organization Locations"
        ],
        "parameters": [
          {
            "description": "Returns only the items that match, written as `(path::operator::value)`, such as `(name::co::Lab)`. Operators are `eq`, `co`, `sw`, `ew`, `gt` and `pr`, and the case-insensitive `ieq`, `ico`, `isw` and `iew`. Combine conditions as `((a)::and::(b))` or `((a)::or::(b))`.",
            "in": "query",
            "name": "filter",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Orders the items, written as `(path::asc)` or `(path::desc)`. Combine orders as `((a)::and::(b))`.",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The maximum number of items to return.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Returns the next page: the `_metadata.continuationToken` of the previous response.",
            "in": "query",
            "name": "token",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "Organization.Locations.Read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_metadata": {
                      "type": "object",
                      "properties": {
                        "continuationToken": {
                          "type": "string"
                        },
                        "total": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "total"
                      ],
                      "additionalProperties": false
                    },
                    "result": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/OrganizationLocation"
                      }
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getAllOrganizationLocations"
      }
    },
    "/locations/v1/locations/{locationId}": {
      "get": {
        "summary": "Get an organization location.",
        "description": "Get an organization location.",
        "tags": [
          "Organization Locations"
        ],
        "parameters": [
          {
            "name": "locationId",
            "in": "path",
            "required": true,
            "description": "Path parameter",
            "example": "00000000-0000-0000-0000-000000000000",
            "deprecated": false,
            "schema": {
              "type": "string",
              "description": "Path parameter",
              "deprecated": false,
              "example": "00000000-0000-0000-0000-000000000000",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "Organization.Locations.Read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/OrganizationLocation"
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getAnOrganizationLocation"
      },
      "patch": {
        "summary": "Update an organization location.",
        "description": "Update an organization location.",
        "tags": [
          "Organization Locations"
        ],
        "parameters": [
          {
            "name": "locationId",
            "in": "path",
            "required": true,
            "description": "Path parameter",
            "example": "00000000-0000-0000-0000-000000000000",
            "deprecated": false,
            "schema": {
              "type": "string",
              "description": "Path parameter",
              "deprecated": false,
              "example": "00000000-0000-0000-0000-000000000000",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAnOrganizationLocationRequest"
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": [
              "Organization.Locations.Write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "$ref": "#/components/schemas/OrganizationLocation"
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "updateAnOrganizationLocation"
      },
      "delete": {
        "summary": "Delete an organization location.",
        "description": "Delete an organization location.",
        "tags": [
          "Organization Locations"
        ],
        "parameters": [
          {
            "name": "locationId",
            "in": "path",
            "required": true,
            "description": "Path parameter",
            "example": "00000000-0000-0000-0000-000000000000",
            "deprecated": false,
            "schema": {
              "type": "string",
              "description": "Path parameter",
              "deprecated": false,
              "example": "00000000-0000-0000-0000-000000000000",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": [
              "Organization.Locations.Write"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteAnOrganizationLocationResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "deleteAnOrganizationLocation"
      }
    },
    "/locations/v1/version": {
      "get": {
        "summary": "Get the version of the API.",
        "description": "Get the version of the API.",
        "tags": [
          "Version"
        ],
        "parameters": [],
        "security": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTheVersionOfTheApiResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenError"
          },
          "default": {
            "$ref": "#/components/responses/Error"
          }
        },
        "operationId": "getTheVersionOfTheApi"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "bearerFormat": "JWT",
        "description": "Access token from the organization token endpoint, `POST /api/v1/organizations/{organizationId}/oauth2/token` on the Connect host, using the `client_credentials` grant with a service account.",
        "scheme": "bearer",
        "type": "http"
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ForbiddenError": {
        "description": "Forbidden: the token is valid but does not allow this request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "UnauthorizedError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnauthorizedError"
            }
          }
        }
      }
    },
    "schemas": {
      "CreateANewOrganizationLocationRequest": {
        "$ref": "#/components/schemas/OrganizationLocationPostPayload",
        "$schema": "https://json-schema.org/draft/2020-12/schema"
      },
      "DeleteAnOrganizationLocationResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "_metadata": {
            "type": "object",
            "properties": {
              "continuationToken": {
                "type": "string"
              },
              "limit": {
                "type": "number"
              },
              "total": {
                "type": "number"
              }
            },
            "additionalProperties": false,
            "description": "Metadata for paginated responses. This includes total count, limit, and continuation token.",
            "title": "Connect API Response Metadata"
          },
          "result": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          }
        },
        "required": [
          "result"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "GetTheVersionOfTheApiResponse": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "_metadata": {
            "type": "object",
            "properties": {
              "continuationToken": {
                "type": "string"
              },
              "limit": {
                "type": "number"
              },
              "total": {
                "type": "number"
              }
            },
            "additionalProperties": false,
            "description": "Metadata for paginated responses. This includes total count, limit, and continuation token.",
            "title": "Connect API Response Metadata"
          },
          "result": {
            "type": "object",
            "properties": {
              "releaseNotes": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "releaseNotes",
              "version"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "result"
        ],
        "additionalProperties": false
      },
      "OrganizationLocation": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "properties": {
              "components": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "object",
                      "properties": {
                        "long": {
                          "type": "string"
                        },
                        "short": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "long",
                        "short"
                      ],
                      "additionalProperties": false
                    },
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "premise",
                          "route",
                          "postal_town",
                          "administrative_area_level_1",
                          "administrative_area_level_2",
                          "country",
                          "postal_code",
                          "political"
                        ]
                      }
                    }
                  },
                  "required": [
                    "name",
                    "types"
                  ],
                  "additionalProperties": false
                }
              },
              "formatted": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "components",
              "formatted",
              "location"
            ],
            "additionalProperties": false
          },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
          },
          "name": {
            "type": "string"
          },
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false
          },
          "type": {
            "type": "string",
            "enum": [
              "warehouse",
              "office",
              "retail",
              "other"
            ]
          },
          "viewport": {
            "type": "object",
            "properties": {
              "northeast": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              },
              "southwest": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "northeast",
              "southwest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "address",
          "id",
          "name",
          "organization",
          "type"
        ],
        "additionalProperties": false
      },
      "OrganizationLocationPatchPayload": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "properties": {
              "components": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "object",
                      "properties": {
                        "long": {
                          "type": "string"
                        },
                        "short": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "long",
                        "short"
                      ],
                      "additionalProperties": false
                    },
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "premise",
                          "route",
                          "postal_town",
                          "administrative_area_level_1",
                          "administrative_area_level_2",
                          "country",
                          "postal_code",
                          "political"
                        ]
                      }
                    }
                  },
                  "required": [
                    "name",
                    "types"
                  ],
                  "additionalProperties": false
                }
              },
              "formatted": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "components",
              "formatted",
              "location"
            ],
            "additionalProperties": false
          },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "warehouse",
              "office",
              "retail",
              "other"
            ]
          },
          "viewport": {
            "type": "object",
            "properties": {
              "northeast": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              },
              "southwest": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "northeast",
              "southwest"
            ],
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "OrganizationLocationPostPayload": {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "type": "object",
        "properties": {
          "address": {
            "type": "object",
            "properties": {
              "components": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "object",
                      "properties": {
                        "long": {
                          "type": "string"
                        },
                        "short": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "long",
                        "short"
                      ],
                      "additionalProperties": false
                    },
                    "types": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "premise",
                          "route",
                          "postal_town",
                          "administrative_area_level_1",
                          "administrative_area_level_2",
                          "country",
                          "postal_code",
                          "political"
                        ]
                      }
                    }
                  },
                  "required": [
                    "name",
                    "types"
                  ],
                  "additionalProperties": false
                }
              },
              "formatted": {
                "type": "string"
              },
              "location": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "components",
              "formatted",
              "location"
            ],
            "additionalProperties": false
          },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "warehouse",
              "office",
              "retail",
              "other"
            ]
          },
          "viewport": {
            "type": "object",
            "properties": {
              "northeast": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              },
              "southwest": {
                "type": "object",
                "properties": {
                  "latitude": {
                    "type": "number"
                  },
                  "longitude": {
                    "type": "number"
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "northeast",
              "southwest"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "address",
          "name",
          "type"
        ],
        "additionalProperties": false
      },
      "UnauthorizedError": {
        "type": "object",
        "required": [
          "code",
          "message",
          "detail"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              401
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "Unauthorized"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "UpdateAnOrganizationLocationRequest": {
        "$ref": "#/components/schemas/OrganizationLocationPatchPayload",
        "$schema": "https://json-schema.org/draft/2020-12/schema"
      }
    }
  }
}
