{
  "info": {
    "name": "Integration_Automatic Remote Sign",
    "schema": "{{postmanCollectionUrl}}",
    "description": "Automatic Remote Signing 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. Send consent request",
      "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"
          },
          {
            "key": "rpToClientAuthorization",
            "value": "{{rpToClientAuthorization}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/arsign/consent",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "arsign",
            "consent"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"organisation\": {\n    \"orgIdentifier\": \"{{orgIdentifier}}\",\n    \"orgIdentifierType\": \"EIK/VAT\",\n    \"orgName\": \"{{orgName}}\"\n  },\n  \"role\": \"Подписване/подпечатване на документи\",\n  \"subject\": \"Автоматизирано подписване\",\n  \"expirationTime\": 365\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "2. Get consent response by callback ID",
      "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/arsign/consent/{{callbackId}}",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "arsign",
            "consent",
            "{{callbackId}}"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "3. Validate accessToken",
      "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"
          },
          {
            "key": "accessToken",
            "value": "{{accessToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/arsign/validate/token",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "arsign",
            "validate",
            "token"
          ]
        },
        "description": ""
      },
      "response": []
    },
    {
      "name": "4. Send automatic remote sign request: synchronous operation",
      "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"
          },
          {
            "key": "accessToken",
            "value": "{{accessToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://cqes-rpuat.b-trust.bg/signing-api/v2/arsign/sync",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "arsign",
            "sync"
          ]
        },
        "description": "",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"contents\": [\n    {\n      \"confirmText\": \"Документ за подписване: document.pdf\",\n      \"contentFormat\": \"BINARY_BASE64\",\n      \"data\": \"{{documentBase64}}\",\n      \"fileName\": \"document.pdf\",\n      \"toBeArchived\": false,\n      \"hashAlgorithm\": \"SHA256\",\n      \"signatureType\": \"PADES_BASELINE_B\",\n      \"padesVisualSignature\": true,\n      \"signaturePosition\": {\n        \"imageHeight\": 50,\n        \"imageWidth\": 160,\n        \"imageXAxis\": 50,\n        \"imageYAxis\": 50,\n        \"pageNumber\": 1\n      }\n    }\n  ]\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        }
      },
      "response": []
    },
    {
      "name": "4.1 Get document by signatureID",
      "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/sign/content/{{signatureId}}",
          "protocol": "https",
          "host": [
            "cqes-rpuat",
            "b-trust",
            "bg"
          ],
          "path": [
            "signing-api",
            "v2",
            "sign",
            "content",
            "{{signatureId}}"
          ]
        },
        "description": ""
      },
      "response": []
    }
  ]
}