{
  "openapi": "3.1.0",
  "info": {
    "title": "Écorce surface (demo)",
    "version": "0.1.0",
    "description": "REST mirror of the MCP tools. Agents draft, humans confirm. All data is example/test data."
  },
  "servers": [
    {
      "url": "https://llm.ecorce.app"
    }
  ],
  "paths": {
    "/api/partners": {
      "get": {
        "operationId": "list_partners",
        "summary": "List partners (pilot targets)",
        "responses": {
          "200": {
            "description": "partners"
          }
        }
      }
    },
    "/api/catalogue": {
      "get": {
        "operationId": "search_catalogue",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partner_id",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "saja",
                "monde-naturel"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "offers"
          }
        }
      }
    },
    "/api/offers/{offer_id}": {
      "get": {
        "operationId": "get_offer",
        "parameters": [
          {
            "name": "offer_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "offer"
          }
        }
      }
    },
    "/api/drafts": {
      "post": {
        "operationId": "create_order_draft",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "partner_id": {
                    "type": "string",
                    "enum": [
                      "saja",
                      "monde-naturel"
                    ]
                  },
                  "lines": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "properties": {
                        "spn": {
                          "type": "string"
                        },
                        "qty": {
                          "type": "integer",
                          "minimum": 1
                        }
                      },
                      "required": [
                        "spn",
                        "qty"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "partner_id",
                  "lines"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "order_draft with confirm_url"
          }
        }
      }
    },
    "/api/drafts/{draft_id}": {
      "get": {
        "operationId": "get_draft",
        "parameters": [
          {
            "name": "draft_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "order_draft"
          }
        }
      }
    }
  }
}