{
  "openapi": "3.1.0",
  "info": {
    "title": "Plain Freight instant offer API",
    "version": "1.0.0",
    "description": "Get an all-in China to USA freight offer (freight, US customs clearance, duties, and door delivery in one number) for a shipment between 100 g and 2,000 kg. No API key. Rate limited to 8 offers per hour per IP. Prices come from Plain Freight's pricing engine; an AI agent then double-checks the shipment and can add questions or withdraw prices for human review.",
    "contact": {
      "email": "hello@plainfreight.com",
      "url": "https://plainfreight.com"
    }
  },
  "servers": [
    {
      "url": "https://plainfreight.com"
    }
  ],
  "paths": {
    "/api/v1/offer": {
      "post": {
        "operationId": "createInstantOffer",
        "summary": "Quote a China to USA shipment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "product",
                  "weight_kg"
                ],
                "properties": {
                  "product": {
                    "type": "string",
                    "description": "What is being shipped, e.g. 'LED desk lamps, 500 units'"
                  },
                  "weight_kg": {
                    "type": "number",
                    "minimum": 0.1,
                    "maximum": 2000,
                    "description": "Total weight in kg"
                  },
                  "dimensions": {
                    "type": "string",
                    "description": "Cartons and size, e.g. '4 cartons, 60x40x35 cm each'. Improves accuracy: volumetric weight can govern."
                  },
                  "origin": {
                    "type": "string",
                    "description": "Pickup city or supplier in China"
                  },
                  "destination_zip": {
                    "type": "string",
                    "description": "US destination ZIP"
                  },
                  "urgency": {
                    "type": "string",
                    "enum": [
                      "Not urgent",
                      "Need best balance of cost and speed",
                      "Urgent"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "description": "Where to send the written offer. Optional, but without it no one can follow up."
                  },
                  "name": {
                    "type": "string"
                  },
                  "company": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string",
                    "description": "HS code, FBA requirements, delivery constraints, certifications held"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Offer generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quote_id": {
                      "type": "string"
                    },
                    "needs_review": {
                      "type": "boolean",
                      "description": "true means prices are withheld pending a human check of the goods"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "enum": [
                              "air",
                              "sea",
                              "express"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number",
                            "description": "All-in USD"
                          },
                          "transit": {
                            "type": "string"
                          },
                          "firm": {
                            "type": "boolean",
                            "description": "false means indicative; the final number is confirmed before booking"
                          },
                          "includes": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "summary": {
                      "type": "string"
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Answering these can change the price or the customs channel"
                    },
                    "valid_days": {
                      "type": "integer"
                    },
                    "agent_review": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "not_running"
                      ]
                    },
                    "poll_url": {
                      "type": "string",
                      "description": "GET this until settled is true to pick up the agent's checks"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Missing or out-of-range product / weight_kg"
          },
          "429": {
            "description": "Rate limited (8 offers per hour per IP)"
          }
        }
      },
      "get": {
        "operationId": "getInstantOffer",
        "summary": "Poll an offer for the agent's verdict",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "quote_id from the POST response"
          }
        ],
        "responses": {
          "200": {
            "description": "Current state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quote_id": {
                      "type": "string"
                    },
                    "settled": {
                      "type": "boolean",
                      "description": "true once the agent finished checking"
                    },
                    "needs_review": {
                      "type": "boolean"
                    },
                    "text": {
                      "type": "string"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown quote_id"
          }
        }
      }
    }
  }
}