openapi: 3.1.0
info:
  title: QRoadScan Multimodal API
  version: 2.2.0
  description: Private multimodal garage, scene scans, visual road proposals and advisory aircraft briefings.
    Scoped Bearer keys, operation status, signed report pagination, request IDs and problem responses.
    Aircraft is not ATC or collision avoidance.
servers:
- url: https://ride.qroadscan.com
paths:
  /api/v1/scans:
    post:
      summary: Run and store one road-risk scan
      security:
      - ApiKey: []
      parameters:
      - in: header
        name: Idempotency-Key
        required: true
        schema:
          type: string
          minLength: 16
          maxLength: 128
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanRequest'
      responses:
        '200':
          description: Completed scan, including an idempotent replay
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanResponse'
          headers:
            X-Request-ID: &id001
              description: Server-generated correlation ID
              schema: &id008
                type: string
                format: uuid
            RateLimit-Limit: &id002
              description: Applicable request budget
              schema:
                type: integer
            RateLimit-Remaining: &id003
              description: Remaining requests in reported window
              schema:
                type: integer
            RateLimit-Reset: &id004
              description: Window reset epoch seconds
              schema: &id009
                type: integer
                format: int64
        '400':
          description: Invalid JSON or scan fields
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '402':
          description: No API credits remain
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '409':
          description: The same request is still running or previously failed
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '413':
          description: Request body exceeds 32 KiB
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '415':
          description: Content-Type must be application/json
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '503':
          description: Scan provider unavailable; a reserved credit is refunded
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: scans:write
  /api/v1/account:
    get:
      summary: Read the authenticated API account and credit balance
      security:
      - ApiKey: []
      responses:
        '200':
          description: Paid balance and separate, capped browser/API trial allowances. These totals overlap; do not add them.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountSummary'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: account:read
  /api/v1/garage/vehicles:
    get:
      summary: List your private garage and active vehicle
      security:
      - ApiKey: []
      responses:
        '200':
          description: Vehicle profiles and active_vehicle_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GarageCollection'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:read
    post:
      summary: Create an encrypted vehicle profile (maximum 20 active vehicles)
      security:
      - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GarageVehicle'
      responses:
        '201':
          description: Saved vehicle with id and optimistic version
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:write
  /api/v1/garage/active:
    put:
      summary: Set active garage vehicle (null clears selection)
      security:
      - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - vehicle_id
              properties:
                vehicle_id:
                  type:
                  - string
                  - 'null'
      responses:
        '200':
          description: Active selection saved
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:write
  /api/v1/garage/vehicles/{vehicle_id}:
    parameters:
    - in: path
      name: vehicle_id
      required: true
      schema:
        type: string
        format: uuid
    get:
      summary: Read an owned vehicle
      security:
      - ApiKey: []
      responses:
        '200':
          description: Vehicle profile and version
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GarageVehicleResponse'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '404':
          description: Vehicle missing or not owned by this API key's account
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:read
    put:
      summary: Replace a vehicle using its current version; clears illustration when appearance changes
      security:
      - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/GarageVehicle'
              - type: object
                required:
                - version
                properties:
                  version:
                    type: integer
      responses:
        '200':
          description: Updated vehicle
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '409':
          description: Version conflict; reload before saving
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:write
    delete:
      summary: Delete an owned vehicle and schedule its encrypted illustration for removal
      security:
      - ApiKey: []
      responses:
        '200':
          description: Vehicle deleted
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:write
  /api/v1/garage/vehicles/{vehicle_id}/image:
    parameters:
    - in: path
      name: vehicle_id
      required: true
      schema:
        type: string
        format: uuid
    get:
      summary: Retrieve owned private PNG illustration
      security:
      - ApiKey: []
      responses:
        '200':
          description: Decrypted PNG with no-store cache policy
          content:
            image/png:
              schema:
                type: string
                format: binary
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '404':
          description: No current unexpired illustration
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: images:read
    post:
      summary: Generate GPT Image 2 illustration, gated by input/output PHF, costing one scan credit
      description: At most 2 attempts/account/day and 10 attempts globally/day. Requests are idempotent.
        Failures refund the reserved credit. Images expire after 90 days. Browser equivalent requires
        recent verification and CSRF; API keys authenticate directly.
      security:
      - ApiKey: []
      parameters:
      - in: header
        name: Idempotency-Key
        required: true
        schema:
          type: string
          pattern: ^[A-Za-z0-9_-]{16,100}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              maxProperties: 0
      responses:
        '201':
          description: Model metadata
          PHF results and private browser image_url; use this v1 path with your key to download: null
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '200':
          description: Idempotent replay without another generation or debit
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '402':
          description: Insufficient existing scan credits
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '422':
          description: PHF blocked request or output; credit refunded
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '503':
          description: Filtering or generation unavailable; credit refunded
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: images:write
  /api/v1/garage/vehicles/{vehicle_id}/guidance:
    parameters:
    - in: path
      name: vehicle_id
      required: true
      schema:
        type: string
        format: uuid
    post:
      summary: Read mode-specific advisory checklist and optional area weather
      security:
      - ApiKey: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                location:
                  type: object
                  properties:
                    latitude:
                      type: number
                    longitude:
                      type: number
      responses:
        '200':
          description: Vehicle scope, structured navigation profile, checklist and optional weather; no train movement authority.
          content:
            application/json:
              schema:
                type: object
                properties:
                  navigation_profile:
                    $ref: '#/components/schemas/VehicleNavigationProfile'
                  checklist:
                    type: array
                    items:
                      type: string
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:read
  /api/v1/aviation/config:
    get:
      summary: Providers, quotas and advisory scope (no secrets)
      security:
      - ApiKey: []
      responses:
        '200':
          description: OpenSky OAuth status and weather/AI configuration
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: aviation:read
  /api/v1/aviation/snapshot:
    post:
      summary: Aircraft briefing snapshot with OpenSky traffic, AWC METAR/TAF, winds aloft and fuel scenario
      description: Briefing only, not ATC, TCAS, approved routing or a go/no-go decision. Codes and coordinates
        are user supplied. Coverage and timestamps must be checked. Maximum 60 requests/account/hour;
        anonymous OpenSky global budget is 240 upstream requests/day with short shared caching.
      security:
      - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AircraftBriefingRequest'
      responses:
        '200':
          description: Independent provider statuses
          timestamped observations/forecasts: null
          bounded traffic and fuel assumptions: null
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: aviation:read
  /api/v1/aviation/briefing:
    post:
      summary: Refresh aircraft evidence, modeled caution report and hypothetical traffic scenarios
      description: Same inputs as snapshot. Up to 4 requests/account/day and 20 globally/day; no scan
        credit charged. Returns snapshot plus briefing.risk_review (four categories with nullable 0–100 caution indices), simulation_summary, synthetic_tracks (1–6 fictional tracks, 0–15 minute offsets) and explicit provenance. Hypothetical tracks are not observed or predicted actual flights. Traffic uses OpenSky with adsb.lol fallback; stale/missing traffic and incomplete fuel remain unscored. Does not generate ATC clearances or maneuver instructions.
      security:
      - ApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AircraftBriefingRequest'
      responses:
        '200':
          description: Snapshot plus advisory evidence review
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: aviation:review
  /api/v1/capabilities:
    get:
      summary: Discover supported features, quotas and scopes
      security: &id005
      - ApiKey: []
      responses:
        '200':
          description: JSON result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Capabilities'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
  /api/v1/key:
    get:
      summary: Inspect the current key without exposing its secret
      security: *id005
      responses:
        '200':
          description: JSON result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KeyInfo'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
  /api/v1/reports:
    get:
      summary: List owned reports with signed cursor pagination
      security: *id005
      responses:
        '200':
          description: data array, pagination {limit,has_more,next_cursor}, meta {request_id}. Cursors
            are owner-bound and expire after one hour.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportPage'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: scans:read
      parameters:
      - in: query
        name: limit
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 20
      - in: query
        name: cursor
        schema:
          type: string
          maxLength: 600
  /api/v1/reports/{report_id}:
    parameters:
    - in: path
      name: report_id
      required: true
      schema:
        type: integer
        minimum: 1
    get:
      summary: Read an owned completed report within retention
      security: *id005
      responses:
        '200':
          description: JSON result
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: scans:read
  /api/v1/operations/{operation_id}:
    parameters:
    - in: path
      name: operation_id
      required: true
      schema:
        type: string
        format: uuid
    get:
      summary: Inspect owned metered operation state
      security: *id005
      responses:
        '200':
          description: operation_id, kind, status (reserved/completed/refunded), credit state, optional
            resource URL and polling delay. No model percentage or flight authority.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OperationStatus'
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: operations:read
  /api/v1/garage/vehicles/{vehicle_id}/marker:
    parameters:
    - in: path
      name: vehicle_id
      required: true
      schema:
        type: string
        format: uuid
    get:
      summary: Retrieve a free transparent type/color SVG map marker
      security: *id005
      responses:
        '200':
          description: Authenticated no-store image/svg+xml, not a generated studio portrait.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: garage:read
  /api/v1/route/geocode:
    post:
      summary: Search candidates with precision and source metadata
      security: *id005
      responses:
        '200':
          description: JSON result
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: routes:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - query
              properties:
                query:
                  type: string
                  minLength: 3
                  maxLength: 200
  /api/v1/route/atlas:
    post:
      summary: Preview automatic endpoint/corridor imagery metadata without model credit
      security: *id005
      responses:
        '200':
          description: JSON result
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: routes:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - start
              - destination
              - mode
              properties:
                start: &id006
                  $ref: '#/components/schemas/BriefingCoordinate'
                destination: *id006
                mode: &id007
                  type: string
                  enum:
                  - driving
                  - walking
  /api/v1/route/analyze:
    post:
      summary: Analyze real georeferenced map imagery into an unverified road proposal
      security: *id005
      responses:
        '200':
          description: Proposal with operation_id/report_id, or needs_context with credit returned. New approved mapped proposals include numeric NAZA-inspired modeled section indices with explicit score_basis. Aircraft/train rejected.
          content:
            application/json:
              schema:
                type: object
                properties:
                  risk_scoring:
                    type: object
                    properties:
                      version:
                        type: string
                        example: naza-inspired-llm-v1
                      probability:
                        type: boolean
                        const: false
                  segments:
                    type: array
                    items:
                      type: object
                      properties:
                        risk_score:
                          type: integer
                          minimum: 0
                          maximum: 100
                        score_basis:
                          type: string
                          enum: [weather_estimate, map_context, illustrative_baseline]
                        name_provenance:
                          type: string
                          enum: [IMPORTED, DERIVED_FROM_MAPPED_LABEL, UNKNOWN]
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
        '401':
          description: Missing/invalid/expired key. application/problem+json.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '403':
          description: Insufficient scope; required_scope in problem response.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        '429':
          description: Rate limit or feature budget; inspect Retry-After.
          headers:
            X-Request-ID: *id001
            RateLimit-Limit: *id002
            RateLimit-Remaining: *id003
            RateLimit-Reset: *id004
            Retry-After:
              description: Seconds before retry
              schema:
                type: integer
                minimum: 1
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
        default:
          description: Structured problem response
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ApiProblem'
      x-required-scope: routes:write
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - start
              - destination
              - mode
              - notes
              - map
              - context_images
              properties:
                start: *id006
                destination: *id006
                mode: *id007
                vehicle_id:
                  type: string
                  format: uuid
                objective:
                  type: string
                  enum: [balanced, fastest, simplest, caution, fuel]
                  default: balanced
                  description: Proposal objective; scoring remains independent. Each completed proposal uses one scan credit.
                notes:
                  type: string
                  maxLength: 1200
                context_images:
                  type: array
                  maxItems: 2
                  items:
                    type: string
                    maxLength: 1500000
                map:
                  type: object
                  required:
                  - image
                  - width
                  - height
                  - bounds
                  properties:
                    image:
                      type: string
                      description: Real PNG/JPEG data URI; header/dimensions validated.
                      maxLength: 1500000
                    width:
                      type: integer
                      minimum: 200
                      maximum: 1400
                    height:
                      type: integer
                      minimum: 200
                      maximum: 1400
                    bounds:
                      type: object
                      required:
                      - north
                      - south
                      - east
                      - west
                      properties:
                        north:
                          type: number
                        south:
                          type: number
                        east:
                          type: number
                        west:
                          type: number
      parameters:
      - in: header
        name: Idempotency-Key
        required: true
        schema:
          type: string
          minLength: 16
          maxLength: 128
  /api/v1/routes:
    post:
      summary: Create one mapped route and modeled section-risk review from endpoints
      description: The server captures the overview, endpoint and corridor imagery and available weather. No map upload required. A proposal requires mapped geometry alignment; it is not verified navigation. Counts as one route attempt under existing free/paid limits.
      security: *id005
      x-required-scope: routes:write
      parameters:
      - in: header
        name: Idempotency-Key
        required: true
        schema:
          type: string
          minLength: 16
          maxLength: 128
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]+$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EndpointRouteRequest'
      responses:
        '200':
          description: A mapped proposal with GeoJSON, instructions and modeled caution, or needs_context with empty geometry and null route score. Failed free attempts still count; paid-credit refunds retain existing rules.
          headers:
            X-Request-ID: *id001
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndpointRouteResponse'
        '400':
          description: Invalid endpoints, unsupported area or span over 90 km; rejected before admission.
        '401':
          description: Missing, revoked or expired API key.
        '402':
          description: No eligible API trial allowance or paid credits.
        '403':
          description: routes:write permission required.
        '409':
          description: Operation pending, failed, or conflicting idempotency key. Recover the existing operation.
        '429':
          description: Request rate or feature quota exhausted. Respect Retry-After.
        '503':
          description: New work paused, route feature disabled, or imagery/model provider unavailable. Inspect safe diagnostics before retrying.
components:
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: qrs_live
  schemas:
    EndpointCoordinate:
      type: object
      additionalProperties: false
      required:
      - latitude
      - longitude
      properties:
        latitude:
          type: number
          minimum: -84.8
          maximum: 84.8
        longitude:
          type: number
          minimum: -180
          maximum: 180
    EndpointRouteRequest:
      type: object
      additionalProperties: false
      required:
      - start
      - destination
      properties:
        start:
          $ref: '#/components/schemas/EndpointCoordinate'
        destination:
          $ref: '#/components/schemas/EndpointCoordinate'
        mode:
          type: string
          enum:
          - driving
          - walking
          default: driving
        objective:
          type: string
          enum:
          - balanced
          - fastest
          - simplest
          - caution
          - fuel
          default: balanced
        notes:
          type: string
          maxLength: 1200
          default: ''
        vehicle_id:
          type: string
          format: uuid
    EndpointRouteResponse:
      type: object
      required:
      - status
      - operation_id
      - route_geojson
      - steps
      - risk_summary
      - endpoint_inspections
      - navigation_verified
      properties:
        status:
          type: string
          enum:
          - proposal
          - needs_context
        operation_id:
          type: string
          format: uuid
        report_id:
          type:
          - integer
          - 'null'
        summary:
          type: string
        navigation_verified:
          const: false
        route_geojson:
          type: object
          properties:
            type:
              const: FeatureCollection
            features:
              type: array
              items:
                type: object
                properties:
                  type:
                    const: Feature
                  geometry:
                    type: object
                    required:
                    - type
                    - coordinates
                    properties:
                      type:
                        const: LineString
                      coordinates:
                        type: array
                        minItems: 2
                        items:
                          type: array
                          minItems: 2
                          maxItems: 2
                          items:
                            type: number
                        description: GeoJSON coordinate order is longitude, latitude.
                  properties:
                    type: object
                    properties:
                      section_id:
                        type: integer
                      street:
                        type: string
                      instruction:
                        type: string
                      distance_m:
                        type: integer
                        minimum: 0
                      risk_score:
                        type:
                        - integer
                        - 'null'
                        minimum: 0
                        maximum: 100
                      score_basis:
                        type: string
                        description: weather_estimate, map_context, illustrative_baseline
                          or unknown
                      risk_reason:
                        type: string
                      name_provenance:
                        type: string
                      geometry_provenance:
                        type: string
        steps:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              section_id:
                type: integer
              street:
                type: string
              instruction:
                type: string
              distance_m:
                type: integer
                minimum: 0
              risk_score:
                type:
                - integer
                - 'null'
                minimum: 0
                maximum: 100
              score_basis:
                type: string
                description: weather_estimate, map_context, illustrative_baseline or unknown
              risk_reason:
                type: string
              name_provenance:
                type: string
              geometry_provenance:
                type: string
        risk_summary:
          type: object
          properties:
            unit:
              const: modeled_caution_index_0_100
            probability:
              const: false
            distance_weighted_score:
              type:
              - integer
              - 'null'
              minimum: 0
              maximum: 100
            peak_score:
              type:
              - integer
              - 'null'
              minimum: 0
              maximum: 100
            scored_distance_fraction:
              type: number
              minimum: 0
              maximum: 1
            illustrative_baseline_distance_fraction:
              type: number
              minimum: 0
              maximum: 1
            section_count:
              type: integer
              minimum: 0
            unknown_section_count:
              type: integer
              minimum: 0
            live_traffic_available:
              const: false
        endpoint_inspections:
          type: object
          properties:
            start:
              type: object
              properties:
                coordinates:
                  $ref: '#/components/schemas/EndpointCoordinate'
                mapped_offset_m:
                  type:
                  - number
                  - 'null'
                adjacent_section_id:
                  type:
                  - integer
                  - 'null'
                adjacent_section_risk_score:
                  type:
                  - integer
                  - 'null'
                  minimum: 0
                  maximum: 100
                access_verified:
                  const: false
                imagery_ids:
                  type: array
                  items:
                    type: string
            destination:
              type: object
              properties:
                coordinates:
                  $ref: '#/components/schemas/EndpointCoordinate'
                mapped_offset_m:
                  type:
                  - number
                  - 'null'
                adjacent_section_id:
                  type:
                  - integer
                  - 'null'
                adjacent_section_risk_score:
                  type:
                  - integer
                  - 'null'
                  minimum: 0
                  maximum: 100
                access_verified:
                  const: false
                imagery_ids:
                  type: array
                  items:
                    type: string
            guidance:
              type: array
              items:
                type: string
        route_metrics:
          type:
          - object
          - 'null'
          description: Distance, road-class time and fuel scenarios; not measured traffic,
            posted speeds or certified fuel planning.
        weather:
          type: array
          items:
            type: object
        imagery_manifest:
          type: array
          items:
            type: object
          description: Image metadata only. Raw image bytes are not retained in the report.
    AccountSummary:
      type: object
      required: [plan, status, api_credits, paid_credits, browser_scan_credits, free_allowance]
      properties:
        plan:
          type: string
          enum: [free, pro]
        status:
          type: string
        api_credits:
          type: integer
          minimum: 0
          description: Paid credits plus currently eligible API trial attempts.
        paid_credits:
          type: integer
          minimum: 0
        browser_scan_credits:
          type: integer
          minimum: 0
          description: Paid credits plus currently eligible browser attempts. Overlaps api_credits.
        free_allowance:
          $ref: '#/components/schemas/FreeAllowance'
    FreeAllowance:
      type: object
      description: Free scene/route attempts only. Failures count. Shared ceilings can reduce individual availability. Not a dollar spending cap.
      required: [enabled, reset_timezone, browser_remaining, api_trial_remaining, shared_remaining, failed_attempts_count]
      properties:
        enabled:
          type: boolean
        day:
          type: [string, 'null']
          description: Current UTC date.
        reset_timezone:
          type: string
          const: UTC
        browser_daily_limit:
          type: integer
          maximum: 5
        browser_remaining:
          type: integer
          minimum: 0
        api_trial_limit:
          type: integer
          maximum: 3
        api_trial_remaining:
          type: integer
          minimum: 0
        shared_daily_limit:
          type: integer
          maximum: 50
        shared_monthly_limit:
          type: integer
          maximum: 500
        shared_remaining:
          type: integer
          minimum: 0
        failed_attempts_count:
          type: boolean
          const: true
    GarageVehicle:
      type: object
      required:
      - name
      - kind
      description: Typed mode-specific specs are validated server-side. Optional fields default to empty;
        unsupported fields are rejected. PUT also requires current version.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 60
        kind:
          type: string
          enum:
          - car
          - motorcycle
          - truck
          - train
          - aircraft
        make:
          type: string
          maxLength: 60
        model:
          type: string
          maxLength: 60
        year:
          type:
          - integer
          - 'null'
          minimum: 1880
        color:
          type: string
          maxLength: 40
        theme:
          type: string
          enum:
          - none
          - winter
          - halloween
          - autumn
          - festive
          - lunar_new_year
        appearance_notes:
          type: string
          maxLength: 400
        specs:
          type: object
          description: 'car: mass_kg,height_m,width_m,length_m,towing,trailer_length_m,fuel_economy_mpg;
            motorcycle: engine_cc,mass_kg,abs,fuel_economy_mpg; truck: configuration,height_m,width_m,length_m,trailer_length_m,mass_kg,axles,hazmat,fuel_economy_mpg,wheelbase_m,kingpin_to_axle_m,fifth_wheel_offset_m,turn_radius_m;
            train: length_m,mass_kg,rail_gauge_mm,traction; aircraft: airframe,rotor_diameter_m,true_airspeed_kt,fuel_burn_per_hour,fuel_capacity,fuel_unit,reserve_minutes,icao24,type_designator.
            configuration is rigid or articulated; airframe is fixed_wing or helicopter.
            towing,abs,hazmat are booleans; omitted values remain unknown. Total truck length and mass describe the loaded combination.
            All numeric values must be finite and positive, except reserve_minutes may be zero and fifth_wheel_offset_m is signed and may be zero. fuel_economy_mpg uses US gallons. turn_radius_m is a user-supplied circular scenario front-axle-center radius, not a measured road turn radius. Fuel units:
            gal,l,kg. icao24 is six hex characters.'
    VehicleNavigationProfile:
      type: object
      description: Vehicle-specific review context; specifications are user supplied, not independently verified restrictions or performance data.
      properties:
        version:
          type: integer
          const: 1
        kind:
          type: string
        label:
          type: string
        specifications:
          type: object
        focus:
          type: array
          items:
            type: string
        missing_profile_fields:
          type: array
          items:
            type: string
        specification_source:
          type: string
          const: USER_SUPPLIED
        geometry_policy:
          type: string
        instruction_style:
          type: string
    AircraftBriefingRequest:
      type: object
      additionalProperties: false
      required:
      - vehicle_id
      - start
      - destination
      - departure_airport
      - arrival_airport
      - altitude_ft
      - usable_fuel
      properties:
        vehicle_id:
          type: string
          format: uuid
        start:
          $ref: '#/components/schemas/BriefingCoordinate'
        destination:
          $ref: '#/components/schemas/BriefingCoordinate'
        departure_airport:
          type: string
          pattern: ^[A-Z0-9]{3,4}$
        arrival_airport:
          type: string
          pattern: ^[A-Z0-9]{3,4}$
        altitude_ft:
          type: number
          minimum: 0
          maximum: 45000
        usable_fuel:
          type:
          - number
          - 'null'
          minimum: 0
          maximum: 1000000
    BriefingCoordinate:
      type: object
      additionalProperties: false
      required:
      - latitude
      - longitude
      properties:
        latitude:
          type: number
          minimum: -85
          maximum: 85
        longitude:
          type: number
          minimum: -180
          maximum: 180
    ScanRequest:
      type: object
      additionalProperties: false
      required:
      - latitude
      - longitude
      - vehicle_type
      - destination
      properties:
        latitude:
          type: number
          minimum: -90
          maximum: 90
        longitude:
          type: number
          minimum: -180
          maximum: 180
        vehicle_type:
          type: string
          minLength: 1
          maxLength: 64
        destination:
          type: string
          minLength: 1
          maxLength: 256
        model:
          type: string
          enum:
          - llama_local
          - openai
          default: openai
          description: OpenAI is the production default. llama_local is unavailable unless explicitly enabled by the operator.
        language:
          type: string
          enum:
          - en
          default: en
        road_type:
          type: string
          maxLength: 96
        weather:
          type: string
          maxLength: 96
        traffic:
          type: string
          maxLength: 96
        obstacles:
          type: string
          maxLength: 512
        sensor_notes:
          type: string
          maxLength: 1000
    ScanResponse:
      type: object
      required:
      - result
      - harm_level
      - model_used
      - report_id
      properties:
        result:
          type: string
        harm_level:
          type: string
        language:
          type: string
        model_used:
          type: string
        report_id:
          type: integer
    ApiProblem:
      type: object
      required:
      - type
      - title
      - status
      - code
      - request_id
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        code:
          type: string
        error:
          type: string
        detail:
          type: string
        request_id:
          type: string
          format: uuid
        required_scope:
          type: string
    KeyInfo:
      type: object
      required:
      - id
      - scopes
      - expires_at
      - request_id
      properties:
        id: *id008
        scopes:
          type: array
          items:
            type: string
        expires_at:
          type:
          - integer
          - 'null'
          format: int64
        request_id: *id008
    Capabilities:
      type: object
      required:
      - api_version
      - authentication
      - key_scopes
      - features
      - quotas
      - request_id
      properties:
        api_version:
          type: string
          example: '2.1'
        authentication:
          type: string
          enum:
          - Bearer
        key_scopes:
          type: array
          items:
            type: string
        features:
          type: array
          items:
            type: string
        quotas:
          type: object
          additionalProperties:
            type: integer
            minimum: 0
        openapi_url:
          type: string
        docs_url:
          type: string
        scope:
          type: string
        request_id: *id008
    ReportSummary:
      type: object
      required:
      - report_id
      - created_at
      - operation_kind
      - url
      properties:
        report_id:
          type: integer
          minimum: 1
        created_at: *id009
        operation_kind:
          type: string
          enum:
          - scan
          - route
        url:
          type: string
          format: uri-reference
    ReportPage:
      type: object
      required:
      - data
      - pagination
      - meta
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ReportSummary'
        pagination:
          type: object
          required:
          - limit
          - has_more
          - next_cursor
          properties:
            limit:
              type: integer
              minimum: 1
              maximum: 100
            has_more:
              type: boolean
            next_cursor:
              type: &id010
              - string
              - 'null'
              maxLength: 600
        meta:
          type: object
          required:
          - request_id
          properties:
            request_id: *id008
    OperationStatus:
      type: object
      required:
      - operation_id
      - status
      - kind
      - created_at
      - updated_at
      - credits_reserved_or_used
      - resource
      - poll_after_seconds
      - request_id
      properties:
        operation_id: *id008
        status:
          type: string
          enum:
          - reserved
          - completed
          - refunded
        kind:
          type: string
          enum:
          - scan
          - route
          - image
        created_at: *id009
        updated_at: *id009
        credits_reserved_or_used:
          type: integer
          enum:
          - 0
          - 1
        resource:
          oneOf:
          - type: 'null'
          - type: object
            required:
            - url
            properties:
              url:
                type: string
                format: uri-reference
        poll_after_seconds:
          type:
          - integer
          - 'null'
        request_id: *id008
    GarageVehicleResponse:
      allOf:
      - $ref: '#/components/schemas/GarageVehicle'
      - type: object
        required:
        - id
        - version
        - image_url
        - created_at
        - updated_at
        properties:
          id: *id008
          version:
            type: integer
            minimum: 1
          image_url: &id011
            type: *id010
          created_at: *id009
          updated_at: *id009
    GarageCollection:
      type: object
      required:
      - vehicles
      - active_vehicle_id
      properties:
        vehicles:
          type: array
          maxItems: 20
          items:
            $ref: '#/components/schemas/GarageVehicleResponse'
        active_vehicle_id: *id011
x-response-headers:
  X-Request-ID: Server-generated request UUID
  RateLimit-Limit: Applicable request budget
  RateLimit-Remaining: Remaining count in the reported window
  RateLimit-Reset: Reset epoch seconds
  Retry-After: Seconds to wait when rate-limited
