{
  "openapi": "3.1.0",
  "info": {
    "title": "Fidelir Trust Services",
    "version": "0.12.0",
    "description": "REST API for PAdES / XAdES / CAdES / ASiC signature validation (EU DSS).\n\nIntegrators POST a document and receive the validation result on the same\nrequest: the connection is held until validation finishes. There is no\nclient-side poll in this contract.\n\nService status: Advanced validation service. The engine implements the\ntechnical procedures of EN 319 102-1, TS 119 615, TS/EN 319 102-2 and\nTS 119 442.\n\nEU-path qualification follows ETSI TS 119 615 via DSS when the EU TL\nsource is ready; national paths use the Validation Policy heuristic.\n\nRequest `svr=true` for an ETSI TS/EN 319 102-2 Signature Validation Report XML\n(`result.signatureValidationReportXml`). When the service eSeal is\nconfigured, that XML is XAdES-B-B sealed and `result.isSigned` is true\n(the product Advanced eSeal). Optional `detailed=true` returns the\nDSS Detailed Report XML (not the ETSI SVR). Large report responses are not\nresult-cached.\n\nRetry `POST` only with the same `Idempotency-Key`. On `429`, `503`, or `504`,\nwait for `Retry-After`.\n\nPrimary UX interface: `POST /api/v1/validate`.\nETSI TS 119 442 machine interfaces (same engine / Validation Policy):\n- `POST /api/v1/etsi/validate` — validation protocol (JSON and XML)\n- `POST /api/v1/etsi/augment` — augmentation protocol (JSON)\n- `POST /api/v1/etsi/validate-and-augment` — combined protocol (JSON)\n"
  },
  "servers": [
    {
      "url": "https://trust.fidelir.com",
      "description": "Public edge (rate-limited)"
    }
  ],
  "externalDocs": {
    "description": "Validation Policy v1.1",
    "url": "https://trust.fidelir.com/vp/"
  },
  "tags": [
    {
      "name": "validate"
    },
    {
      "name": "etsi-442"
    }
  ],
  "paths": {
    "/api/v1/validate": {
      "post": {
        "operationId": "validateDocument",
        "tags": [
          "validate"
        ],
        "summary": "Validate a signed document",
        "description": "One request, one file. Maximum 25 MiB **decoded**. Multipart field `file`, or JSON\nwith Base64 in `file` (`Content-Type: application/json`). JSON on the wire may be\nup to 36 MiB because of Base64 expansion. The connection is held until validation\nfinishes. Typical duration is under a second; the\nwait cap is 90 seconds (`504` if exceeded).\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "description": "Optional commercial client. `Bearer <api-key>`. Absent key is billed as public\n(website). Unknown or inactive key is `401`.\n",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Api-Key",
            "in": "header",
            "required": false,
            "description": "Same as Bearer, if Authorization is not sent.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "detailed": {
                    "type": "boolean",
                    "default": false,
                    "description": "Include DSS detailed report XML (not cached)"
                  },
                  "svr": {
                    "type": "boolean",
                    "default": false,
                    "description": "Include ETSI TS/EN 319 102-2 Signature Validation Report XML (not cached)"
                  }
                }
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateJsonRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Finished (`status` is `completed` or `failed`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobRecord"
                }
              }
            }
          },
          "400": {
            "description": "Empty file or invalid request"
          },
          "401": {
            "description": "API key presented but unknown or inactive"
          },
          "413": {
            "description": "Decoded document exceeds 25 MiB (JSON body over 36 MiB at the edge)"
          },
          "429": {
            "description": "Request capacity reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Service temporarily unavailable",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "504": {
            "description": "Validation did not finish within the wait cap",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/etsi/validate": {
      "post": {
        "operationId": "etsi442Validate",
        "tags": [
          "etsi-442"
        ],
        "summary": "TS 119 442 validation protocol (JSON or XML)",
        "description": "Profile `http://uri.etsi.org/19442/v1.1.1/validationprotocol#`.\nSame validation engine as `POST /api/v1/validate`, with SVR always produced.\nJSON VerifyResp includes Base64 SVR, `appliedSigValPolicy`, and\n`optOutp.resForEachSignature`. XML binding accepts DSS-X-like VerifyRequest\nand returns VerifyResponse XML.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "If absent, `reqID` / RequestID is used when present.",
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "$ref": "#/components/parameters/AuthorizationHeader"
          },
          {
            "$ref": "#/components/parameters/XApiKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EtsiVerifyReq"
              }
            },
            "application/xml": {
              "schema": {
                "type": "string",
                "description": "DSS-X-like VerifyRequest XML (Base64Data/Value or b64Sig)"
              }
            },
            "text/xml": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "VerifyResp JSON or VerifyResponse XML",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EtsiVerifyResp"
                }
              },
              "application/xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid VerifyReq"
          },
          "401": {
            "description": "API key presented but unknown or inactive"
          },
          "413": {
            "description": "Decoded document exceeds 25 MiB"
          },
          "429": {
            "description": "Request capacity reached",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Service temporarily unavailable",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "504": {
            "description": "Validation did not finish within the wait cap",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/etsi/augment": {
      "post": {
        "operationId": "etsi442Augment",
        "tags": [
          "etsi-442"
        ],
        "summary": "TS 119 442 augmentation protocol (JSON)",
        "description": "Profile `http://uri.etsi.org/19442/v1.1.1/augmentationprotocol#`.\nExtends PAdES/XAdES/CAdES to Baseline T/LT/LTA using the configured\ntimestamp authority. Returns augmented document Base64 in `optOutp.augDoc.b64Data.val`.\nSynchronous.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          },
          {
            "$ref": "#/components/parameters/AuthorizationHeader"
          },
          {
            "$ref": "#/components/parameters/XApiKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EtsiAugmentReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "AugmentResp",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EtsiAugmentResp"
                }
              }
            }
          },
          "400": {
            "description": "Invalid AugmentReq or unsupported level/format"
          },
          "401": {
            "description": "Unauthorized"
          },
          "502": {
            "description": "TSA or augmentation failure"
          }
        }
      }
    },
    "/api/v1/etsi/validate-and-augment": {
      "post": {
        "operationId": "etsi442ValidateAndAugment",
        "tags": [
          "etsi-442"
        ],
        "summary": "TS 119 442 validation-and-augmentation protocol (JSON)",
        "description": "Profile `http://uri.etsi.org/19442/v1.1.1/validationAndAugmentationprotocol#`.\nAugments then validates the augmented document (SVR + per-signature results +\n`optOutp.augDoc`).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKeyHeader"
          },
          {
            "$ref": "#/components/parameters/AuthorizationHeader"
          },
          {
            "$ref": "#/components/parameters/XApiKeyHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EtsiAugmentReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Combined VerifyResp-shaped body with augDoc",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EtsiVerifyResp"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "502": {
            "description": "TSA or augmentation failure"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "AuthorizationHeader": {
        "name": "Authorization",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "XApiKeyHeader": {
        "name": "X-Api-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "IdempotencyKeyHeader": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "ValidateJsonRequest": {
        "type": "object",
        "required": [
          "file"
        ],
        "properties": {
          "file": {
            "type": "string",
            "description": "Document as Base64 (MIME whitespace allowed; optional data-URL prefix)"
          },
          "filename": {
            "type": "string",
            "description": "Original name (path components stripped)"
          },
          "detailed": {
            "type": "boolean",
            "default": false,
            "description": "Include DSS detailed report XML (not cached)"
          },
          "svr": {
            "type": "boolean",
            "default": false,
            "description": "Include ETSI TS/EN 319 102-2 Signature Validation Report XML (not cached)"
          }
        }
      },
      "EtsiVerifyReq": {
        "type": "object",
        "required": [
          "profile"
        ],
        "description": "TS 119 442 VerifyRequestType JSON binding. First profile URI must be\nhttp://uri.etsi.org/19442/v1.1.1/validationprotocol#.\nSupports embedded `inDocs.doc`, detached `sigObj`, `inDocs.transformed`,\n`inDocs.docHash`, and `attachments` for `attRef` resolution (no remote HTTP fetch).\n",
        "properties": {
          "profile": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "reqID": {
            "type": "string"
          },
          "inDocs": {
            "type": "object",
            "properties": {
              "doc": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "ID": {
                      "type": "string"
                    },
                    "mimeType": {
                      "type": "string"
                    },
                    "b64Data": {
                      "$ref": "#/components/schemas/EtsiB64Data"
                    }
                  }
                }
              },
              "transformed": {
                "type": "array",
                "description": "Pre-transformed payloads for XAdES (DSS detached contents)",
                "items": {
                  "type": "object",
                  "properties": {
                    "ID": {
                      "type": "string"
                    },
                    "whichRef": {
                      "type": "integer"
                    },
                    "b64Data": {
                      "$ref": "#/components/schemas/EtsiB64Data"
                    }
                  }
                }
              },
              "docHash": {
                "type": "array",
                "description": "Digest-only detached contents (DSS DigestDocument)",
                "items": {
                  "type": "object",
                  "properties": {
                    "ID": {
                      "type": "string"
                    },
                    "whichRef": {
                      "type": "integer"
                    },
                    "pAdESSFieldName": {
                      "type": "string"
                    },
                    "di": {
                      "$ref": "#/components/schemas/EtsiDigestInfo"
                    },
                    "dis": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EtsiDigestInfo"
                      }
                    }
                  }
                }
              }
            }
          },
          "sigObj": {
            "type": "object",
            "properties": {
              "b64Sig": {
                "$ref": "#/components/schemas/EtsiB64Data"
              }
            }
          },
          "attachments": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "REST binding for DSS-X attRef — map of attURI / cid: key to Base64 bytes.\nRemote http(s) attURI values are rejected (SSRF); supply the payload here.\n"
          },
          "optInp": {
            "type": "object",
            "additionalProperties": true,
            "description": "Accepted; SVR is always produced"
          }
        }
      },
      "EtsiB64Data": {
        "type": "object",
        "properties": {
          "val": {
            "type": "string",
            "description": "Base64 payload"
          },
          "value": {
            "type": "string",
            "description": "Alias for val"
          },
          "mimeType": {
            "type": "string"
          },
          "attRef": {
            "type": "object",
            "properties": {
              "attURI": {
                "type": "string"
              },
              "di": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EtsiDigestInfo"
                }
              }
            }
          }
        }
      },
      "EtsiDigestInfo": {
        "type": "object",
        "properties": {
          "alg": {
            "type": "string",
            "description": "Digest algorithm URI or name (e.g. SHA256)"
          },
          "val": {
            "type": "string",
            "description": "Base64 digest value"
          }
        }
      },
      "EtsiVerifyResp": {
        "type": "object",
        "required": [
          "result",
          "profile"
        ],
        "properties": {
          "result": {
            "type": "object",
            "properties": {
              "maj": {
                "type": "string",
                "description": "DSS-X result major URI"
              },
              "min": {
                "type": "string",
                "description": "ETSI 442 validation minor URI"
              },
              "msg": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "value": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "profile": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reqID": {
            "type": "string",
            "nullable": true
          },
          "respID": {
            "type": "string",
            "nullable": true
          },
          "optOutp": {
            "type": "object",
            "properties": {
              "policy": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Applied service policy URI(s)"
              },
              "appliedSigValPolicy": {
                "type": "string",
                "format": "uri",
                "description": "Signature validation policy URI (`https://trust.fidelir.com/vp/#VP-1.1`)"
              },
              "validationReport": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "etsiTS11910202XMLReport": {
                    "type": "string",
                    "description": "Base64 of ETSI TS/EN 319 102-2 SVR XML. When `isSigned` is true,\nthe XML carries a Fidelir XAdES-B-B eSeal (Advanced eSeal).\n"
                  },
                  "isSigned": {
                    "type": "boolean",
                    "description": "true when the SVR XML is sealed with the Fidelir SVR eSeal.\n"
                  }
                }
              },
              "resForEachSignature": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "maj": {
                          "type": "string"
                        },
                        "min": {
                          "type": "string"
                        },
                        "msg": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "string"
                            },
                            "lang": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "sigId": {
                      "type": "string"
                    },
                    "signedBy": {
                      "type": "string"
                    },
                    "signatureFormat": {
                      "type": "string"
                    },
                    "bestSignatureTime": {
                      "type": "string"
                    },
                    "claimedSigningTime": {
                      "type": "string"
                    },
                    "qualification": {
                      "type": "string"
                    },
                    "qualificationType": {
                      "type": "string"
                    }
                  }
                }
              },
              "augDoc": {
                "type": "object",
                "nullable": true,
                "description": "Present on validate-and-augment responses",
                "properties": {
                  "b64Data": {
                    "type": "object",
                    "properties": {
                      "val": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "EtsiAugmentReq": {
        "type": "object",
        "required": [
          "profile"
        ],
        "properties": {
          "profile": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "First URI must be the augmentation or validation-and-augmentation profile"
          },
          "reqID": {
            "type": "string"
          },
          "inDocs": {
            "type": "object",
            "properties": {
              "doc": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "ID": {
                      "type": "string"
                    },
                    "b64Data": {
                      "type": "object",
                      "properties": {
                        "val": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "optInp": {
            "type": "object",
            "properties": {
              "targetLevel": {
                "type": "string",
                "description": "e.g. PAdES_BASELINE_T, B-T, B-LT, B-LTA"
              }
            }
          }
        }
      },
      "EtsiAugmentResp": {
        "type": "object",
        "required": [
          "result",
          "profile"
        ],
        "properties": {
          "result": {
            "type": "object",
            "properties": {
              "maj": {
                "type": "string"
              },
              "min": {
                "type": "string"
              },
              "msg": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "profile": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reqID": {
            "type": "string"
          },
          "respID": {
            "type": "string"
          },
          "optOutp": {
            "type": "object",
            "properties": {
              "augDoc": {
                "type": "object",
                "properties": {
                  "b64Data": {
                    "type": "object",
                    "properties": {
                      "val": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "JobRecord": {
        "type": "object",
        "required": [
          "jobId",
          "status"
        ],
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "running",
              "completed",
              "failed"
            ]
          },
          "filename": {
            "type": "string"
          },
          "bytes": {
            "type": "integer"
          },
          "sha256": {
            "type": "string"
          },
          "detailed": {
            "type": "boolean"
          },
          "svr": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
          },
          "result": {
            "$ref": "#/components/schemas/VerifyResponse"
          },
          "errorCode": {
            "type": "string"
          },
          "errorMessage": {
            "type": "string"
          }
        }
      },
      "VerifyResponse": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "overallIndication": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "bytes": {
            "type": "integer"
          },
          "signatures": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignatureReport"
            }
          },
          "detailedReportXml": {
            "type": "string",
            "nullable": true,
            "description": "DSS Detailed Report XML when detailed=true"
          },
          "signatureValidationReportXml": {
            "type": "string",
            "nullable": true,
            "description": "ETSI TS/EN 319 102-2 Signature Validation Report XML when svr=true.\nMay be XAdES-B-B sealed when the service eSeal is configured.\n"
          },
          "isSigned": {
            "type": "boolean",
            "nullable": true,
            "description": "true when signatureValidationReportXml carries the Fidelir SVR eSeal.\nnull when no SVR; false when SVR present but unsigned.\n"
          },
          "documentAlteration": {
            "type": "object",
            "nullable": true
          }
        }
      },
      "SignatureReport": {
        "type": "object",
        "properties": {
          "signatureId": {
            "type": "string"
          },
          "signedBy": {
            "type": "string"
          },
          "subjectSerialNumber": {
            "type": "string",
            "nullable": true,
            "description": "Subject DN attribute serialNumber (X.509 OID 2.5.4.5), when present.\nTypical for natural-person AdES (e.g. national IDNP). Not the certificate serial number.\n"
          },
          "organizationIdentifier": {
            "type": "string",
            "nullable": true,
            "description": "Subject DN attribute organizationIdentifier (X.509 OID 2.5.4.97), when present.\nTypical for legal-person / eSeal subjects (e.g. NTRMD-{IDNO}).\n"
          },
          "authority": {
            "type": "string",
            "nullable": true
          },
          "authorityCountry": {
            "type": "string",
            "nullable": true
          },
          "trustSource": {
            "type": "string",
            "description": "Where the trust anchor was ingested (`eu-lotl`, `national`, `unknown`).",
            "enum": [
              "eu-lotl",
              "national",
              "unknown"
            ]
          },
          "qualification": {
            "type": "string",
            "description": "Legal/technical qualification of the signature, independent of `trustSource`.\n`QES` requires a qualified certificate, QSCD, and a CA/QC listing that is EU `granted`\nor a national qualified CA. `eu-lotl` alone is not QES.\n",
            "enum": [
              "QES",
              "AdES",
              "not-qualified"
            ]
          },
          "qualificationType": {
            "type": "string",
            "nullable": true,
            "description": "Finer grain (`QESig`, `QESeal`, `AdESig-QC`, `AdESig`, …)"
          },
          "indication": {
            "type": "string"
          },
          "subIndication": {
            "type": "string",
            "nullable": true
          },
          "valid": {
            "type": "boolean"
          },
          "signatureFormat": {
            "type": "string",
            "nullable": true
          },
          "bestSignatureTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "claimedSigningTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "signatureAlgorithm": {
            "type": "string",
            "nullable": true
          },
          "technical": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    }
  }
}
