Proposal Ways API

API Base URL: https://proposalways.com/api/
API Site URL: https://proposalways.com/
Terms and Conditions: https://winsurtech.com/terms-and-conditions
SLA: https://winsurtech.com/winsurtech-rest-apis-service-level-agreement

Introduction

Proposal Ways API  makes it very easy to accomplish the following:

  1. Login
  2. Create Templates
  3. Create Proposals
  4. Template List
  5. Track Proposals
  6. Prepare Proposals
  7. Send Proposals
  8. Refresh Token
  9. Logout

Requirements

  • Register on https://proposalways.com/ before using the Proposalways API
  • If you are using POSTMAN to test the APIs then make sure you have POSTMAN version 5.3.0 or above, because below this version you won’t find the “Bearer token” in Authorization.

How to download postman collection

download postman

  • Import this collection to Postman. The secret key is automatically included in the postman collection.

API List

Login api

Request Method: POST
Endpoint: https://proposalways.com/api/login

Description

This endpoint allows you to login to ProposalWays with your mailbox credentials. You need to provide email , password. By providing these details, an access_token and Refresh token  is generated which is used to pull files and their content from the mailbox.

Input Parameters

Key (Body Parameter)

Value

email

Example: XXXXX@email.com

password

Example: XXXXXXXX


In the Body Parameters (all required):

  • email: registered email account with proposalways
  • password: password set by user at the time of registration

Success Sample JSON:

{
    "token_type": "Bearer",
    "expires_in": 1799,
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImE1MTQ0NGI5NzhjNmIzNDc4OTY2NTVkMzI5YjVmZWM3MzJlNTQ3OTk3NzVmYWE1YTNhNzMxN",
    "refresh_token": "def50200f0d26f531b621bb020d1efbc0e4b39730e3e26934acd22220a2d522ecdc6e941b118d8e973f8d5f640b9f30e774086fd9928db7737d2faa428bbe534fd34a8955"
}

Failure Sample JSON (in case of invalid credentials)

{
    "success": false,
    "error": "Unauthorised"
}

Failure Sample JSON (in case of blank credentials)

{
    "success": false,
    "error": {
        "email": [
            "This field is required"
        ],
        "password": [
            "This field is required"
        ]
    }
}

Postman Screenshot

login-api


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/login',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => array('email' => 'your.email@domain.com','password' => 'your@password'),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Create Template API

Request Method: POST
Endpoint: https://proposalways.com/api/create-template

Description

The Create Template endpoint is used to upload a file that becomes a template and it can be used any number of times to prepare and send proposals. You can upload files that have .docx format. You can also replace an existing template document using this endpoint by passing an existing unique_template_name. Once a template is uploaded, it will give you a success response and return a unique template code that can be used to call other endpoints.

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format

Input Parameters

Key (Params Parameter)

Value

template_file

Example: Use .docx or .pdf format files

unique_template_name

Example: Any Unique template name

replace_existing

Example: pass the yes or no value in it ,


Success Sample JSON

{
    "http_code": 200,
    "total_time": "8.90345",
    "status": true,
    "message": "output is generated",
    "output_format": "json",
    "output": {
        "unique_template_name": "WinsurTech Test 101",
        "unique_template_code": "NGWXED"
    }
}

Failure Sample JSON (in case template name is not unique and replace_existing is blank or false)

{
    "success": false,
    "error": "A Template with this name already exists, please try with a different one."
}

Failure Sample JSON (in case of insufficient inputs)

{
    "success": false,
    "error": {
        "template_file": [
            "This field is required"
        ],
        "unique_template_name": [
            "This field is required"
        ]
    }
}

Failure Sample JSON (in case of invalid template file extension)

{
    "success": false,
    "error": "Only .docx, .pptx,.pdf formats are allowed"
}

Postman Screenshot

Create-template

Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/create-template',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => array('template_file'=> new CURLFILE('/your_folder/docs/creek Hollow 2019 Proposal.docx'),'unique_template_name' => 'WinsurTech',),
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQyZjViNTMxOTUxODEx',
   'Accept: application/json'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Create Proposal API

Request Method: POST
Endpoint: https://proposalways.com/api/create-proposal

Description

This endpoint is used to create proposals from the templates created in your account. This endpoint takes unique_template_code as input and returns back a unique_proposal_code which is the id for the proposal just prepared and it is the required parameter to call some other endpoints.

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format

Input Parameters

Key (Params Parameter)

Value

unique_template_code

Example: QLKT3K

unique_template_name

Example: template670


Postman Screenshot

createproposal


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/create-proposal',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => 'template_code=6M7OYZ',
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQyZjViNTMxOTUxO',
   'Accept: application/json',
   'Content-Type: application/x-www-form-urlencoded'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Template List API

Request Method: GET
Endpoint: https://proposalways.com/api/template-list

Description

This endpoint gives you the information about your templates like id, template-code, unique-template-name, template-file-name and created timestamp in json format.

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format


Postman Screenshot

templatelist


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/template-list',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'GET',
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQyZjViNTMxOTUxODExY2M',
   'Accept: application/json'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Track Proposal API

Request Method: POST
Endpoint: https://proposalways.com/api/track-proposal

Description

This endpoint is used to track your proposal status. It takes unique_proposal_code as input and returns the status of the proposal and other information like unique_proposal_name, unique_proposal code, proposal status

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format

Input Parameters

Key (Params Parameter)

Value

unique_proposal_code

Example: B7557K


Postman Screenshot

trackproposal


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/track-proposal',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => array('unique_proposal_code' => 'K1658Y'),
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQyZjViNTMxOTUxODExY',
   'Accept: application/json'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Prepare Proposal API

Request Method: POST
Endpoint: https://proposalways.com/api/prepare-proposal

Description

This endpoint is used to prepare proposals (after creating them) before you send them to your prospective users. Before preparing a proposal you have to create the proposal using Create Proposal endpoint. This endpoint takes unique_proposal_code and variable replacement json content which will set your desired values in the document to prepare the template with the variable data specific to your customer.

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format

Input Parameters

unique_proposal_code *
input_json *

Sample JSON

{
    "unique_proposal_code": "S5987S",
    "input_json": {
        "JsonData": [
            {
                "fieldtype": "table",
                "fieldName": "table_birth_certificate",
                "values": [
                    {
                        "date": "22 Jan, 2021",
                        "location": "Alaska",
                        "address": "142 Creek Hollow Lane Middleburg,Florida 32068",
                        "description": "When an unknown printer took a galley of type"
                    }
                ]
            },
            {
                "sendTo": [
                    "abc@xyz.com"
                ]
            }
        ]
    }
}


Postman Screenshot

prepareproposal


Sample code in PHP

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://proposalways.com/api/prepare-proposal',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "unique_proposal_code": "S5987S",
    "input_json": {
        "JsonData": [
            {
                "fieldtype": "table",
                "fieldName": "table_birth_certificate",
                "values": [
                    {
                        "date": "22 Jan, 2021",
                        "location": "Alaska",
                        "address": "142 Creek Hollow Lane Middleburg,Florida 32068",
                        "description": "When an unknown printer took a galley of type"
                    }
                ]
            },
            {
                "sendTo": [
                    "ankush.garg@webners.com"
                ]
            }
        ]
    }
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjQw..........HYfaEWKztRjT6k',
    'Accept: application/json',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Send Proposal API

Request Method: POST
Endpoint: https://proposalways.com/api/send-proposal

Description

This endpoint is used to send prepared proposals to your prospective users. This endpoint takes unique_proposal_code, Due_date and proposal_message as input and returns a summary of the status and email ids of recipients.

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format

Input Parameters

Key (Params Parameter)

Value

unique_proposal_code

Example: B7557K

due_date

Example: yyyy-mm-dd

proposal_message

Example: Any Message to send the proposal


Postman Screenshot

sendproposal


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/send-proposal',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_POSTFIELDS => array('unique_proposal_code' => 'K1658Y','due_date' => '2021-12-25','proposal_message' => 'Sample message'),
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI',
   'Accept: application/json'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Refresh Token API

Request Method: POST
Endpoint: https://proposalways.com/api/refresh

Description

The Refresh Token endpoint is used to get a new Auth access token while passing a refresh token which was received in Login API/Refresh Token API so that currently login user stay active in App.

Input Parameters

Key (Params Parameter)

Value

refreshToken

Example: Added the refresh token returned by the login API


Success Sample JSON:

                {
                    "token_type": "Bearer",
                    "expires_in": 2592000,
                    "access_token": "new access token key",
                    "refresh_token": "refresh token key"
                }
                

Postman Screenshot

refreshToken


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://proposalways.com/api/refresh',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('refreshToken' => 'def50200b53ff2043a442c70e58dd4216e719a1b76e1b4dc3cec3b80903ef5f'),
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json'
  ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;

Logout API

Request Method: POST
Endpoint: https://proposalways.com/api/logout

Description

This endpoint is used to Logout from API

Headers

Authorization

Value

Bearer token

Example: Added the access token returned by the login API

Accept: application/json

Example: to receive data in json format


Failure JSON (in case of invalid credentials):

{
    "http_code": 401,
    "total_time": "0.16094",
    "status": true,
    "message": "You are not authorized to complete this request, please login and try again!",
    "output_format": "json",
    "output": []
}

Postman Screenshot

logout


Sample code in PHP

$curl = curl_init();
 
curl_setopt_array($curl, array(
 CURLOPT_URL => 'https://proposalways.com/api/logout',
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'POST',
 CURLOPT_HTTPHEADER => array(
   'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0a',
   'Accept: application/json'
 ),
));
 
$response = curl_exec($curl);
 
curl_close($curl);
echo $response;