### Get All Proposals API Request Examples Source: https://betterproposals.io/resources/api/index Examples of how to fetch all proposals using the Better Proposals API. These snippets demonstrate making a GET request to the /proposal endpoint with pagination and type filtering, including the necessary API token in the request headers. ```php $url = "https://api.betterproposals.io/proposal/?page=1&per_page=10&type=1"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/proposal?page=1&per_page=10&type=1", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/proposal?page=1&per_page=10&type=1 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### Fetch Opened Proposals with NodeJS Source: https://betterproposals.io/resources/api/index This example shows how to retrieve opened proposals using the 'request' module in NodeJS. It defines the API endpoint, authentication token, and a callback function to process the JSON response. Ensure the 'request' module is installed (`npm install request`). ```javascript var request = require('request'); var options = { "url": "https://api.betterproposals.io/proposal/opened?page=1&per_page=10&type=1", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` -------------------------------- ### Get All Templates with Pagination (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index Fetches a list of all templates from the API, supporting pagination with 'page' and 'per_page' parameters. Requires an API token for authentication. Includes examples for PHP, NodeJS, and CURL. ```php $url = "https://api.betterproposals.io/template/?page=1&per_page=10"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/template?page=1&per_page=10", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/template?page=1&per_page=10 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### Retrieve Paid Proposals with Filtering (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index These examples demonstrate how to fetch paid proposals from the Better Proposals API. They show how to construct the request URL with parameters like 'page', 'per_page', and 'type', and how to include the necessary authentication header ('Bptoken'). The PHP example uses cURL, the NodeJS example uses the 'request' module, and the CURL example shows a direct command-line implementation. All examples return JSON responses that can be parsed to access proposal data. ```php $url = "https://api.betterproposals.io/proposal/paid/?page=1&per_page=10&type=1"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/proposal/paid?page=1&per_page=10&type=1", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/proposal/paid?page=1&per_page=10&type=1 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### GET /settings Source: https://betterproposals.io/resources/api/index Retrieves general account settings. ```APIDOC ## GET /settings ### Description Retrieves general account settings. ### Method GET ### Endpoint /settings ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```curl curl https://api.betterproposals.io/settings \ -H "Bptoken: YOUR_API_TOKEN" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request. - **data** (object) - Contains the account settings. - **ID** (string) - The settings ID. - **AccountID** (string) - The account ID. - **CurrencyID** (string) - The currency ID. - **Tax** (string) - The tax rate. - **TaxLabel** (string) - The tax label. - **TaxAmount** (string) - The tax amount. - **TimeZone** (string) - The account's time zone. - **EditedBy** (string) - The user ID of the last editor. - **DateEdited** (string) - The date and time when the settings were last edited. #### Response Example ```json { "status": "success", "data": { "ID": "1", "AccountID": "1", "CurrencyID": "1", "Tax": "0", "TaxLabel": "", "TaxAmount": "0.00", "TimeZone": "Europe/London", "EditedBy": "173", "DateEdited": "2018-05-01 16:18:49" } } ``` ``` -------------------------------- ### Get All Document Types with Pagination (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index Fetches a list of all document types, supporting pagination with 'page' and 'per_page' parameters. Authentication is done via an API token. Examples are provided for PHP, NodeJS, and CURL. ```php $url = "https://api.betterproposals.io/doctype/?page=1&per_page=10"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/doctype?page=1&per_page=10", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/doctype?page=1&per_page=10 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### GET /template Source: https://betterproposals.io/resources/api/index Retrieves a list of all available templates. ```APIDOC ## GET /template ### Description Retrieves a list of all available templates. ### Method GET ### Endpoint /template ### Parameters None ### Request Example None ### Response #### Success Response (200) [Details about the structure of the response for getting all templates would go here, including example fields and their types.] #### Response Example [Example JSON response for getting all templates would go here.] ### Possible errors: None specified for this endpoint in the provided text. ``` -------------------------------- ### Get All Templates Information Source: https://betterproposals.io/resources/api/index This endpoint retrieves a list of all available templates. It is a GET request to the '/template' path. No specific parameters are mentioned for this endpoint, suggesting it returns all templates by default. ```text GET /template ``` -------------------------------- ### Get Opened Proposals Endpoint Documentation Source: https://betterproposals.io/resources/api/index This documentation describes the GET /proposal/opened API endpoint. It is used to retrieve a list of proposals that are currently open or active. No specific request body or parameters are detailed, implying it might return all opened proposals by default or rely on authentication headers. ```http GET /proposal/opened ``` -------------------------------- ### Get Company Details with PHP, NodeJS, and CURL Source: https://betterproposals.io/resources/api/index This snippet demonstrates how to fetch details for a specific company using its ID. Examples are provided for PHP, NodeJS (using the 'request' module), and CURL. Replace ':COMPANY_ID' with the actual company ID and 'YOUR_API_TOKEN' with your API token. The response will contain the status and the detailed data of the specified company. ```php $url = "https://api.betterproposals.io/company/:COMPANY_ID/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/company/:COMPANY_ID", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/company/:COMPANY_ID \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### GET /currency Source: https://betterproposals.io/resources/api/index Retrieves a list of all available currencies. Supports pagination. ```APIDOC ## GET /currency ### Description Retrieves a list of all currencies supported by BetterProposals, with optional pagination. ### Method GET ### Endpoint https://api.betterproposals.io/currency/ ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **per_page** (integer) - Optional - The number of results per page. Defaults to 10. ### Request Example ``` curl https://api.betterproposals.io/currency?page=1&per_page=10 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **data** (array) - An array of currency objects. - **ID** (string) - The unique identifier for the currency. - **CurrencyName** (string) - The full name of the currency. - **CurrencySymbol** (string) - The symbol for the currency. - **CurrencyCode** (string) - The ISO currency code. - **ZeroDecimal** (string) - Indicates if the currency uses zero decimals (e.g., '1' for yes, '0' for no). - **StripeSupport** (string) - Indicates if Stripe supports this currency ('1' for yes, '0' for no). - **PaypalSupport** (string) - Indicates if PayPal supports this currency ('1' for yes, '0' for no). #### Response Example ```json { "status": "success", "data": [ { "ID": "1", "CurrencyName": "Great British Pounds (GBP)", "CurrencySymbol": "£", "CurrencyCode": "GBP", "ZeroDecimal": "0", "StripeSupport": "1", "PaypalSupport": "0" } ] } ``` ``` -------------------------------- ### GET /settings/brand Source: https://betterproposals.io/resources/api/index Retrieves brand-specific settings for proposals. ```APIDOC ## GET /settings/brand ### Description Retrieves brand-specific settings for proposals. ### Method GET ### Endpoint /settings/brand ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```curl curl https://api.betterproposals.io/settings/brand \ -H "Bptoken: YOUR_API_TOKEN" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request. - **data** (object) - Contains the brand settings. - **ID** (string) - The brand setting ID. - **AccountID** (string) - The account ID. - **Default** (string) - Indicates if this is the default brand setting. - **PageTitle** (string) - The title displayed on proposal pages. - **Name** (string) - The name of the brand. - **CurrencyID** (string) - The currency ID. - **Tax** (string) - The tax rate. - **TaxLabel** (string) - The tax label. - **TaxAmount** (string) - The tax amount. - **ShowBadge** (string) - Indicates if the BetterProposals badge is shown. - **CompanyName** (string) - The company name. - **DateCreated** (string|null) - The date and time when the brand setting was created. - **CreatedBy** (string|null) - The user ID of the creator. - **DateEdited** (string) - The date and time when the brand setting was last edited. - **EditedBy** (string) - The user ID of the last editor. - **Deleted** (string) - Indicates if the brand setting is deleted. #### Response Example ```json { "status": "success", "data": { "ID": "4", "AccountID": "1", "Default": "1", "PageTitle": "Proposal Preview", "Name": "*Test? Account's", "CurrencyID": "1", "Tax": "1", "TaxLabel": "VAT", "TaxAmount": "20.00", "ShowBadge": "1", "CompanyName": "*Test? Account's", "DateCreated": null, "CreatedBy": null, "DateEdited": "2018-05-13 12:45:48", "EditedBy": "173", "Deleted": "0" } } ``` ``` -------------------------------- ### GET /template Source: https://betterproposals.io/resources/api/index Retrieves a list of templates with optional pagination. Allows filtering by page number and items per page. ```APIDOC ## List Templates ### Description Retrieves a list of templates with optional pagination. ### Method GET ### Endpoint /template ### Query Parameters - **page** (integer) - Optional - Default: 1 - The page number to retrieve. - **per_page** (integer) - Optional - Default: 10 - The number of templates to return per page. ### Request Example ```json { "example": "GET /template?page=1&per_page=10" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **data** (array) - An array of template objects. - **ID** (string) - The unique identifier for the template. - **AccountID** (string) - The identifier for the account the template belongs to. - **TemplateName** (string) - The name of the template. - **DateCreated** (string) - The date and time the template was created. - **DateEdited** (string) - The date and time the template was last edited. - **Default** (string) - Indicates if the template is the default one. - **Deleted** (string) - Indicates if the template has been deleted. #### Response Example ```json { "status": "success", "data": [ { "ID": "3", "AccountID": "1", "CoverID": null, "BrandID": "4", "TemplateName": "Default Template", "Description": null, "QuoteAmount": null, "MonthlyAmount": null, "QuarterlyAmount": null, "AnnualAmount": null, "DateCreated": "2014-09-19 17:33:38", "CreatedBy": "21", "DateEdited": "2017-08-01 19:11:58", "EditedBy": "173", "Default": "1", "Deleted": "1", "IndustryID": null, "SampleTemplate": "0", "FromMarketplace": "0", "CategoryID": null } ] } ``` ``` -------------------------------- ### Get All Quotes Source: https://betterproposals.io/resources/api/index Retrieves a list of all quotes available in the account. ```APIDOC ## Get all quotes ### Description Retrieves a list of all quotes available in the account. ### Method GET ### Endpoint /quote ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation ('success'). - **data** (array) - An array of quote objects. - **ID** (integer) - The unique identifier for the quote type. - **TypeName** (string) - The name of the quote type. - **TypeIcon** (string) - The icon associated with the quote type. - **TypeColour** (string) - The color associated with the quote type. - **TypeNameSingular** (string) - The singular name of the quote type. - **NumberOfOutstandingDocuments** (integer) - The number of outstanding documents of this type. - **NumberOfTemplates** (integer) - The number of templates of this type. #### Response Example ```json { "status": "success", "data": [ { "ID": 1, "TypeName": "Proposals", "TypeIcon": "__", "TypeColour": "#ED5373", "TypeNameSingular": "Proposal", "NumberOfOutstandingDocuments": 4, "NumberOfTemplates": 2 }, { "ID": 2, "TypeName": "Quotes", "TypeIcon": "__", "TypeColour": "#41D37F", "TypeNameSingular": "Quote", "NumberOfOutstandingDocuments": 0, "NumberOfTemplates": 0 } ] } ``` ``` -------------------------------- ### GET /proposal/new Source: https://betterproposals.io/resources/api/index Retrieves a list of new proposals. Supports pagination and filtering by document type. ```APIDOC ## GET /proposal/new ### Description Retrieves a list of new proposals. Supports pagination and filtering by document type. ### Method GET ### Endpoint /proposal/new ### Parameters #### Query Parameters - **page** (integer) - Optional - Default: 1. The page number for pagination. - **per_page** (integer) - Optional - Default: 10. The number of proposals to return per page. - **type** (integer) - Optional - DocumentTypeID for filtering proposals. ### Request Example ``` https://api.betterproposals.io/proposal/new/?page=1&per_page=10&type=1 ``` ### Response #### Success Response (200) - **proposals** (array) - A list of proposal objects. - **id** (integer) - The unique identifier for the proposal. - **template_id** (integer) - The ID of the template used for the proposal. - **title** (string) - The title of the proposal. - **description** (string) - A description of the proposal. - **status** (string) - The current status of the proposal. - **created_at** (string) - The timestamp when the proposal was created. - **updated_at** (string) - The timestamp when the proposal was last updated. #### Response Example ```json { "proposals": [ { "id": 123, "template_id": 45, "title": "New Business Proposal", "description": "Proposal for a new client.", "status": "draft", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:30:00Z" } ] } ``` ``` -------------------------------- ### Get All Proposals Source: https://betterproposals.io/resources/api/index Retrieves a list of all proposals. Supports pagination and filtering by document type. ```APIDOC ## GET /proposal ### Description Retrieves a list of all proposals. Supports pagination and filtering by document type. ### Method GET ### Endpoint /proposal ### Parameters #### Query Parameters - **page** (integer) - Optional - Default: 1. The page number for pagination. - **per_page** (integer) - Optional - Default: 10. The number of proposals to return per page. - **type** (integer) - Optional - DocumentTypeID for filtering proposals. ### Request Example ``` GET /proposal?page=1&per_page=10&type=1 ``` ### Response #### Success Response (200) - **proposals** (array) - An array of proposal objects. - **proposal_id** (integer) - The ID of the proposal. - **proposal_name** (string) - The name of the proposal. - **client_id** (integer) - The ID of the client associated with the proposal. - **created_at** (string) - The timestamp when the proposal was created. - **updated_at** (string) - The timestamp when the proposal was last updated. #### Response Example ```json { "proposals": [ { "proposal_id": 123, "proposal_name": "Sample Proposal", "client_id": 456, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T11:00:00Z" } ] } ``` ### Possible errors: #### Invalid API Token ```json { "status": "error", "message": "Invalid token" } ``` #### Bad Request ```json { "status": "error", "message": "Malformed request" } ``` ``` -------------------------------- ### Get Template Details by ID (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index Retrieves specific details for a single template using its unique ID. Requires an API token for authentication. Examples are provided for PHP, NodeJS, and CURL. ```php $url = "https://api.betterproposals.io/template/:TEMPLATE_ID/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/template/:TEMPLATE_ID", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/template/:TEMPLATE_ID \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### Create Company using PHP, NodeJS, and CURL Source: https://betterproposals.io/resources/api/index Demonstrates how to create a new company via the API. Requires a company name and an API token. Returns status and data upon success. ```php $url = "https://api.betterproposals.io/company/create/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $data = http_build_query([ "CompanyName" => "Test Company", ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { url: "https://api.betterproposals.io/company/create/", headers: { Bptoken: "YOUR_API_TOKEN" }, form: { CompanyName: "Test Company" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request.post(options, callback); ``` ```curl curl -X POST https://api.betterproposals.io/company/create \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Bptoken: YOUR_API_TOKEN" \ -d "QUERY_STRING_OF_REQUEST" \ ``` -------------------------------- ### Get Specific Quote Details (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index This section shows how to retrieve details for a specific quote using its ID. Examples are provided for PHP, NodeJS, and CURL, demonstrating the use of the quote ID in the URL and the required API token for authentication. ```php $url = "https://api.betterproposals.io/quote/:QUOTE_ID/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/quote/:QUOTE_ID", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```curl curl https://api.betterproposals.io/quote/:QUOTE_ID \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### Fetch Signed Proposals with API Parameters (PHP, NodeJS, CURL) Source: https://betterproposals.io/resources/api/index Demonstrates how to fetch signed proposals from the Better Proposals API using common request parameters like page, per_page, and type. Includes examples for PHP (using cURL), NodeJS (using the 'request' module), and direct CURL commands. Requires a valid 'Bptoken' for authentication. The API returns a JSON response containing the proposal data. ```php $url = "https://api.betterproposals.io/proposal/signed/?page=1&per_page=10&type=1"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/proposal/signed?page=1&per_page=10&type=1", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```bash curl https://api.betterproposals.io/proposal/signed?page=1&per_page=10&type=1 \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### Get Proposal Details using PHP, NodeJS, and CURL Source: https://betterproposals.io/resources/api/index This snippet demonstrates how to retrieve proposal details from the BetterProposals API. It requires the proposal ID and an API token for authentication. The examples cover PHP (using cURL), NodeJS (using the 'request' module), and a command-line cURL request. ```php $url = "https://api.betterproposals.io/proposal/:PROPOSAL_ID/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` ```javascript // Example using 'request' module. var request = require('request'); var options = { "url": "https://api.betterproposals.io/proposal/:PROPOSAL_ID", "headers": { "Bptoken": "YOUR_API_TOKEN" } }; function callback(error, response, body) { var result = JSON.parse(body); // Do stuff with result. }; request(options, callback); ``` ```bash curl https://api.betterproposals.io/proposal/:PROPOSAL_ID \ -H "Bptoken: YOUR_API_TOKEN" \ ``` -------------------------------- ### POST /company/create Source: https://betterproposals.io/resources/api/index Creates a new company. ```APIDOC ## POST /company/create ### Description Creates a new company. ### Method POST ### Endpoint https://api.betterproposals.io/company/create ### Parameters #### Request Body *(Note: Specific fields for creating a company are not detailed in the provided text. Please refer to separate documentation or examples for required fields.)* ### Request Example *(Example not provided in the source text)* ### Response #### Success Response (200) *(Note: Specific success response fields for creating a company are not detailed in the provided text. Typically includes confirmation of creation and potentially the new company's ID.)* #### Response Example *(Example not provided in the source text)* ``` -------------------------------- ### Get total proposals Source: https://betterproposals.io/resources/api/index Retrieves the total number of proposals associated with your account. This endpoint is useful for getting a quick overview of your proposal volume. ```APIDOC ## Get total proposals ### Description Retrieves the total number of proposals. ### Method GET ### Endpoint /proposal/count ### Parameters This endpoint does not require any parameters. ### Request Example ```bash curl https://api.betterproposals.io/proposal/count \ -H "Bptoken: YOUR_API_TOKEN" ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the request. - **count** (integer) - The total number of proposals. #### Response Example ```json { "status": "success", "count": 245 } ``` ``` -------------------------------- ### Create Proposal Cover with PHP Source: https://betterproposals.io/resources/api/index This snippet demonstrates how to create a proposal cover using the BetterProposals API with PHP. It sends a POST request with necessary headers and form data to the API endpoint. Ensure you replace 'YOUR_API_TOKEN' with your actual API token. ```php $url = "https://api.betterproposals.io/proposal/cover/create/"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $data = http_build_query([ "BrandID" => 244, "CoverName" => "Untitled", "BGColour" => 111111, "Headline" => "Proposal for _________", "Subheader" => "Written by ________ for ________", "TextColour" => "ffffff", "TextAlign" => "left", "ButtonStyle" => "round", "ButtonText" => "Start Reading Proposal", ]); $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` -------------------------------- ### Fetch Opened Proposals with PHP Source: https://betterproposals.io/resources/api/index This snippet demonstrates how to fetch opened proposals using PHP with the cURL library. It constructs the API URL with query parameters and sets the necessary authentication header. The response is then decoded from JSON. ```php $url = "https://api.betterproposals.io/proposal/opened/?page=1&per_page=10&type=1"; $headers = [ "Bptoken: YOUR_API_TOKEN" ]; $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($curl); $result = json_decode($response); ``` -------------------------------- ### GET /template/:TEMPLATE_ID Source: https://betterproposals.io/resources/api/index Retrieves the details of a specific template by its ID. ```APIDOC ## Get Template Details ### Description Retrieves the details of a specific template using its unique identifier. ### Method GET ### Endpoint /template/:TEMPLATE_ID ### Path Parameters - **TEMPLATE_ID** (string) - Required - The unique identifier of the template. ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **data** (object) - An object containing the details of the template. - **ID** (string) - The unique identifier for the template. - **AccountID** (string) - The identifier for the account the template belongs to. - **TemplateName** (string) - The name of the template. - **DateCreated** (string) - The date and time the template was created. - **DateEdited** (string) - The date and time the template was last edited. - **Default** (string) - Indicates if the template is the default one. - **Deleted** (string) - Indicates if the template has been deleted. #### Response Example ```json { "status": "success", "data": { "ID": "205", "AccountID": "1", "CoverID": null, "BrandID": "4", "TemplateName": "An Architect Template", "Description": null, "QuoteAmount": null, "MonthlyAmount": null, "QuarterlyAmount": null, "AnnualAmount": null, "DateCreated": "2015-03-12 17:58:29", "CreatedBy": "173", "DateEdited": "2017-08-01 19:11:19", "EditedBy": "173", "Default": "0", "Deleted": "1", "IndustryID": "3", "SampleTemplate": "0", "FromMarketplace": "0", "CategoryID": null } } ``` ``` -------------------------------- ### Example JSON Response Structure Source: https://betterproposals.io/resources/api/index This JSON object represents a successful response from the Better Proposals API, containing details about a proposal. It includes proposal metadata, assigned contact information, and a breakdown of pricing tables with individual line items. Note that certain fields like 'Description' or 'SignedName' may be null if not applicable. ```json { "status": "success", "data": [ { "ID": "219014", "AssignedTo": "54137", "BrandID": "54438", "ViewType": "0", "CurrencyCode": "USD", "Tax": "0", "TaxLabel": "", "TaxAmount": "0.00", "Amount": "0.00", "AmountDesc": "", "Paid": "0", "DatePaid": null, "CoverID": "89034", "TypeID": "1", "Description": null, "SubjectLine": "Proposal from Testing Company", "PersonalMessage": "", "CustomerJourneyID": null, "DateCreated": "2022-06-13 07:40:08", "SignOrder": "0", "OriginalDateSent": "2022-06-13 11:02:30", "DateSent": "2022-06-13 11:02:30", "QuoteID": "222657", "Signed": "0", "SignedName": null, "SignedDate": null, "SignedTime": null, "EditLock": null, "ProposalPassword": "", "CompanyName": "Testing Company", "CompanyCRMID": null, "OneOffTotal": null, "MonthlyTotal": null, "QuarterlyTotal": null, "AnnualTotal": null, "SignedFirstName": null, "SignedSurname": null, "SignedEmail": null, "CurrencyName": "US Dollars (USD)", "CurrencySymbol": "$", "CRMOpportunityID": null, "Preview": "https://betterproposals.io/proposal/index?ProposalID=gNWJcnvJ8aFmMYnIFIw5940XU&debug=yes", "ProposalView": "https://betterproposals.io/2/proposals/view?id=98765", "Contacts": [ { "Email": "name@email.com", "FirstName": "John", "Surname": "Smith", "Link": "https://yourdomain.com/proposal/cover?ProposalID=VrfVkFB88IwTTRzFTzn695D2qtdgvaLg" } ], "PriceTables": [ { "ID": "1043", "Title": "Required Payments", "Show": true, "ForceClientChoice": false, "DateCreated": null, "DisplayOrder": 1, "Items": [ { "ID": "799704", "Label": "Web Development", "Description": "", "Date": null, "PriceType": "Amount", "UnitCost": "5000.75", "Cost": "5000.75", "RecurringType": "Monthly Payment", "MonthlyCost": "5000.75", "ShowQuantity": false, "CanClientSetQuantity": false, "Quantity": 1, "isQuantityLimited": false, "QuantityMin": 0, "QuantityMax": 1, "Optional": false, "Selected": false, "Selectable": false, "Discount": false, "DiscountType": false, "DiscountAmount": "0.00", "TableDiscount": false, "TableDiscountType": false, "TableDiscountAmount": "0.00", "TaxExemptionStatus": false, "DisplayOrder": 0 }, { "ID": "799705", "Label": "Custom Web Design", "Description": "", "Date": null, "PriceType": "Amount", "UnitCost": "2000.00", "Cost": "2000.00", "RecurringType": "One Time Payment", "MonthlyCost": "2000.00", "ShowQuantity": false, "CanClientSetQuantity": false, "Quantity": 1, "isQuantityLimited": false, "QuantityMin": 0, "QuantityMax": 1, "Optional": false, "Selected": false, "Selectable": false, "Discount": false, "DiscountType": false, "DiscountAmount": "0.00", "TableDiscount": false, "TableDiscountType": false, "TableDiscountAmount": "0.00" } ] } ] } ] } ``` -------------------------------- ### Example API Response Structure (JSON) Source: https://betterproposals.io/resources/api/index This JSON object represents a successful API response containing proposal data. It includes details like company information, pricing tables, and itemized costs. Note that some fields may be null if not applicable. ```json { "status": "success", "data": [ { "ID": "111111", "TaxPercentage": null, "Description": null, "SubjectLine": null, "OriginalDateSent": null, "TaxName": "Tax", "LastDateSent": null, "DateCreated": "2022-11-30 07:40:07", "EmailMessage": null, "TypeID": "1", "DateSigned": null, "SignedSignature": null, "DatePaid": null, "CompanyName": "Testing Company", "CompanyCRMID": null, "OneOffTotal": "500.00", "MonthlyTotal": "50.00", "QuarterlyTotal": "200.00", "AnnualTotal": "600.00", "SignedFirstName": null, "SignedSurname": null, "SignedEmail": null, "CurrencyName": "US Dollars (USD)", "CurrencySymbol": "$", "CurrencyCode": "USD", "PaidAmount": null, "BrandID": "11111", "CoverID": null, "QuoteID": "111111", "CRMOpportunityID": null, "Preview": "https://proposal.yourdomain.com/cover.php?ProposalID=r0dx2bBesN9JagJnhH_0g&debug=yes", "ProposalView": "https://betterproposals.io/2/proposals/view?id=222952", "PriceTables": [ { "ID": "1043", "Title": "Required Payments", "Show": true, "ForceClientChoice": false, "DateCreated": null, "DisplayOrder": 1, "Items": [ { "ID": "799704", "Label": "Web Development", "Description": "", "Date": null, "PriceType": "Amount", "UnitCost": "5000.75", "Cost": "5000.75", "RecurringType": "Monthly Payment", "MonthlyCost": "5000.75", "ShowQuantity": false, "CanClientSetQuantity": false, "Quantity": 1, "isQuantityLimited": false, "QuantityMin": 0, "QuantityMax": 1, "Optional": false, "Selected": false, "Selectable": false, "Discount": false, "DiscountType": false, "DiscountAmount": "0.00", "TableDiscount": false, "TableDiscountType": false, "TableDiscountAmount": "0.00", "TaxExemptionStatus": false, "DisplayOrder": 0 }, { "ID": "799705", "Label": "Custom Web Design", "Description": "", "Date": null, "PriceType": "Amount", "UnitCost": "2000.00", "Cost": "2000.00", "RecurringType": "One Time Payment", "MonthlyCost": "2000.00", "ShowQuantity": false, "CanClientSetQuantity": false, "Quantity": 1, "isQuantityLimited": false, "QuantityMin": 0, "QuantityMax": 1, "Optional": false, "Selected": false, "Selectable": false, "Discount": false, "DiscountType": false, "DiscountAmount": "0.00", "TableDiscount": false, "TableDiscountType": false, "TableDiscountAmount": "0.00", "TaxExemptionStatus": false, "DisplayOrder": 1 } ] } ] } ] } ```