{"_id":"56ebae2543304e2900e21142","category":{"_id":"5715baa9810df00e00cc7837","project":"56e29a8dd3b68d0e00b48ffa","__v":0,"version":"56e29a8dd3b68d0e00b48ffd","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-04-19T04:57:13.380Z","from_sync":false,"order":6,"slug":"coverage","title":"Covers"},"editedParams2":true,"parentDoc":null,"user":"56e62c36cfa58f0e00eafcfb","__v":8,"version":{"_id":"56e29a8dd3b68d0e00b48ffd","hasReference":true,"project":"56e29a8dd3b68d0e00b48ffa","__v":15,"hasDoc":true,"createdAt":"2016-03-11T10:14:37.460Z","releaseDate":"2016-03-11T10:14:37.460Z","categories":["56e29a8ed3b68d0e00b48ffe","56eb917a2e58011700afdfcc","56eb92252109011700f3ba5e","5704d4af849f721900f27835","57052a31473f900e004d5d54","5715222811537f19006aab2d","5715b57b810df00e00cc7832","5715baa9810df00e00cc7837","57180ed83a17770e009a7322","571810273a17770e009a7325","579b22d3f4ad7b190094b60e","584538ecba4f1c0f0096925e","586bb88e5602870f00ae7177","5a70407fb0a01400369583c5","5ace359e40606a0003eac1de"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"editedParams":true,"githubsync":"","project":"56e29a8dd3b68d0e00b48ffa","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-18T07:28:37.303Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n// Example assumes Composer is in use with GuzzleHttp as the API library.\nrequire_once(\"vendor/autoload.php\");\nuse GuzzleHttp\\Client;\n\n// Production environment endpoint\n// $api_base_uri = 'https://api.single-invoice.co/v2.0';\n\n// Sandbox environment endpoint\n$api_base_uri = 'https://api-demo.single-invoice.co/v2.0';\n\n// Create a client and provide a base URL\n$client = new Client([ \n\t'timeout' \t=> 8.0,\n\t'verify'\t=> true,\n\t'debug'\t\t=> true\n]);\n\ntry\n{\n\t$apikey = \"oJeR4lLl9xhZscZPyBhVYhlIYhdVntBavblUIqw0wPhr6eBkGvx04gAgA8JkCdrU\";\n\t\n\t$response = $client->request('POST', $api_base_uri.\"/coverage\", [\n\t\t'headers' => [ 'apikey' => $apikey ],\n\t\t'json' => \t[\n\t\t\t\t\t\t'sellerid' => '1144d2bb-a349-c8a0-84c8-e36ebbf8622b', \n\t\t\t\t\t\t'buyerid' => '0bc29fe2-d310-2d06-1f3f-7ab71a51e89b', \n\t\t\t\t\t\t'invoice' => [ \n\t\t\t\t\t\t\t\t\t\t\"amount\" =>  100000.0,\n\t\t\t\t\t\t\t\t\t\t\"currency\" =>  \"eur\",\n\t\t\t\t\t\t\t\t\t\t\"dueAt\"  =>  \"2016-08-31T13:40:00Z\",\n\t\t\t\t\t\t\t\t\t\t\"issuedAt\"  =>  \"2016-07-25T09:40:00Z\",\n              \t\t\t\"number\" => \"14491-a\" // Optional invoice number\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t]\n\t]);\n\n\t// Check the status code returned by the call\n\t$statusCode = $response->getStatusCode();\n\n\t// Get the data\n\t$data = json_decode($response->getBody(), true);\n}\ncatch (GuzzleHttp\\Exception\\ClientException $e) {\n    $response = $e->getResponse();\n    $responseBodyAsString = $response->getBody()->getContents();\n}"},{"language":"javascript","code":"// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\nvar rp = require('request-promise');\n\n var apiBaseUri = 'https://api.armadill.io/v2.0';\nvar apikey = 'oJeR4lLl9xhZscZPyBhVYhlIYhdVntBavblUIqw0wPhr6eBkGvx04gAgA8JkCdrU';\n\nrp({\n  method: 'POST',\n  uri: apiBaseUri + '/coverage',\n  headers: {\n    apikey: apikey,\n  },\n  body: {\n    sellerid : \"1144d2bb-a349-c8a0-84c8-e36ebbf8622b\",\n    buyerid : \"0bc29fe2-d310-2d06-1f3f-7ab71a51e89b\",\n    invoice : {\n      amount: 100000.0,\n      currency: \"eur\",\n      dueAt : \"2016-10-10\",\n      issuedAt : \"2016-08-10\",\n\t\t\tnumber : \"14491-a\" // Optional invoice number\n    }\n  },\n  json: true\n})\n  .then(function (res) {\n    // request succeeded, the result is available in the res object\n    console.log(res);\n  })\n  .catch(function (err) {\n    // request failed, the error is available in the err object\n    console.log(err);\n  });\n"},{"code":"curl -H \"apikey: [your api key here]\" -H \"Content-Type: application/json\" --data-binary \":::at:::invoice.json\" https://api-demo.single-invoice.co/v2.0/coverage -v","language":"curl"}]},"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{\n    \"id\": \"0ae2f4b9-a85c-4776-bfba-b2d569c90256\",\n    \"status\": \"Pending\",\n    \"coverage\": {\n        \"currency\": \"EUR\",\n        \"quotedAt\": \"2018-01-14T23:31:37Z\",\n        \"duration\": 60,\n        \"bpsperday\": 0.4,\n        \"coverPrice\": 0.24\n    },\n    \"sellerId\": \"fdb3990c-b34e-4790-8233-b79358349e6c\",\n    \"buyerId\": \"b7663697-6c94-42b2-a11a-d842aa5ccdfa\",\n    \"invoice\": {\n        \"Amount\": 100,\n        \"Currency\": \"EUR\",\n        \"DueAt\": \"2018-03-14T23:31:26Z\",\n        \"IssuedAt\": \"2018-01-14T23:31:26Z\",\n        \"Number\": \"TEST1515972686\"\n    }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"message\" : \"Bad policy reuqest data\",\n  \"docUrl\": \"https://armadill.io/docs/errors#section-bad-policy-request\"\n}","name":""},{"status":408,"language":"json","code":"{\n\t\"message\" : \"Expired date stamp\",\n  \"docUrl\": \"https://creditshield.io/docs/authentication\"\n}"},{"code":"{\n    \"Code\": 5001,\n    \"Message\": \"Company not found.\",\n    \"Description\": null,\n    \"DocUrl\": \"TBD\"\n}","language":"text","status":404}]},"settings":"","auth":"required","params":[{"_id":"5702973618ad001700a29496","ref":"","in":"body","required":false,"desc":"JSON containing buyer, seller and invoice information","default":"","type":"object","name":"body"},{"_id":"579e4a548cc49e0e00dea8c1","ref":"","in":"header","required":true,"desc":"Your Coverage API Key, in the HTTP request headers.","default":"","type":"string","name":"apikey"}],"url":"/coverage"},"isReference":true,"order":0,"body":"The Request Quote endpoint provides the means for users to obtain insurance coverage quotes for invoices. \n\nIt requires the following inputs: \n* Buyer ID - the Single-Invoice.co transactor ID of the buyer\n* Seller ID - the Single-Invoice.co transactor ID of the seller/supplier\n* Invoice amount - the total amount on the invoice requiring coverage\n* Invoice currency - the three letter abbrevation for the invoice currency (e.g., \"eur\" for Euros, \"gbp\" for pounds sterling, \"usd\" for US dollars)\n* Invoice issue date - the date the invoice was issued, as an ISO 8601 timestamp \n* Invoice due date - the date the invoice is due for payment, as an ISO 8601 timestamp \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Dealing with daylight saving\",\n  \"body\": \"Please note that when dealing with dates, the timezone may need special attention as changes to daylight savings time may affect the overall quote duration.\"\n}\n[/block]\nOnce these are submitted to the endpoint via a POST request, Single-Invoice.co will provide a quote response, which will include information about whether or not the quote was accepted and the pricing (see the \"Results\" section above for a sample response). \n\nThe 'status' field in the response will inform the user as to the outcome of the request. The two most important values for this field after issuing a request for a quote are \"Pending\"  and \"Rejected\". (There are other values for this field; please see the [Get Cover By ID](doc:coverage-by-id) page for a full list of the status types.)\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Pricing in the Sandbox\",\n  \"body\": \"Please note that if you're using our Sandbox environment for development or testing, the pricing returned in our Sandbox environment may not be reflective or indicative of the true pricing, or availability of coverage. Quotes in the Sandbox environment are not binding.\"\n}\n[/block]\n## Pending\n\nThe \"Pending\" result means that Single-Invoice.co is able to provide coverage for this particular invoice. The cost of the coverage is also supplied with the response. \n\nUsers then will evaluate the cost based on their requirements and decide whether or not to proceed. Quotes are valid for a set period (dictated by your policy); at any time during this period they can be accepted (or rejected) by the user. After the period, the quote will automatically be expired by the system and will no longer be available; a new quote will need to be made for the invoice.\n\nIf the user is happy with the quote and wishes to proceed, the next step is to [Activate](doc:coverage-activation) the coverage. Alternatively, if coverage is not required for this invoice, the [Reject](doc:coverage-rejection) method would be used. \n\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"`coverage` output fields\",\n  \"body\": \"Note that the `coverage` section of the quote response may look slightly different to what is in the example; fields may be present or missing depending on specifics of your policy due to differences in the pricing system that we use. \\n\\nThe default mode includes the following fields:\\n- currency: the relevant currency for the cost of the coverage\\n- quotedAt: a timestamp showing what time the quote was delivered.\\n- duration: the period of coverage (in days) that is being offered. Typically, coverage is calculated to the invoice due date. For example, coverage starting today and due tomorrow would return a duration of 2.\\n- bpsperday: the rate we are offering for insurance in \\\"basis points per day\\\". \\n- coverPrice: the total cost of the coverage (inclusive of any fees and taxes). coverPrice is calculated from the bpsperday rate: coverPrice = coverage.bpsperday/10000 x invoice.Amount x coverage.duration\\n\\nThere are several possible additional fields which may be included depending on your policy. These include (but may not be limited to): \\n- serviceFee: The calculated total cost of any fees relating to servicing the coverage  (in the currency specified in the `coverage` section).\\n- vat: calculated sales tax component (in the currency specified in the `coverage` section). Note that we currently use the term 'vat' to describe any sales tax.\"\n}\n[/block]\n## Rejected\n\nThe \"Rejected\" result means that Single-Invoice.co cannot provide coverage for the supplied invoice. \n\nIf an invoice is marked as rejected, it will also include a new \"rejectedby\" field in the coverage section with the name of the rejecting party. If it's rejected by the API, this field will typically be \"Single-Invoice.co\", but if it's rejected by the user it will be simply be \"User\".","excerpt":"Gets a new quote for a given buyer, seller and invoice. The buyer, seller and invoice details are specified as JSON in the request body.","slug":"get-quote","type":"endpoint","title":"Request Quote"}

postRequest Quote

Gets a new quote for a given buyer, seller and invoice. The buyer, seller and invoice details are specified as JSON in the request body.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

body:
object
JSON containing buyer, seller and invoice information

Headers

apikey:
required
string
Your Coverage API Key, in the HTTP request headers.

Examples


Result Format


Documentation

The Request Quote endpoint provides the means for users to obtain insurance coverage quotes for invoices. It requires the following inputs: * Buyer ID - the Single-Invoice.co transactor ID of the buyer * Seller ID - the Single-Invoice.co transactor ID of the seller/supplier * Invoice amount - the total amount on the invoice requiring coverage * Invoice currency - the three letter abbrevation for the invoice currency (e.g., "eur" for Euros, "gbp" for pounds sterling, "usd" for US dollars) * Invoice issue date - the date the invoice was issued, as an ISO 8601 timestamp * Invoice due date - the date the invoice is due for payment, as an ISO 8601 timestamp [block:callout] { "type": "warning", "title": "Dealing with daylight saving", "body": "Please note that when dealing with dates, the timezone may need special attention as changes to daylight savings time may affect the overall quote duration." } [/block] Once these are submitted to the endpoint via a POST request, Single-Invoice.co will provide a quote response, which will include information about whether or not the quote was accepted and the pricing (see the "Results" section above for a sample response). The 'status' field in the response will inform the user as to the outcome of the request. The two most important values for this field after issuing a request for a quote are "Pending" and "Rejected". (There are other values for this field; please see the [Get Cover By ID](doc:coverage-by-id) page for a full list of the status types.) [block:callout] { "type": "warning", "title": "Pricing in the Sandbox", "body": "Please note that if you're using our Sandbox environment for development or testing, the pricing returned in our Sandbox environment may not be reflective or indicative of the true pricing, or availability of coverage. Quotes in the Sandbox environment are not binding." } [/block] ## Pending The "Pending" result means that Single-Invoice.co is able to provide coverage for this particular invoice. The cost of the coverage is also supplied with the response. Users then will evaluate the cost based on their requirements and decide whether or not to proceed. Quotes are valid for a set period (dictated by your policy); at any time during this period they can be accepted (or rejected) by the user. After the period, the quote will automatically be expired by the system and will no longer be available; a new quote will need to be made for the invoice. If the user is happy with the quote and wishes to proceed, the next step is to [Activate](doc:coverage-activation) the coverage. Alternatively, if coverage is not required for this invoice, the [Reject](doc:coverage-rejection) method would be used. [block:callout] { "type": "info", "title": "`coverage` output fields", "body": "Note that the `coverage` section of the quote response may look slightly different to what is in the example; fields may be present or missing depending on specifics of your policy due to differences in the pricing system that we use. \n\nThe default mode includes the following fields:\n- currency: the relevant currency for the cost of the coverage\n- quotedAt: a timestamp showing what time the quote was delivered.\n- duration: the period of coverage (in days) that is being offered. Typically, coverage is calculated to the invoice due date. For example, coverage starting today and due tomorrow would return a duration of 2.\n- bpsperday: the rate we are offering for insurance in \"basis points per day\". \n- coverPrice: the total cost of the coverage (inclusive of any fees and taxes). coverPrice is calculated from the bpsperday rate: coverPrice = coverage.bpsperday/10000 x invoice.Amount x coverage.duration\n\nThere are several possible additional fields which may be included depending on your policy. These include (but may not be limited to): \n- serviceFee: The calculated total cost of any fees relating to servicing the coverage (in the currency specified in the `coverage` section).\n- vat: calculated sales tax component (in the currency specified in the `coverage` section). Note that we currently use the term 'vat' to describe any sales tax." } [/block] ## Rejected The "Rejected" result means that Single-Invoice.co cannot provide coverage for the supplied invoice. If an invoice is marked as rejected, it will also include a new "rejectedby" field in the coverage section with the name of the rejecting party. If it's rejected by the API, this field will typically be "Single-Invoice.co", but if it's rejected by the user it will be simply be "User".