{
  "openapi": "3.1.0",
  "info": {
    "title": "Burger-API (sandbox)",
    "version": "0.1.0",
    "description": "Open source koppelvlak waarmee een organisatie geverifieerde bewijzen bij een burger-omgeving opvraagt. Deze sandbox antwoordt namens een fictieve burger; in het echte product beslist de burger zelf over elke gegevensdeling. Vraagtaal: DCQL (OpenID4VP 1.0). Antwoord-formaat: SD-JWT VC-presentaties met key-binding (nonce en audience)."
  },
  "paths": {
    "/.well-known/burger-api": {
      "get": {
        "summary": "Metadata: beschikbare credential-typen, claims en endpoints",
        "responses": {
          "200": {
            "description": "Metadata-object",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/voorbeeld": {
      "get": {
        "summary": "Kant-en-klaar voorbeeldverzoek voor /sandbox/vraag",
        "responses": {
          "200": {
            "description": "Voorbeeld-request-body",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/vraag": {
      "post": {
        "summary": "Een DCQL-vraag stellen aan de demo-burger",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VraagRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per vraag-id een array van SD-JWT VC-presentaties in vp_token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VraagResponse"
                }
              }
            }
          },
          "400": {
            "description": "Ongeldige vraag, met uitleg en een voorbeeld"
          }
        }
      }
    },
    "/verifieer": {
      "post": {
        "summary": "Een presentatie ter demonstratie laten controleren (controleer in productie zelf)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "presentation"
                ],
                "properties": {
                  "presentation": {
                    "type": "string",
                    "description": "SD-JWT VC-presentatie (issuer-JWT~disclosures~KB-JWT)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Uitslag",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificatieUitslag"
                }
              }
            }
          }
        }
      }
    },
    "/vertrouwenslijst": {
      "get": {
        "summary": "Sandbox-vertrouwenslijst: vertrouwde uitgevers met publieke sleutels",
        "responses": {
          "200": {
            "description": "Lijst van uitgevers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/jwt-vc-issuer/uitgevers/{id}": {
      "get": {
        "summary": "Sleutel-resolutie per uitgever (SD-JWT VC issuer-metadata-mechanisme)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issuer-metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "issuer": {
                      "type": "string"
                    },
                    "jwks": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Onbekende uitgever"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "VraagRequest": {
        "type": "object",
        "required": [
          "dcql_query"
        ],
        "properties": {
          "client_id": {
            "type": "string",
            "description": "Naam of identifier van je organisatie; komt als audience (aud) terug in de key-binding van elk antwoord."
          },
          "nonce": {
            "type": "string",
            "description": "Je eenmalige controlegetal tegen herspelen; komt terug in de key-binding. Zonder nonce maakt de sandbox er zelf een aan."
          },
          "dcql_query": {
            "type": "object",
            "required": [
              "credentials"
            ],
            "properties": {
              "credentials": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "meta"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Je eigen label voor deze deelvraag; de sleutel in vp_token."
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "dc+sd-jwt"
                      ]
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "vct_values"
                      ],
                      "properties": {
                        "vct_values": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Welk credential-type je vraagt, bijvoorbeeld urn:nl.pubcommons:kind-ouder-gezag:1"
                        }
                      }
                    },
                    "claims": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "path"
                        ],
                        "properties": {
                          "path": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      },
                      "description": "Welke velden je wilt; weglaten betekent alle velden."
                    }
                  }
                }
              }
            }
          }
        }
      },
      "VraagResponse": {
        "type": "object",
        "properties": {
          "sandbox": {
            "type": "string",
            "description": "Vaste sandbox-melding."
          },
          "nonce": {
            "type": "string"
          },
          "aud": {
            "type": "string"
          },
          "vp_token": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Per vraag-id een array van SD-JWT VC-presentaties."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Deelvragen die niet geleverd konden worden, met reden."
          },
          "how_to_verify": {
            "type": "object"
          }
        }
      },
      "VerificatieUitslag": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "Alleen bij valid=false: waarom de presentatie is afgekeurd."
          },
          "issuer": {
            "type": "string"
          },
          "vct": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer"
          },
          "nonce": {
            "type": "string"
          },
          "aud": {
            "type": "string"
          },
          "disclosed": {
            "type": "object",
            "description": "Uitsluitend de onthulde velden."
          }
        }
      }
    }
  }
}