{
  "info": {
    "name": "Integration_v2_RP_BASED",
    "schema": "{{postmanCollectionUrl}}",
    "description": "OTC v2 / RP-based one-time QES issue and sign flow. Sanitized public template: replace variables such as {{relyingPartyId}}, {{clientCertificate}}, {{callbackUrl}}, {{email}}, {{phone}}, {{personalIdentifier}}, {{documentBase64}} before use."
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://cqes-rpuat.b-trust.bg"
    },
    {
      "key": "acceptLanguage",
      "value": "bg"
    },
    {
      "key": "relyingPartyId",
      "value": ""
    },
    {
      "key": "clientCertificate",
      "value": ""
    },
    {
      "key": "callbackUrl",
      "value": ""
    },
    {
      "key": "email",
      "value": ""
    },
    {
      "key": "phone",
      "value": ""
    },
    {
      "key": "personalIdentifier",
      "value": ""
    },
    {
      "key": "documentBase64",
      "value": ""
    },
    {
      "key": "uuid",
      "value": ""
    },
    {
      "key": "sessionId",
      "value": ""
    },
    {
      "key": "resultId",
      "value": ""
    },
    {
      "key": "signSessionId",
      "value": ""
    },
    {
      "key": "accessToken",
      "value": ""
    },
    {
      "key": "signatureId",
      "value": ""
    },
    {
      "key": "relyingPartyID",
      "value": "",
      "type": "string"
    },
    {
      "key": "X-CLIENT-CERT",
      "value": "",
      "type": "string"
    },
    {
      "key": "certId",
      "value": "",
      "type": "string"
    },
    {
      "key": "personalNumber",
      "value": "",
      "type": "string"
    },
    {
      "key": "documentNumber",
      "value": "",
      "type": "string"
    },
    {
      "key": "successUrl",
      "value": "",
      "type": "string"
    },
    {
      "key": "cancelUrl",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "1. Create session EGN/LNC",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/createSession",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "createSession"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"otcClientData\": {\n    \"countryCode\": \"BGR\",\n    \"personDocumentType\": \"ID_CARD\",\n    \"documentNumber\": \"{{documentNumber}}\",\n    \"email\": \"{{email}}\",\n    \"familyNameLatin\": \"{{familyNameLatin}}\",\n    \"firstNameLatin\": \"{{firstNameLatin}}\",\n    \"personalNumber\": \"{{personalIdentifier}}\",\n    \"phone\": \"{{phone}}\"\n  },\n  \"noRegix\": false,\n  \"statusChangeCallbackURL\": \"{{callbackUrl}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "2. Upload documents for signing",
      "request": {
        "method": "PUT",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/sendDocs",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "sendDocs"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"contentFormat\": \"BINARY_BASE64\",\n  \"documents\": [\n    {\n      \"dataBase64\": \"{{documentBase64}}\",\n      \"filename\": \"document.pdf\",\n      \"mimeType\": \"APPLICATION_PDF\",\n      \"padesVisualSignature\": true,\n      \"signaturePosition\": {\n        \"imageHeight\": 100,\n        \"imageWidth\": 160,\n        \"imageXAxis\": 50,\n        \"imageYAxis\": 50,\n        \"pageNumber\": 1\n      },\n      \"signatureType\": \"PADES_BASELINE_B\"\n    }\n  ],\n  \"otpOrLink\": \"LINK\",\n  \"sendDocsToClientEmail\": true,\n  \"sessionId\": \"{{sessionId}}\",\n  \"trustServicesContract\": null\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "2.1 Validate OTP without link",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/validateOtp",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "validateOtp"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"sessionId\": \"{{sessionId}}\",\n  \"otp\": \"{{otpCode}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "3. Check session",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/checkSession/{{sessionId}}",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "checkSession",
            "{{sessionId}}"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "4. Get signed documents",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/getDocuments/{{sessionId}}",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "getDocuments",
            "{{sessionId}}"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "5. Close session",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Accept-language",
            "value": "{{acceptLanguage}}",
            "type": "text"
          },
          {
            "key": "relyingPartyID",
            "value": "{{relyingPartyId}}",
            "type": "text"
          },
          {
            "key": "X-CLIENT-CERT",
            "value": "{{clientCertificate}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/otc/issueAndSign/v2/closeSession",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "otc",
            "issueAndSign",
            "v2",
            "closeSession"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"sessionId\": \"{{sessionId}}\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    }
  ]
}