{
 "openapi": "3.1.0",
 "info": {
  "title": "Galactic Intelligence API",
  "version": "1.0.0",
  "description": "Delivered-cost estimates and sourcing requests for goods shipped from China to Uganda by Galactic Bridge (Kampala, Uganda). Estimates use published market freight rates and Uganda's tax rules; a confirmed quote fixes the price.\nCurrent scope: Uganda delivery. Public estimates cover China\u2013Uganda goods routes. Other destinations and exports are planned. Estimates are not final supplier or transport offers. Final quotes require verified suppliers, confirmed shipment costs and applicable import checks.\n\nAI agents: the same service is available as an MCP server at https://galacticbridge.com/mcp (Streamable HTTP, no key). Submit requests only with the person's permission; the person accepts quotes; payment goes only to the company. Delivery is live to Uganda; other destinations are recorded for route review.",
  "contact": {
   "email": "info@galacticbridge.com"
  }
 },
 "servers": [
  {
   "url": "https://galacticbridge.com/gi/api/v1"
  }
 ],
 "paths": {
  "/lanes": {
   "get": {
    "operationId": "listLanes",
    "summary": "Routes and their status",
    "responses": {
     "200": {
      "description": "Routes",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "lanes": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Lane"
           }
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/quote": {
   "post": {
    "operationId": "deliveredCostEstimate",
    "summary": "Delivered-cost estimate: goods + freight + insurance + Uganda import taxes (+ optional factory inspection)",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/QuoteRequest"
       },
       "example": {
        "lane": "cn-ug-air",
        "goodsUsd": 1000,
        "weightKg": 20,
        "category": "finished",
        "inspection": true
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Estimate with low/high ranges in USD and UGX, delivery days, pending items and notes"
     },
     "400": {
      "description": "Invalid input, message in error"
     },
     "429": {
      "description": "Rate limited"
     }
    }
   }
  },
  "/requests/{ref}": {
   "get": {
    "operationId": "getRequestStatus",
    "summary": "Status timeline of a sourcing request (needs the private key given at creation)",
    "parameters": [
     {
      "name": "ref",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^GB-[0-9A-F]{6}$"
      }
     },
     {
      "name": "key",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Timeline"
     },
     "404": {
      "description": "No match"
     }
    }
   }
  },
  "/rules/classify": {
   "post": {
    "summary": "Tariff code, Uganda duty and import checks for a product",
    "operationId": "classifyProduct",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "q"
        ],
        "properties": {
         "q": {
          "type": "string",
          "maxLength": 300,
          "description": "Product description"
         },
         "origin": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Classification"
     }
    }
   }
  },
  "/requests": {
   "post": {
    "summary": "Submit a sourcing request for a person (with their permission)",
    "operationId": "createRequest",
    "description": "Creates a real request; our team contacts the person. Requires consent=true and a phone or email. Returns ref and a private key for tracking.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "name",
         "country",
         "product",
         "consent"
        ],
        "properties": {
         "product": {
          "type": "string",
          "minLength": 10,
          "maxLength": 2000
         },
         "quantity": {
          "type": "string"
         },
         "budget": {
          "type": "string"
         },
         "name": {
          "type": "string"
         },
         "phone": {
          "type": "string"
         },
         "email": {
          "type": "string"
         },
         "city": {
          "type": "string"
         },
         "country": {
          "type": "string"
         },
         "lane": {
          "type": "string",
          "enum": [
           "cn-ug-air",
           "cn-ug-sea"
          ]
         },
         "links": {
          "type": "array",
          "items": {
           "type": "string"
          },
          "maxItems": 3
         },
         "consent": {
          "type": "boolean"
         },
         "src": {
          "type": "string",
          "description": "Short source code, e.g. ai-claude"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "{ref, key}"
     },
     "400": {
      "description": "Invalid"
     },
     "429": {
      "description": "Too many"
     }
    }
   }
  },
  "/requests/{ref}/pay": {
   "post": {
    "summary": "Secure payment link for the amount due (Flutterwave; when enabled)",
    "operationId": "createPaymentLink",
    "parameters": [
     {
      "name": "ref",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "pattern": "^GB-[0-9A-F]{6}$"
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "key"
        ],
        "properties": {
         "key": {
          "type": "string"
         },
         "currency": {
          "type": "string",
          "enum": [
           "UGX",
           "USD"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "{link, amount, currency}"
     },
     "400": {
      "description": "Not available"
     }
    }
   }
  },
  "/supplier-applications": {
   "post": {
    "summary": "Apply as a supplier or logistics partner",
    "operationId": "applyAsSupplier",
    "description": "The company confirms by a link sent to its business email; two team members verify the evidence before any request is sent.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "email",
         "name",
         "country",
         "keywords",
         "consent"
        ],
        "properties": {
         "email": {
          "type": "string"
         },
         "name": {
          "type": "string"
         },
         "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
         },
         "keywords": {
          "type": "string"
         },
         "consent": {
          "type": "boolean"
         },
         "type": {
          "type": "string",
          "enum": [
           "manufacturer",
           "agent",
           "forwarder",
           "clearing",
           "insurer",
           "inspector"
          ]
         },
         "website": {
          "type": "string"
         },
         "legalName": {
          "type": "string"
         },
         "registrationNumber": {
          "type": "string"
         },
         "registryUrl": {
          "type": "string"
         },
         "contact": {
          "type": "string"
         },
         "phone": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Recorded"
     }
    }
   }
  },
  "/agent-info": {
   "get": {
    "summary": "MCP server and tools",
    "operationId": "agentInfo",
    "responses": {
     "200": {
      "description": "Server description"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Lane": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "from": {
      "type": "string"
     },
     "to": {
      "type": "string"
     },
     "mode": {
      "type": "string",
      "enum": [
       "air",
       "sea",
       "export"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "accepting",
       "planned"
      ]
     },
     "doorDays": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "integer"
      }
     },
     "note": {
      "type": "string"
     }
    }
   },
   "QuoteRequest": {
    "type": "object",
    "required": [
     "lane",
     "goodsUsd"
    ],
    "properties": {
     "lane": {
      "type": "string",
      "enum": [
       "cn-ug-air",
       "cn-ug-sea"
      ]
     },
     "goodsUsd": {
      "type": "number",
      "minimum": 1,
      "maximum": 1000000,
      "description": "Goods value at the factory, US$"
     },
     "weightKg": {
      "type": "number",
      "description": "Air: actual weight (chargeable = max(weight, m\u00b3 x 166.67))"
     },
     "cbm": {
      "type": "number",
      "description": "Volume in m\u00b3 (required for sea; minimum 1 m\u00b3 charged)"
     },
     "category": {
      "type": "string",
      "enum": [
       "raw",
       "intermediate",
       "finished",
       "unsure"
      ],
      "description": "EAC duty band 0 / 10 / 25 / 25%"
     },
     "inspection": {
      "type": "boolean",
      "description": "Add a factory inspection (US$268)"
     }
    }
   }
  }
 }
}