{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"d1926441-fcff-43b1-907a-1a240d7eefbc","name":"Roger API (Roger.ai)","description":"Welcome to Roger's API reference documentation. <a href=\"https://www.getpostman.com/collections/0e1f1e19c0e3432104a7\" target=\"_blank\">Here</a> you can download and import Roger API Postman collection. Feel free to reach out to [support@roger.ai](mailto:support@roger.ai) if you have any questions. We also have a Slack community where you will be able to get even faster assistance or answers for your questions. Join <a href=\"https://join.slack.com/t/roger-community/shared_invite/enQtMjg1MjEyOTE3ODExLTAyOGZmNjM3ZTMzOTdkMzJjZGIyOTBiNjNmNTkxM2VmZGIwNTI0MDU1MDhmYzNmYzM3NzNkYzI3NzQ2OGVkNmI\" target=\"_blank\">here</a>\n\n# Expense life-cycle\nBefore starting it is important to understand a few concepts in Roger. A crucial and central concept is  the life-cycle of an expense. When any expense is uploaded to Roger, the expense will follow a flow representing the life-cycle of an expense. The life-cycle is defined as a graph G = (V,E) where all vertices in V is the available states an expense can have. An expense can only hold one state at any time. E is the abstract set of valid paths between two or more vertices. All states have a set of predefined actions associated with every exit and entry transition of a vertex.\n\n<img src='https://rogereu.s3.eu-central-1.amazonaws.com/static-assets/export.fsm.png'>\n\n## States\nThis is the list of available state for any expense in Roger.\n\n### Pending\n\nThis state identifies the process where the expense is getting recognized. The progressing time can vary depending on the complexity or/and the need for additional compliance checks.\n\n---\n\n### Awaiting\n\nIf the corresponding company has an active Workflow and the expense properties match an active rule with the need for approval, the expense will reside in this state until a user has either approve or decline the expense. Please note that an expense waiting for approval might reside in this state eventhough it got approve if there is a rule waiting for two approvers. You could imagine a flow where User A and User B is required for the given expense to be approved, when User A approves the webhook emitted would be `expense.approval.approve` and when User B then consecutively approves it will change state and emit `expense.approval.approve` and `expense.state.booked` (Assuming it moves to the `Booked` state)\n\n<br>Webhook emitted when entering: `expense.state.awating`\n\n---\n\n### Booked\n\nWhen an expense of the type `bill` is ready for payment it will reside in this state until canceled or initialized. It can move to initialized automatically on due or by manually paying the bill.\n<br>Webhook emitted when entering: `expense.state.booked`\n\n---\n\n### Initialized\n\nIf the expense is getting paid outside banking hours - either by a user or by the API - the expense will move to `Initialized` and automatically get paid when the sending bank allows for a successful transaction\n<br>Webhook emitted when entering: `expenses.state.initialized`\n---\n\n### Paid\nThis state identifies that an expense has been either been paid successfully or has been marked as paid.\n<br>Webhook emitted when entering: `expenses.state.paid`\n\n---\n\n### Paused\nIf an expense of the type bill has failed due to issues related to a third party such as the bank, insufficient funds etc. it will be moved to this state.\n<br>Webhook emitted when entering: `expense.state.paused`\n\n---\n\n### Canceled / Declined\n\nIf an expense is deleted - either by Roger or by a user associated to the company - it will end in this state. This state is a final state and no modifications to the expense is possible here.\n<br>Webhook emitted when entering: `expense.state.canceled`\n\n#  Using Webhooks\nIn addition to the common REST calls available in this documentation, you will be able to get your application to react on every state (described above) change in the system e.g. if a bill is paid, you want your application to write out message. In this case you subscribe to the emitted webhook `expense.state.booked` and from the corresponding payload you will be able to extract the context.\n\n## Events\nWebhook events are identified by a string constructed by the following: [entity].[concept].[operation]. The `entity` defined the top-level objects e.g. `expense`, `paymentmethod`. The `concept` and `operation` is defining the action that emitted the webhook. So let's assume you have a user that is approving a certain bill waiting for approval. Here a webhook with the event `expense.approval.approved` is emitted. If the user instead declined the bill, the webhook would look like this `expense.approval.declined`. \n\n### Expense events\nThe following the events are emitted when changes are happening to any given bill applicable for this event. Note that some expense e.g. don't allow date change.\n\nConcept: `note`, operation `{ updated }`\n<br>\nConcept: `label`, operation `{ updated }`\n<br>\nConcept: `date`, operation `{ updated }`\n<br>\nConcept: `amountlines`, operation `{ updated }`\n<br>\nConcept: `department`, operation `{ updated }`\n\n### Team events\nThe following the events are emitted when changes are happening to the company account.\n\nConcept: `paymentmethod` : Operation `{ created, deleted }`\n\n\n# Endpoints\n- Test: `https://staging-external.roger.ai`\n- Demo: `https://sandbox.roger.ai`\n- Production: `https://external.roger.ai` (will move to `https://api.roger.ai` shortly)\n\n# OAUTH\n- Authorize URI: `{{host}}/connect/authorize`\n- Token URI: `{{host}}/connect/token`\n","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"7731170","collectionId":"d1926441-fcff-43b1-907a-1a240d7eefbc","publishedId":"TzeUm8ZB","public":true,"publicUrl":"https://developers.roger.ai","privateUrl":"https://go.postman.co/documentation/7731170-d1926441-fcff-43b1-907a-1a240d7eefbc","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.0","publishDate":"2021-06-14T09:47:38.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/768118b36f06c94b0306958b980558e6915839447e859fe16906e29d683976f0","favicon":"https://roger.ai/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://developers.roger.ai/view/metadata/TzeUm8ZB"}