# Requests

In the initial phase of the document upload process, upon successful completion, a document token is issued as a unique identifier for the uploaded document. This token plays a crucial role in the subsequent step, enabling the seamless initiation of a sign request associated with the uploaded document. Serving as a key element, the document token establishes a connection between the uploaded content and the sign request, enhancing the workflow for a more efficient and secure document signing experience.

## Document Endpoint

This API offers endpoints for handling document-related operations, including fetching document pages, and uploading documents to a rendering service. These operations require proper authorization through an access token included in the request header.

## **Document Upload**

This API endpoint facilitates the upload of documents to the Evia Sign platform.

<mark style="color:green;">`POST`</mark> `https://evia.enadocapp.com/_apis/sign/thumbs/api/Requests/document`

#### Headers

| Name          | Type   | Description                                   |
| ------------- | ------ | --------------------------------------------- |
| Authorization | Bearer | Access token should be sent as request header |

#### Request Body

| Name | Type | Description                                                                 |
| ---- | ---- | --------------------------------------------------------------------------- |
|      | File | The body contains the document data in a supported format. (PDF, DOC, DOCX) |

{% tabs %}
{% tab title="200: OK " %}
The body of the response contains the document data, formatted in a supported file type such as PDF, DOC, or DOCX. Ensure that the uploaded document adheres to the specified format requirements.
{% endtab %}
{% endtabs %}

### Response Body

The response body will include the document token for identification and reference purposes.

### Error Messages

| Error                      | Error Description       |
| -------------------------- | ----------------------- |
| If access token is invalid | Invalid access token    |
| If access token is expired | Access token is expired |

## Creating the Signature Request

This API endpoint enables the creation of a new signature request.&#x20;

Submit a **POST** request to the specified URL with the access token provided as a header to initiate the process.

<mark style="color:green;">`POST`</mark> `https://evia.enadocapp.com/api/Requests?type=1,2,3`

#### Headers

| Name          | Type   | Description                                   |
| ------------- | ------ | --------------------------------------------- |
| Authorization | Bearer | Access token should be sent as request header |

{% tabs %}
{% tab title="200: OK " %}
Upon successful creation, a status code of 200 is returned, confirming the successful initiation of the sign request.
{% endtab %}
{% endtabs %}

**Three Methods to Create a Sign Request**

| Type | Description                                           |
| ---- | ----------------------------------------------------- |
| 1    | Initiate Signature Request from Template              |
| 2    | Fixed Positioning for Standard Signature Request      |
| 3    | Auto Stamping - (This is under the development phase) |

**Request Body for Template**

```json
{
        "templateId": "05117898-90db-45e5-b6b8-0230fd326e4f",
        "signatories": 
        [
            {
                "roleId": "9e7bb576-a2da-9fdc-d99c-958063dcfa19",
                "signatoryUserName": "Alison",
                "signatoryUserEmail": "alison@gmail.com"
            },
            {
                "roleId": "dd0caa50-58e1-bf28-441b-556bf70d5fc0",
                "signatoryUserName": "Stev Smith",
                "signatoryUserEmail": "stev@gmail.com"
            },
            {
                "roleId": "0612c8de-52b0-dc18-9a95-447041ebbe56",
                "signatoryUserName": "Jhone doe",
                "signatoryUserEmail": "jhone@gmail.com"
            }
        ]
}
```

**Request Body for Fixed Positioning**

```json
{
  "Message": "Message",
  "Title": "Title",
  "IsParallelSign": true,
  "Documents": [
    "document token"
  ],
  "Signatories": [
    {
      "Color": "#7c95f4",
      "Email": "sample@gmail.com",
      "Name": "Jhone Doe",
      "Order": 1,
      "PrivateMessage": "Private Message",
      "signatoryType": 1,
      "OTP": {
        "IsRequired": true,
        "AccessCode": "12345",
        "Type": "2",
        "MobileNumber": "+94711234567"
      },
      "Stamps": [
        {
          "Color": "#7c95f4",
          "DocumentToken": "document token",
          "Order": 1,
          "Location": {
            "X": 100.5,
            "Y": 105.5
          },
          "StampSize": {
            "Height": 50,
            "Width": 100
          },
          "PageNumber": 1,
          "PageHeight": 1000,
          "PageWidth": 500,
          "Type": "signature"
        }
      ]
    }
  ]
}

```

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sign.enadocapp.com/evia-sign-api/v1/requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
