{"_id":"579e05d54c4ab40e00b494ac","createdAt":"2016-07-31T14:06:13.068Z","link_external":false,"link_url":"","next":{"description":"","pages":[]},"type":"basic","user":"5795d43eb9ee2d0e00df357a","category":"56e29a8ed3b68d0e00b48ffe","parentDoc":null,"slug":"overview","isReference":false,"hidden":false,"project":"56e29a8dd3b68d0e00b48ffa","sync_unique":"","title":"Overview","__v":1,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"body":"Single-Invoice.co, powered by Euler Hermes, provides a simple API you can use to insure the payment of invoices and transactions. In addition to providing credit insurance, Single-Invoice.co gives you access to an extensive database of information about companies in France, as well as the rest of Europe, and soon, the United States.\n\n## At a Glance\n\nThe flow to cover an invoice through the API is quite simple: \n\n1. First, search for the two companies involved in the invoice - the buyer and supplier.\n2. Once you've found the companies, you can request a quote for a cover to insure the invoice.\n3. If you're happy with the quote, you can accept it by activating the cover, protecting the transaction.\n4. Finally, if you've been paid, you can settle the cover - and if not, you can file a claim. \n\nThat's it! For more detail, please read on. \n\n## Registering an Account. \n\nBefore you can begin, you will need to register an API account. Accounts are currently created in a disabled state; after you've created your account, it will be need to be reviewed before you'll be able to login and create a Coverage API key to issue other calls.\n\nAccounts can be created through our [Developer Portal](https://developer.single-invoice.co/). \n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Sandbox environment\",\n  \"body\": \"We recommend testing first in our Sandbox environment. You can create accounts in the Sandbox on our [Sandbox Developer Portal](https://developer-demo.single-invoice.co/).\\n\\nNote that the API endpoint for the Sandbox is: https://api-demo.single-invoice.co\\n\\nMore information about the Sandbox environment is available [here](doc:sandbox).\"\n}\n[/block]\n## Creating an API key\n\nSingle-Invoice.co uses API keys for authentication. Once you sign up, you'll automatically have an Account Management API key available, which allows you to manipulate your account via the various API calls (see the 'Accounts' section for the full list of these calls). \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"All authenticated requests to Single-Invoice.co require an API key and must be submitted over HTTPS.\",\n  \"title\": \"A quick note about authentication\"\n}\n[/block]\nAfter your account is approved, you'll be able to create a Coverage API key, which allows access to the various Coverage methods. \n\nAPI keys can be created programmatically or requested through the Developer Portal - see the [Create API Key](doc:create-api-key) manual page for details on this process. \n\n## Insuring an Invoice\n\nSingle-Invoice.co provides an API that lets you insure invoices between two parties, referred to in our API as \"companies\" or transactors. Once a coverage policy has been issued, you can also use the API to manage the policy.\n\nBefore you can insure an invoice, you need the IDs of the companies. \n\n### Getting information about a company\n\nLet’s get information about Acme Industries, an imaginary company in France that will be the buyer in your invoice.\n\nThe first step is to search the Single-Invoice.co database to find its record - it's Single-Invoice.co ID. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Each company has an Single-Invoice.co ID that does not change. The Single-Invoice.co ID is required for all coverage methods.\\n\\nPlease note, however, that Single-Invoice.co IDs **will** be different between different environments (for example, our testing environment and our production environment will have different IDs for the same company).\",\n  \"title\": \"Single-Invoice.co IDs\"\n}\n[/block]\nOnce you've found the company, you can use its ID to create a coverage policy.\n\n### Querying Single-Invoice.co\n\nTo find Acme Industries, we’ll search by [SIREN code](https://en.wikipedia.org/wiki/SIREN_code). \n\nFor your seller, Ajax Inc, assume we already have its ID (but if we don't, we just search for it in the same way that we found the buyer). For more information about finding companies, please see the various Companies methods that are available. \n\nNote that before you can send the request, you need to add your Coverage API key to the header.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"//using http://unirest.io/java.html\\nimport com.mashape.Unirest;\\n\\nHttpRequest jsonRequest = Unirest.get(\\\"https://api.single-invoice.co/v2.0/transactors/{countrycode}/{service}/{id}\\\")\\n  .routeParam(\\\"countrycode\\\", \\\"fr\\\")\\n  .routeParam(\\\"service\\\", \\\"siren\\\")\\n  .routeParam(\\\"id\\\", \\\"953539907\\\")\\n  .header(\\\"accept\\\", \\\"application/json\\\");\\n \",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"'use strict';\\n\\n//using http://unirest.io/nodejs.html\\nlet unirest = require('unirest');\\n\\nlet countrycode = 'fr';\\nlet service = 'siren';\\nlet id = '953539907';\\nlet request = unirest.get(`https://api.armadill.io/v2.0/transactors/${countrycode}/${service}/${id}`);\\n\",\n      \"language\": \"javascript\",\n      \"name\": \"Node\"\n    },\n    {\n      \"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$api_base_uri = 'https://api.armadill.io/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=> false\\n]);\\n\\ntry\\n{\\n\\t$response = $client->request('GET', $api_base_uri.\\\"/transactor/FR/SIREN/455171751\\\", [\\n\\t\\t'headers' => [ 'apikey' => 'm4C1ckYebAU1Z2XNDgPCLdrKd7A7HXi0Gw4XdG2JCBuF6Vua0jduHFJ027Iycn1s' ],\\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\\n}\\ncatch (GuzzleHttp\\\\Exception\\\\ClientException $e) {\\n    $response = $e->getResponse();\\n    $responseBodyAsString = $response->getBody()->getContents();\\n}\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\\nvar rp = require('request-promise');\\n\\nvar apiBaseUri = 'https://api.armadill.io/v2.0';\\nvar apikey = 'QSGLZoNInZ6mPTcO78EDNmQjgAO65B0uLwYO61DQpHpdyfOm6LsLL4zr95J97iIp';\\n\\nrp({\\n  method: 'GET',\\n  uri: apiBaseUri + '/transactor/FR/SIRET/43564652534',\\n  qs: {\\n    apikey: apikey\\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      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n### Understanding Company Search Results\n\nThe resulting JSON data contains information about the imaginary company, Acme Industries:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"6d568a15-f99c-4b4b-9143-fbda98b0b32e\\\",\\n  \\\"name\\\": \\\"Acme Industries\\\",\\n  \\\"address\\\": {\\n    \\\"type\\\": \\\"main\\\",\\n    \\\"city\\\": \\\"Paris\\\",\\n    \\\"countrycode\\\": \\\"FR\\\",\\n    \\\"postalcode\\\": \\\"1000\\\",\\n    \\\"statecode\\\": null,\\n    \\\"streetname\\\" : \\\"Rue de Fake\\\", \\n    \\\"streetnumber\\\": \\\"12\\\"\\n\\t},\\n\\t\\\"phonenumber\\\": \\\"+33 5 55 55 55 55\\\",\\n\\t\\\"legalFormCode\\\": \\\"BVBA\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n## Covering an Invoice\n\nNow that you have the ID of the buyer, Acme, and the seller, Ajax, you can request a coverage policy for the transaction. \n\nTo request a policy, you make a POST request to the [Request endpoint](doc:get-quote) with the following information:\n\n* the Single-Invoice.co IDs of the buyer and supplier\n* the total amount due\n* the currency\n* the date the invoice was issued\n* the date when the invoice is due\n* an invoice number (optional) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"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$api_base_uri = 'https://api.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 = \\\"ZTIlHrC0eoRDpAGLgqsF6bJzxBAiapgQiQFUlWuuqK3FtVd3TepzE9w7UdrZhjSA\\\";\\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' => 'c3773f78-b180-fd47-17b3-600a150d617a', \\n\\t\\t\\t\\t\\t\\t'buyerid' => 'f5f82c66-de95-c933-43f1-bd0a2327ce09', \\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-10-10\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"issuedAt\\\"  =>  \\\"2016-08-10\\\",\\n              \\t\\t\\t\\\"number\\\" => \\\"1414715\\\" // optional\\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\\t$responseBodyAsString = $response->getBody()->getContents();\\n}\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\\nvar rp = require('request-promise');\\n\\nvar apiBaseUri = 'https://api.armadill.io/v2.0';\\nvar apikey = 'najiEw6gSDCivkuPwjXsMsQWPaX8xX4pGB6NRCbqXLPBCd9PFVfm65wwO4vo6JtX';\\n\\nrp({\\n  method: 'POST',\\n  uri: apiBaseUri + '/coverage',\\n  qs: {\\n    apikey: apikey,\\n  },\\n  body: {\\n    sellerid : \\\"a6a51b39-761d-f449-64b8-27fd9fff0796\\\",\\n    buyerid : \\\"bbccd3f1-3efb-a53d-741e-b308133f91ca\\\",\\n    invoice : {\\n      amount: 100000.0,\\n      currency: \\\"eur\\\",\\n      dueAt : \\\"2016-10-10\\\",\\n      issuedAt : \\\"2016-08-10\\\"\\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      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe resulting JSON data contains the terms of the policy, including:\n\n* Policy ID: a GUID-style identifer that serves as a unique ID for this quote.\n* Status: whether or not the policy has been accepted or rejected\n* Coverage details: the amount and currency of the coverage.\n* General details about the quote, including invoice details and the identifiers for the two transactors.\n\nSee the [Request Quote](doc:get-quote) documentation for more detail about the return options.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"id\\\": \\\"41175eed-3d2b-a552-cc85-128b7ea371ed\\\",\\n    \\\"status\\\": \\\"Pending\\\",\\n    \\\"coverage\\\": {\\n        \\\"amount\\\": 6.15,\\n        \\\"currency\\\": \\\"eur\\\",\\n    },\\n    \\\"sellerId\\\": \\\"bd1172e2-141c-4be4-8700-6b785556a9b7\\\",\\n    \\\"buyerId\\\": \\\"bd1172e2-141c-4be4-8700-6b785556a9b7\\\",\\n    \\\"invoice\\\": {\\n        \\\"Amount\\\": 1000,\\n        \\\"Currency\\\": \\\"gbp\\\",\\n        \\\"DueAt\\\": \\\"2016-10-30T00:00:00Z\\\",\\n        \\\"IssuedAt\\\": \\\"2016-08-31T00:00:00Z\\\",\\n        \\\"Number\\\": 1414715\\n    }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAfter requesting a policy, you can [Activate](doc:coverage-activation) or [Reject](doc:coverage-rejection) it. \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Cover Activation\",\n  \"body\": \"To actually insure your invoice, you must Activate the cover. \\n\\nIf a cover is not Activated, the insurance will not be in place. Quotes for covers will automatically expire after a set time period (currently dependent on your policy).\"\n}\n[/block]\n## Dealing with Covers\n\nBased on the terms, you accept the cover, by calling the [Activate](doc:coverage-activation) endpoint. Once the cover has been accepted, the invoice is insured under the terms of the policy we have with you. \n\nAcme, being a reputable company, paid their invoice on time. Once the invoice is paid, you notify Single-Invoice.co that the coverage policy has been settled successfully with the [Settle](doc:settle) endpoint. \n\nIf you're dealing with a company that fails to pay on time, however, you may want to file a claim using the [Claim](doc:claim) endpoint. At this point the claims process will start; upon submitting the required documentation to our claims team we'll pay out the value of the cover. \n\nBy notifying Single-Invoice.co, future coverage pricing will be adjusted based on the timeliness of payments by transactors, resulting in a constantly-improving model ensuring we can offer the best prices for insurance. \n\n## Next steps\n\nSingle-Invoice.co provides APIs to manage the entire life cycle of a coverage policy. For more information about policy life cycle, see the COVERAGES LIFE CYCLE endpoints:\n* [Activate](doc:coverage-activation) \n* [Cancel](doc:coverage-cancellation) \n* [Claim](doc:claim) \n* [Late](doc:late)\n* [Reject](doc:coverage-rejection) \n* [Settle](doc:settle)","excerpt":"","githubsync":"","order":0,"updates":[],"version":"56e29a8dd3b68d0e00b48ffd","childrenPages":[]}
Single-Invoice.co, powered by Euler Hermes, provides a simple API you can use to insure the payment of invoices and transactions. In addition to providing credit insurance, Single-Invoice.co gives you access to an extensive database of information about companies in France, as well as the rest of Europe, and soon, the United States. ## At a Glance The flow to cover an invoice through the API is quite simple: 1. First, search for the two companies involved in the invoice - the buyer and supplier. 2. Once you've found the companies, you can request a quote for a cover to insure the invoice. 3. If you're happy with the quote, you can accept it by activating the cover, protecting the transaction. 4. Finally, if you've been paid, you can settle the cover - and if not, you can file a claim. That's it! For more detail, please read on. ## Registering an Account. Before you can begin, you will need to register an API account. Accounts are currently created in a disabled state; after you've created your account, it will be need to be reviewed before you'll be able to login and create a Coverage API key to issue other calls. Accounts can be created through our [Developer Portal](https://developer.single-invoice.co/). [block:callout] { "type": "info", "title": "Sandbox environment", "body": "We recommend testing first in our Sandbox environment. You can create accounts in the Sandbox on our [Sandbox Developer Portal](https://developer-demo.single-invoice.co/).\n\nNote that the API endpoint for the Sandbox is: https://api-demo.single-invoice.co\n\nMore information about the Sandbox environment is available [here](doc:sandbox)." } [/block] ## Creating an API key Single-Invoice.co uses API keys for authentication. Once you sign up, you'll automatically have an Account Management API key available, which allows you to manipulate your account via the various API calls (see the 'Accounts' section for the full list of these calls). [block:callout] { "type": "info", "body": "All authenticated requests to Single-Invoice.co require an API key and must be submitted over HTTPS.", "title": "A quick note about authentication" } [/block] After your account is approved, you'll be able to create a Coverage API key, which allows access to the various Coverage methods. API keys can be created programmatically or requested through the Developer Portal - see the [Create API Key](doc:create-api-key) manual page for details on this process. ## Insuring an Invoice Single-Invoice.co provides an API that lets you insure invoices between two parties, referred to in our API as "companies" or transactors. Once a coverage policy has been issued, you can also use the API to manage the policy. Before you can insure an invoice, you need the IDs of the companies. ### Getting information about a company Let’s get information about Acme Industries, an imaginary company in France that will be the buyer in your invoice. The first step is to search the Single-Invoice.co database to find its record - it's Single-Invoice.co ID. [block:callout] { "type": "info", "body": "Each company has an Single-Invoice.co ID that does not change. The Single-Invoice.co ID is required for all coverage methods.\n\nPlease note, however, that Single-Invoice.co IDs **will** be different between different environments (for example, our testing environment and our production environment will have different IDs for the same company).", "title": "Single-Invoice.co IDs" } [/block] Once you've found the company, you can use its ID to create a coverage policy. ### Querying Single-Invoice.co To find Acme Industries, we’ll search by [SIREN code](https://en.wikipedia.org/wiki/SIREN_code). For your seller, Ajax Inc, assume we already have its ID (but if we don't, we just search for it in the same way that we found the buyer). For more information about finding companies, please see the various Companies methods that are available. Note that before you can send the request, you need to add your Coverage API key to the header. [block:code] { "codes": [ { "code": "//using http://unirest.io/java.html\nimport com.mashape.Unirest;\n\nHttpRequest jsonRequest = Unirest.get(\"https://api.single-invoice.co/v2.0/transactors/{countrycode}/{service}/{id}\")\n .routeParam(\"countrycode\", \"fr\")\n .routeParam(\"service\", \"siren\")\n .routeParam(\"id\", \"953539907\")\n .header(\"accept\", \"application/json\");\n ", "language": "java" }, { "code": "'use strict';\n\n//using http://unirest.io/nodejs.html\nlet unirest = require('unirest');\n\nlet countrycode = 'fr';\nlet service = 'siren';\nlet id = '953539907';\nlet request = unirest.get(`https://api.armadill.io/v2.0/transactors/${countrycode}/${service}/${id}`);\n", "language": "javascript", "name": "Node" }, { "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$api_base_uri = 'https://api.armadill.io/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=> false\n]);\n\ntry\n{\n\t$response = $client->request('GET', $api_base_uri.\"/transactor/FR/SIREN/455171751\", [\n\t\t'headers' => [ 'apikey' => 'm4C1ckYebAU1Z2XNDgPCLdrKd7A7HXi0Gw4XdG2JCBuF6Vua0jduHFJ027Iycn1s' ],\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\n}\ncatch (GuzzleHttp\\Exception\\ClientException $e) {\n $response = $e->getResponse();\n $responseBodyAsString = $response->getBody()->getContents();\n}", "language": "php" }, { "code": "// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\nvar rp = require('request-promise');\n\nvar apiBaseUri = 'https://api.armadill.io/v2.0';\nvar apikey = 'QSGLZoNInZ6mPTcO78EDNmQjgAO65B0uLwYO61DQpHpdyfOm6LsLL4zr95J97iIp';\n\nrp({\n method: 'GET',\n uri: apiBaseUri + '/transactor/FR/SIRET/43564652534',\n qs: {\n apikey: apikey\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 });", "language": "javascript" } ] } [/block] ### Understanding Company Search Results The resulting JSON data contains information about the imaginary company, Acme Industries: [block:code] { "codes": [ { "code": "{\n \"id\": \"6d568a15-f99c-4b4b-9143-fbda98b0b32e\",\n \"name\": \"Acme Industries\",\n \"address\": {\n \"type\": \"main\",\n \"city\": \"Paris\",\n \"countrycode\": \"FR\",\n \"postalcode\": \"1000\",\n \"statecode\": null,\n \"streetname\" : \"Rue de Fake\", \n \"streetnumber\": \"12\"\n\t},\n\t\"phonenumber\": \"+33 5 55 55 55 55\",\n\t\"legalFormCode\": \"BVBA\"\n}", "language": "json" } ] } [/block] ## Covering an Invoice Now that you have the ID of the buyer, Acme, and the seller, Ajax, you can request a coverage policy for the transaction. To request a policy, you make a POST request to the [Request endpoint](doc:get-quote) with the following information: * the Single-Invoice.co IDs of the buyer and supplier * the total amount due * the currency * the date the invoice was issued * the date when the invoice is due * an invoice number (optional) [block:code] { "codes": [ { "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$api_base_uri = 'https://api.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 = \"ZTIlHrC0eoRDpAGLgqsF6bJzxBAiapgQiQFUlWuuqK3FtVd3TepzE9w7UdrZhjSA\";\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' => 'c3773f78-b180-fd47-17b3-600a150d617a', \n\t\t\t\t\t\t'buyerid' => 'f5f82c66-de95-c933-43f1-bd0a2327ce09', \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-10-10\",\n\t\t\t\t\t\t\t\t\t\t\"issuedAt\" => \"2016-08-10\",\n \t\t\t\"number\" => \"1414715\" // optional\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\t$responseBodyAsString = $response->getBody()->getContents();\n}", "language": "php" }, { "code": "// Example assumes the packages request and request-promise have been installed (npm install request request-promise)\nvar rp = require('request-promise');\n\nvar apiBaseUri = 'https://api.armadill.io/v2.0';\nvar apikey = 'najiEw6gSDCivkuPwjXsMsQWPaX8xX4pGB6NRCbqXLPBCd9PFVfm65wwO4vo6JtX';\n\nrp({\n method: 'POST',\n uri: apiBaseUri + '/coverage',\n qs: {\n apikey: apikey,\n },\n body: {\n sellerid : \"a6a51b39-761d-f449-64b8-27fd9fff0796\",\n buyerid : \"bbccd3f1-3efb-a53d-741e-b308133f91ca\",\n invoice : {\n amount: 100000.0,\n currency: \"eur\",\n dueAt : \"2016-10-10\",\n issuedAt : \"2016-08-10\"\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 });", "language": "javascript" } ] } [/block] The resulting JSON data contains the terms of the policy, including: * Policy ID: a GUID-style identifer that serves as a unique ID for this quote. * Status: whether or not the policy has been accepted or rejected * Coverage details: the amount and currency of the coverage. * General details about the quote, including invoice details and the identifiers for the two transactors. See the [Request Quote](doc:get-quote) documentation for more detail about the return options. [block:code] { "codes": [ { "code": "{\n \"id\": \"41175eed-3d2b-a552-cc85-128b7ea371ed\",\n \"status\": \"Pending\",\n \"coverage\": {\n \"amount\": 6.15,\n \"currency\": \"eur\",\n },\n \"sellerId\": \"bd1172e2-141c-4be4-8700-6b785556a9b7\",\n \"buyerId\": \"bd1172e2-141c-4be4-8700-6b785556a9b7\",\n \"invoice\": {\n \"Amount\": 1000,\n \"Currency\": \"gbp\",\n \"DueAt\": \"2016-10-30T00:00:00Z\",\n \"IssuedAt\": \"2016-08-31T00:00:00Z\",\n \"Number\": 1414715\n }\n}", "language": "json" } ] } [/block] After requesting a policy, you can [Activate](doc:coverage-activation) or [Reject](doc:coverage-rejection) it. [block:callout] { "type": "warning", "title": "Cover Activation", "body": "To actually insure your invoice, you must Activate the cover. \n\nIf a cover is not Activated, the insurance will not be in place. Quotes for covers will automatically expire after a set time period (currently dependent on your policy)." } [/block] ## Dealing with Covers Based on the terms, you accept the cover, by calling the [Activate](doc:coverage-activation) endpoint. Once the cover has been accepted, the invoice is insured under the terms of the policy we have with you. Acme, being a reputable company, paid their invoice on time. Once the invoice is paid, you notify Single-Invoice.co that the coverage policy has been settled successfully with the [Settle](doc:settle) endpoint. If you're dealing with a company that fails to pay on time, however, you may want to file a claim using the [Claim](doc:claim) endpoint. At this point the claims process will start; upon submitting the required documentation to our claims team we'll pay out the value of the cover. By notifying Single-Invoice.co, future coverage pricing will be adjusted based on the timeliness of payments by transactors, resulting in a constantly-improving model ensuring we can offer the best prices for insurance. ## Next steps Single-Invoice.co provides APIs to manage the entire life cycle of a coverage policy. For more information about policy life cycle, see the COVERAGES LIFE CYCLE endpoints: * [Activate](doc:coverage-activation) * [Cancel](doc:coverage-cancellation) * [Claim](doc:claim) * [Late](doc:late) * [Reject](doc:coverage-rejection) * [Settle](doc:settle)