{
  "openapi": "3.1.0",
  "info": {
    "title": "QodeX PCB public API",
    "version": "1",
    "description": "Get an instant USD quote and the current delivery estimate for routing a placed KiCad board. No account needed. Ordering and payment are done by the customer at https://qodexpcb.com/quote.",
    "contact": {
      "url": "https://qodexpcb.com/contact",
      "email": "order@qodexpcb.com"
    }
  },
  "servers": [
    {
      "url": "https://qodexpcb.com"
    }
  ],
  "paths": {
    "/api/quote": {
      "post": {
        "operationId": "getQuote",
        "summary": "Price a board",
        "description": "Returns the price the customer would be charged today and the estimated delivery date. Send the measured figures of the placed board; no file is uploaded.",
        "parameters": [
          {
            "name": "X-Qodex-Request",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "description": "Required on every API request (CSRF guard)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "specs"
                ],
                "properties": {
                  "specs": {
                    "type": "object",
                    "required": [
                      "service",
                      "widthMm",
                      "heightMm"
                    ],
                    "properties": {
                      "service": {
                        "type": "string",
                        "enum": [
                          "routing",
                          "routing_fab",
                          "dfm_review",
                          "fab_only"
                        ]
                      },
                      "layers": {
                        "type": "integer",
                        "enum": [
                          1,
                          2,
                          4,
                          6,
                          8,
                          10,
                          12,
                          14,
                          16
                        ],
                        "default": 2
                      },
                      "widthMm": {
                        "type": "number",
                        "minimum": 3,
                        "maximum": 1000
                      },
                      "heightMm": {
                        "type": "number",
                        "minimum": 3,
                        "maximum": 1000
                      },
                      "nets": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "pads": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "quantity": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 100000,
                        "default": 5
                      },
                      "thickness": {
                        "type": "number",
                        "enum": [
                          0.4,
                          0.6,
                          0.8,
                          1,
                          1.2,
                          1.6,
                          2,
                          2.4
                        ],
                        "default": 1.6
                      },
                      "copperOz": {
                        "type": "integer",
                        "enum": [
                          1,
                          2,
                          3
                        ],
                        "default": 1
                      },
                      "finish": {
                        "type": "string",
                        "enum": [
                          "hasl",
                          "lf_hasl",
                          "enig",
                          "osp",
                          "immersion_silver",
                          "hard_gold"
                        ],
                        "default": "enig"
                      },
                      "maskColor": {
                        "type": "string",
                        "enum": [
                          "green",
                          "black",
                          "matte_black",
                          "matte_green",
                          "blue",
                          "red",
                          "white",
                          "yellow",
                          "purple"
                        ],
                        "default": "green"
                      },
                      "silkColor": {
                        "type": "string",
                        "enum": [
                          "white",
                          "black"
                        ],
                        "default": "white"
                      },
                      "turnaround": {
                        "type": "string",
                        "enum": [
                          "standard",
                          "express"
                        ],
                        "default": "standard"
                      },
                      "fabHouse": {
                        "type": "string",
                        "enum": [
                          "any",
                          "jlcpcb",
                          "pcbway",
                          "eurocircuits",
                          "sierra",
                          "other"
                        ],
                        "default": "any"
                      },
                      "impedanceControl": {
                        "type": "boolean",
                        "default": false
                      },
                      "powerTest": {
                        "type": "string",
                        "enum": [
                          "none",
                          "review"
                        ],
                        "default": "none",
                        "description": "Power-on test add-on: the online power-on test with an engineer review and sign-off."
                      }
                    }
                  },
                  "boardMeta": {
                    "type": "object",
                    "properties": {
                      "hasBGA": {
                        "type": "boolean"
                      }
                    }
                  }
                }
              },
              "example": {
                "specs": {
                  "service": "routing",
                  "layers": 4,
                  "widthMm": 64,
                  "heightMm": 42,
                  "nets": 14,
                  "pads": 71,
                  "turnaround": "standard"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quote",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "specs": {
                      "type": "object",
                      "description": "The normalised specification that was priced"
                    },
                    "quote": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "Price in US cents"
                        },
                        "currency": {
                          "type": "string",
                          "const": "USD"
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "number",
                                "description": "US dollars"
                              }
                            }
                          }
                        },
                        "autoQuote": {
                          "type": "boolean",
                          "description": "false: an engineer confirms the price before payment"
                        },
                        "eta": {
                          "type": "object",
                          "properties": {
                            "date": {
                              "type": "string",
                              "format": "date"
                            },
                            "businessDays": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid specification (the error message says which field)"
          },
          "403": {
            "description": "Missing X-Qodex-Request header"
          }
        }
      }
    },
    "/api/queue-status": {
      "get": {
        "operationId": "getQueueStatus",
        "summary": "Current delivery estimate",
        "responses": {
          "200": {
            "description": "Business days to delivery if paid today, and the queue level (no order counts are published)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "standardDays": {
                      "type": "integer"
                    },
                    "expressDays": {
                      "type": "integer"
                    },
                    "level": {
                      "type": "string",
                      "enum": [
                        "low",
                        "normal",
                        "busy"
                      ]
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "health",
        "summary": "Liveness",
        "responses": {
          "200": {
            "description": "{\"ok\":true}"
          }
        }
      }
    }
  }
}