{
  "openapi": "3.1.0",
  "info": {
    "title": "ChemNexia API",
    "version": "1.0.0",
    "description": "API-first access to requests, offers, suppliers, deal-room metadata and the audit trail. Every response is shaped server-side for the calling audience: confidential requests are redacted and end-to-end encrypted deal-room content is never returned."
  },
  "servers": [
    {
      "url": "https://chemnexia.lewo.me"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/public/v1/me": {
      "get": {
        "summary": "Current identity, company profile and granted roles",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/rfqs": {
      "get": {
        "summary": "List requests you may see — confidential ones are redacted server-side",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      },
      "post": {
        "summary": "Create a request (draft)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chem_names": {},
                  "cas_no": {},
                  "capability": {},
                  "description": {},
                  "kind": {},
                  "confidential": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/rfqs/{id}": {
      "get": {
        "summary": "Single request incl. quantities and visibility rules",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/rfqs/{id}/offers": {
      "get": {
        "summary": "Offers on a request",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      },
      "post": {
        "summary": "Submit or update your offer (one per supplier per request)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "lab_price": {},
                  "dev_price_per_kg": {},
                  "commercial_price_per_kg": {},
                  "availability": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/suppliers": {
      "get": {
        "summary": "Supplier directory filtered by CAS, location or company type",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cas",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/deal-rooms": {
      "get": {
        "summary": "Deal room metadata — encrypted content is never returned",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/audit-trail": {
      "get": {
        "summary": "Export the audit trail",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "room_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    },
    "/api/public/v1/openapi.json": {
      "get": {
        "summary": "This OpenAPI 3.1 document",
        "security": [],
        "responses": {
          "200": {
            "description": "Success"
          },
          "201": {
            "description": "Created"
          },
          "401": {
            "description": "Missing or invalid access token"
          },
          "404": {
            "description": "Not found"
          },
          "409": {
            "description": "Action not allowed in the current state"
          },
          "422": {
            "description": "Validation failed"
          }
        }
      }
    }
  }
}