{
  "openapi": "3.1.0",
  "info": {
    "title": "Reseller Developer Platform — Maps & Location",
    "version": "0.1.0",
    "description": "Unified developer platform with Communications, Data Validation & Enrichment, and Maps & Location. Only Maps & Location has local test endpoints; other families are design-only. Payments is internal billing infrastructure, not a sold API family. Default provider unavailable; explicit synthetic fixtures or configured self-hosted OSM adapter. No imported operational geography is bundled."
  },
  "x-platform-product-families": [
    {
      "id": "communications",
      "name": "Communications",
      "implementation": "planned"
    },
    {
      "id": "data-validation-enrichment",
      "name": "Data Validation & Enrichment",
      "implementation": "planned"
    },
    {
      "id": "maps-location",
      "name": "Maps & Location",
      "implementation": "local-test"
    }
  ],
  "x-billing-boundary": {
    "kind": "internal-infrastructure",
    "implementation": "usage-observation-only",
    "mode": "disabled",
    "chargesEnabled": false
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8787",
      "description": "Reserved local test address; no service currently listening is implied."
    }
  ],
  "security": [
    {
      "ProjectKey": []
    }
  ],
  "paths": {
    "/v1/projects/{projectId}/location/search": {
      "post": {
        "operationId": "locationSearch",
        "tags": [
          "Location"
        ],
        "summary": "Search within verified active regional coverage",
        "description": "Local test service: unavailable default, explicit synthetic mode, or configured self-hosted Nominatim/OSRM adapter; live data availability is not implied. Server resolves tenant/project/scopes from the credential. The path must match the authenticated project. No public upstream fallback. Region is an entitlement/coverage selector, not proof that data exists. Scope: location:search. Current single-provider responses require each record provenance to equal envelope provenance; region must equal requested region and route profile must equal requested profile. These cross-field rules require semantic validation beyond JSON Schema.",
        "x-response-invariants": [
          "record-provenance-equals-envelope",
          "region-equals-request",
          "result-count-within-request-limit"
        ],
        "security": [
          {
            "ProjectKey": []
          }
        ],
        "x-required-scope": "location:search",
        "x-product-family": "maps-location",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "UTF-8 application/json, maximum 16 KiB. Reject unknown properties and ambiguous duplicate object keys. Coordinates use WGS84 decimal degrees.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operational provider result. Synthetic examples must remain visibly labeled; empty search/reverse results are valid only from a healthy provider.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, ambiguous duplicate keys, unknown fields or invalid input. Generic messages do not echo supplied values.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked project credential.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "unauthorized"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Credential does not authorize this project, region or operation; same generic response for unknown projects.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "forbidden"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Body larger than 16 KiB.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported content type; UTF-8 application/json required.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Outside configured operational coverage; route may also return no_route.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "outside_coverage"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Project operation quota exhausted; retry delay supplied.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "Retry-After": {
                "description": "Whole seconds until retry is eligible.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "rate_limited"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure; no stack or upstream response disclosed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "internal_error"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Provider/dataset or required identity, quota or accounting dependency unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "provider_unavailable",
                                "dependency_unavailable"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{projectId}/location/reverse": {
      "post": {
        "operationId": "locationReverse",
        "tags": [
          "Location"
        ],
        "summary": "Reverse within verified active regional coverage",
        "description": "Local test service: unavailable default, explicit synthetic mode, or configured self-hosted Nominatim/OSRM adapter; live data availability is not implied. Server resolves tenant/project/scopes from the credential. The path must match the authenticated project. No public upstream fallback. Region is an entitlement/coverage selector, not proof that data exists. Scope: location:reverse. Current single-provider responses require each record provenance to equal envelope provenance; region must equal requested region and route profile must equal requested profile. These cross-field rules require semantic validation beyond JSON Schema.",
        "x-response-invariants": [
          "record-provenance-equals-envelope",
          "region-equals-request",
          "result-count-within-request-limit"
        ],
        "security": [
          {
            "ProjectKey": []
          }
        ],
        "x-required-scope": "location:reverse",
        "x-product-family": "maps-location",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "UTF-8 application/json, maximum 16 KiB. Reject unknown properties and ambiguous duplicate object keys. Coordinates use WGS84 decimal degrees.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operational provider result. Synthetic examples must remain visibly labeled; empty search/reverse results are valid only from a healthy provider.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReverseResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, ambiguous duplicate keys, unknown fields or invalid input. Generic messages do not echo supplied values.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked project credential.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "unauthorized"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Credential does not authorize this project, region or operation; same generic response for unknown projects.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "forbidden"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Body larger than 16 KiB.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported content type; UTF-8 application/json required.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Outside configured operational coverage; route may also return no_route.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "outside_coverage"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Project operation quota exhausted; retry delay supplied.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "Retry-After": {
                "description": "Whole seconds until retry is eligible.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "rate_limited"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure; no stack or upstream response disclosed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "internal_error"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Provider/dataset or required identity, quota or accounting dependency unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "provider_unavailable",
                                "dependency_unavailable"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/projects/{projectId}/location/route": {
      "post": {
        "operationId": "locationRoute",
        "tags": [
          "Location"
        ],
        "summary": "Route within verified active regional coverage",
        "description": "Local test service: unavailable default, explicit synthetic mode, or configured self-hosted Nominatim/OSRM adapter; live data availability is not implied. Server resolves tenant/project/scopes from the credential. The path must match the authenticated project. No public upstream fallback. Region is an entitlement/coverage selector, not proof that data exists. Scope: location:route. Current single-provider responses require each record provenance to equal envelope provenance; region must equal requested region and route profile must equal requested profile. These cross-field rules require semantic validation beyond JSON Schema.",
        "x-response-invariants": [
          "record-provenance-equals-envelope",
          "region-equals-request",
          "profile-equals-request"
        ],
        "security": [
          {
            "ProjectKey": []
          }
        ],
        "x-required-scope": "location:route",
        "x-product-family": "maps-location",
        "parameters": [
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "UTF-8 application/json, maximum 16 KiB. Reject unknown properties and ambiguous duplicate object keys. Coordinates use WGS84 decimal degrees.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RouteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Operational provider result. Synthetic examples must remain visibly labeled; empty search/reverse results are valid only from a healthy provider.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RouteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, ambiguous duplicate keys, unknown fields or invalid input. Generic messages do not echo supplied values.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked project credential.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "WWW-Authenticate": {
                "schema": {
                  "type": "string",
                  "const": "Bearer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "unauthorized"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Credential does not authorize this project, region or operation; same generic response for unknown projects.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "forbidden"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "413": {
            "description": "Body larger than 16 KiB.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "415": {
            "description": "Unsupported content type; UTF-8 application/json required.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "invalid_request"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Outside configured operational coverage; route may also return no_route.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "outside_coverage",
                                "no_route"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Project operation quota exhausted; retry delay supplied.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              },
              "Retry-After": {
                "description": "Whole seconds until retry is eligible.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "rate_limited"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure; no stack or upstream response disclosed.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "internal_error"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Provider/dataset or required identity, quota or accounting dependency unavailable.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "no-store"
                }
              },
              "X-Request-Id": {
                "schema": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse"
                    },
                    {
                      "properties": {
                        "error": {
                          "properties": {
                            "code": {
                              "enum": [
                                "provider_unavailable",
                                "dependency_unavailable"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ProjectKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Project-scoped high-entropy API credential; no end-user session, admin credential or client-supplied tenant claim."
      }
    },
    "schemas": {
      "Coordinate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "lat",
          "lon"
        ],
        "properties": {
          "lat": {
            "type": "number",
            "minimum": -90,
            "maximum": 90
          },
          "lon": {
            "type": "number",
            "minimum": -180,
            "maximum": 180
          }
        }
      },
      "SearchRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "query",
          "region"
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "description": "At least one non-whitespace character; trim before searching. No query echo in errors/logs."
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,39}$"
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 5
          }
        }
      },
      "ReverseRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "coordinate",
          "region"
        ],
        "properties": {
          "coordinate": {
            "$ref": "#/components/schemas/Coordinate"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,39}$"
          }
        }
      },
      "RouteRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "origin",
          "destination",
          "region",
          "profile"
        ],
        "properties": {
          "origin": {
            "$ref": "#/components/schemas/Coordinate"
          },
          "destination": {
            "$ref": "#/components/schemas/Coordinate"
          },
          "region": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{1,39}$"
          },
          "profile": {
            "type": "string",
            "enum": [
              "car",
              "bicycle",
              "pedestrian"
            ]
          }
        }
      },
      "Provenance": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "provider",
          "source",
          "datasetVersion",
          "region",
          "fixture",
          "attribution"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "owned-osm",
              "synthetic-fixture"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "openstreetmap",
              "synthetic"
            ]
          },
          "datasetVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "region": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "fixture": {
            "type": "boolean"
          },
          "attribution": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 500
            }
          }
        },
        "oneOf": [
          {
            "properties": {
              "provider": {
                "const": "owned-osm"
              },
              "source": {
                "const": "openstreetmap"
              },
              "fixture": {
                "const": false
              }
            }
          },
          {
            "properties": {
              "provider": {
                "const": "synthetic-fixture"
              },
              "source": {
                "const": "synthetic"
              },
              "fixture": {
                "const": true
              }
            }
          }
        ]
      },
      "Address": {
        "type": "object",
        "additionalProperties": false,
        "required": [],
        "properties": {
          "street": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "area": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "lga": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "town": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "state": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "country": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "postcode": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40
          },
          "lgaSource": {
            "type": "string",
            "enum": [
              "nominatim-address-county-ng"
            ]
          }
        }
      },
      "Place": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "label",
          "coordinate",
          "provenance"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "coordinate": {
            "$ref": "#/components/schemas/Coordinate"
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          }
        }
      },
      "LineString": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "coordinates"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "LineString"
          },
          "coordinates": {
            "type": "array",
            "minItems": 2,
            "maxItems": 10000,
            "items": {
              "type": "array",
              "prefixItems": [
                {
                  "type": "number",
                  "minimum": -180,
                  "maximum": 180
                },
                {
                  "type": "number",
                  "minimum": -90,
                  "maximum": 90
                }
              ],
              "minItems": 2,
              "maxItems": 2
            }
          }
        }
      },
      "ManeuverStep": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "roadName",
          "coordinate",
          "distanceMeters",
          "durationSeconds"
        ],
        "properties": {
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "modifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "roadName": {
            "type": "string",
            "maxLength": 500
          },
          "coordinate": {
            "$ref": "#/components/schemas/Coordinate"
          },
          "distanceMeters": {
            "type": "number",
            "minimum": 0
          },
          "durationSeconds": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "Route": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "geometry",
          "distanceMeters",
          "durationSeconds",
          "profile",
          "provenance"
        ],
        "properties": {
          "geometry": {
            "$ref": "#/components/schemas/LineString"
          },
          "distanceMeters": {
            "type": "number",
            "minimum": 0
          },
          "durationSeconds": {
            "type": "number",
            "minimum": 0
          },
          "profile": {
            "type": "string",
            "enum": [
              "car",
              "bicycle",
              "pedestrian"
            ]
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          },
          "steps": {
            "type": "array",
            "minItems": 2,
            "maxItems": 2000,
            "items": {
              "$ref": "#/components/schemas/ManeuverStep"
            }
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "data",
          "provenance"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/Place"
            }
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          }
        }
      },
      "ReverseResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "data",
          "provenance"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "$ref": "#/components/schemas/Place"
            }
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          }
        }
      },
      "RouteResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "data",
          "provenance"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "$ref": "#/components/schemas/Route"
          },
          "provenance": {
            "$ref": "#/components/schemas/Provenance"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "requestId",
          "error"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "unauthorized",
                  "forbidden",
                  "outside_coverage",
                  "no_route",
                  "rate_limited",
                  "provider_unavailable",
                  "dependency_unavailable",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            }
          }
        }
      }
    }
  }
}
