# 2. Initiate Signing Process

&#x20;The obtained signing identity and txId during the previous step needs to be passed in the next API call along with the single or multiple documents to be signed.

<mark style="color:blue;">**`PUT http://localhost:8080/v2/signature/request`**</mark>

**Headers**

| Name         | Value               |
| ------------ | ------------------- |
| Content-Type | multipart/form-data |

**Body**

| Name            | Description                                                                                                                                             |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| digestAlgorithm | SHA256                                                                                                                                                  |
| signIdentityId  | ckqtokgre4o5mrk4bajtk413ui                                                                                                                              |
| txId            | 90ca005cfb4d4827b1247889166b72fe                                                                                                                        |
| file            | file1.pdf file2.pdf                                                                                                                                     |
| sigProp         | { "signPropDetail": \[ { "fileName": "file1.pdf", "signInfo": "1:50, 50, 200,200]" }, { "fileName": "file2.pdf", "signInfo": "1:\[50,50,200,200]" } ] } |

**Response**

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" %}

````url
{
  ```
https://stg-id.uaepass.ae/trustedx-authserver/oauth/hsign-as?response_type=code&client_id=sandbox_stage&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fv2%2Fsignature%2Ftoken&scope=urn:uae:digitalid:backend_api:hash_signing urn:safelayer:eidas:sign:identity:use:server&state=1434459749&digests_summary=npBScEri0PAqJ8yWz11jvcjFOlzVkDijlM-osjrX98k%3D&digests_summary_algorithm=SHA256&sign_identity_id=ckqtokgre4o5mrk4bajtk413ui
```
}
````

{% endcode %}
{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

Provide the below values for “signProp” parameter in the API call. The values should be adjusted accordingly as per the files.

```
{
  "signPropDetail": [
    {
      "fileName": "sample1.pdf",
      "signInfo": "1:[50, 600, 200, 100]"
    },
    {
      "fileName": "sample2.pdf",
      "signInfo": "1:[50, 600, 200, 100]"
    }
  ]
}

```

**Description of parameters in the above request body:**

| filename | The name of the file that needs to be signed. It should be exactly same as the selected one.                                                                                                                              |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| signInfo | Page number and the signing position on the specified page. The first 2 values (50,600) specify the values for lower left corner X,Y coordinates and other two 200,100) represent the upper right corner X,Y coordinates. |

| txId(mandatory)            | <p>Transaction id for signing request.</p><p><strong>Note</strong>: Transaction ID is valid for only 10 minutes and operation should end within the same period.</p> |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| digestAlgorithm(mandatory) | <p>Entity can use one of the digest algorithms from below according to their requirement:</p><p>SHA256</p><p>SHA384</p><p>SHA512</p>                                 |
| signIdentityId(mandatory)  | User’s qualified certificate id                                                                                                                                      |
| file(mandatory)            | Pdf file which is to be signed                                                                                                                                       |
| signProp                   | As described above                                                                                                                                                   |

<figure><img src="https://4217816688-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekZ3RZxqIxNNSkEFZ1%2Fuploads%2FfRWUDvfvax7kNg5jaaJQ%2FScreenshot%202024-07-22%20093605.png?alt=media&#x26;token=22665821-f47c-4d7c-a2cb-cc41a1ffa7b7" alt=""><figcaption><p><mark style="color:green;">Sample postman request</mark></p></figcaption></figure>

#### Sample Curl Command

```url
curl --location --request PUT 'http://localhost:8080/v2/signature/request' \
--header 'Content-Type: multipart/form-data' \
--form 'digestAlgorithm="SHA256"' \
--form 'signIdentityId="49o09dt4v47lvd2r14tesod0at"' \
--form 'txId="4f1068dbe3f64aefa45ada9555c9ba0b"' \
--form 'file=@"/C:path to file/file1.pdf"' \
--form 'file=@"/C:path to file/file2.pdf"' \
--form 'sigProp="{
  \"signPropDetail\": [
    {
      \"fileName\": \"file1.pdf\",
      \"signInfo\": \"1:50, 50, 200,200]\"

    },
    {
      \"fileName\": \"file2.pdf\",
      \"signInfo\": \"1:[50,50,200,200]\"
    }
  ]
}"'
```
