{"_id":"54f8de4f4339bb1900c8c011","__v":2,"category":{"_id":"54f8de4e4339bb1900c8bffc","__v":1,"pages":["54f8de4f4339bb1900c8c010","54f8de4f4339bb1900c8c011","54f8de4f4339bb1900c8c012","54f8de4f4339bb1900c8c013"],"project":"54c0e51215af820d001a38a6","version":"54f8de4e4339bb1900c8bffb","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-01-22T11:54:59.216Z","from_sync":false,"order":0,"slug":"fleetio-api","title":"Fleetio API"},"user":"54cba76f6d1eee0d00c33dee","version":{"_id":"54f8de4e4339bb1900c8bffb","project":"54c0e51215af820d001a38a6","forked_from":"54f8de14c6cabe23005c02a2","__v":38,"createdAt":"2015-03-05T22:53:02.044Z","releaseDate":"2015-03-05T22:53:02.044Z","categories":["54f8de4e4339bb1900c8bffc","54f8de4e4339bb1900c8bffd","54f8de4e4339bb1900c8bffe","54f8de4e4339bb1900c8bfff","54f8de4e4339bb1900c8c000","54ff6057563d7419002d666e","55007b6ecfeeea17004717dc","5501d779f2ef1e0d003116eb","55116ef89f7c7619005f853b","554bb366f245703100ddd39f","554d226b374fec0d007e64db","555e09f18ab3180d001ac605","555e0b2b4f5e5a0d00836d77","561d1f8b92a0cc350018b24f","562a956c96b5f40d0026eb60","5654c3378a26202b00c17cb8","5697a94b0b09a41900b24546","5739d89e37b52e3200a3a3cc","57ac94252c0b220e00a94570","57ac97a1ad44fc0e003be066","57ac9a3a8f312d0e00e96c75","57ac9c187ae5c60e004ba3a3","58178bee62e4500f009404f6","581a39711a63870f008b621d","581a3b4f0c65b20f00247fcb","5926e0606c729e0f00595f95","5954033ea5bbca002d27ae91","596ce53e0aeafe00157eb1ba","596ce87a8b79f4001a8f6139","598cad2e96193400190d879a","598cbcd3dc20c6000fdfb9c3","598cbd8496193400190d8955","59fcc7c9591add0026c91457","5a020b7856ea82001c8c9342","5a09bc64a91882001c56c2ed","5a71fa2de9aa84007a8bccdb","5b3a768a8a21dd0003ca080d","5c7030f099eeb6003116a106","5c9553a7b6957d005006fc09","5c955c3d04233b0063c9f450","5cfe73f7823bba005de7e1ed","5d07eb760568e70040d6ae21"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"githubsync":"","parentDoc":null,"project":"54c0e51215af820d001a38a6","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-25T21:00:10.376Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Welcome to the Fleetio API docs. Our [REST API](http://en.wikipedia.org/wiki/Representational_state_transfer) allows programmatic access to [Fleetio resources](https://help.fleetio.com/hc/en-us/articles/360025313992-Glossary-of-Terms) (e.g. vehicles, meter entries and fuel entries) so developers can build integrations with 3rd-party and/or internal software systems. Each API resource has available actions that can be performed on it. Supported resources and their endpoints are listed on the left.\n\nThe first thing you'll need to do is set up Authentication. This is handled using API keys. Each API key is associated with a Fleetio user. Results returned from various responses are based upon the role of the user to which the API key is tied.\n\n## Step 1: Generating an API Key\n\nEach user account can have multiple API keys. Here's to generate one.\n\n[Log in](http://secure.fleetio.com/users/sign_in) to Fleetio and navigate to your Account Menu, then User Settings:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e9f1636-user-settings.png\",\n        \"user-settings.png\",\n        548,\n        1072,\n        \"#134574\"\n      ]\n    }\n  ]\n}\n[/block]\nClick Manage API Keys:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ed91978-manage-api-keys.png\",\n        \"manage-api-keys.png\",\n        1742,\n        214,\n        \"#dcdfdd\"\n      ]\n    }\n  ]\n}\n[/block]\nNext, click the + New API Key button:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/e60adda-new-api-key.png\",\n        \"new-api-key.png\",\n        1518,\n        534,\n        \"#f3fbfa\"\n      ]\n    }\n  ]\n}\n[/block]\nThen add a label for your API key. A label is simply a way of allowing you to organize your keys. An API key may be revoked, making it unusable and non-recoverable.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"API Key Security\",\n  \"body\": \"API keys are secret. We strongly recommend against pasting it online or committing it to a repository. Treat it as you would your password.\"\n}\n[/block]\n## Step 2: Set API Key HTTP Header\n\nEach request to our API requires a valid API key to be passed as an ``HTTP header``. There is no need to issue any login commands or to maintain a session. The API key must be passed as a basic ``Authorization`` token header.\n\n## Step 3: Set Account Token HTTP Header\n\nEach request to the Fleetio API requires the presence of an Account token ``HTTP header``. This token must be a valid token belonging to one of your user's accounts, and it must be passed using the ``Account-Token`` header. You can find the account token for a particular account in the URL when you log into Fleetio:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/1a8b1d4-account-token.png\",\n        \"account-token.png\",\n        1648,\n        190,\n        \"#1f5285\"\n      ]\n    }\n  ]\n}\n[/block]\n## Step 4: Make your first API request using the API docs\n\nYou can test API calls in these online docs using the Try It Out forms. Simply navigate to an API endpoint you wish to test (for example, the [Parts Index](https://developer.fleetio.com/docs/parts)), and enter your Authorization and Account-Token. *Be sure to put the word Token in front of the Authorization value.*\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b9bc38b-fleetio-try-it-out.gif\",\n        \"fleetio-try-it-out.gif\",\n        1411,\n        831,\n        \"#e5e4e4\"\n      ]\n    }\n  ]\n}\n[/block]\n## Step 5: Make API requests using your app\n\nNow you're ready to make requests to the Fleetio API using your programming tool of choice. Here's an example using cURL:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl https://secure.fleetio.com/api/v1/vehicles       \\\\\\n--header 'Authorization: Token token=\\\"YOUR_API_KEY\\\"'  \\\\\\n--header 'Account-Token: YOUR_ACCOUNT_TOKEN'                                        \",\n      \"language\": \"text\",\n      \"name\": \"Basic request with authentication headers.\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"getting-started","type":"basic","title":"Getting Started"}
Welcome to the Fleetio API docs. Our [REST API](http://en.wikipedia.org/wiki/Representational_state_transfer) allows programmatic access to [Fleetio resources](https://help.fleetio.com/hc/en-us/articles/360025313992-Glossary-of-Terms) (e.g. vehicles, meter entries and fuel entries) so developers can build integrations with 3rd-party and/or internal software systems. Each API resource has available actions that can be performed on it. Supported resources and their endpoints are listed on the left. The first thing you'll need to do is set up Authentication. This is handled using API keys. Each API key is associated with a Fleetio user. Results returned from various responses are based upon the role of the user to which the API key is tied. ## Step 1: Generating an API Key Each user account can have multiple API keys. Here's to generate one. [Log in](http://secure.fleetio.com/users/sign_in) to Fleetio and navigate to your Account Menu, then User Settings: [block:image] { "images": [ { "image": [ "https://files.readme.io/e9f1636-user-settings.png", "user-settings.png", 548, 1072, "#134574" ] } ] } [/block] Click Manage API Keys: [block:image] { "images": [ { "image": [ "https://files.readme.io/ed91978-manage-api-keys.png", "manage-api-keys.png", 1742, 214, "#dcdfdd" ] } ] } [/block] Next, click the + New API Key button: [block:image] { "images": [ { "image": [ "https://files.readme.io/e60adda-new-api-key.png", "new-api-key.png", 1518, 534, "#f3fbfa" ] } ] } [/block] Then add a label for your API key. A label is simply a way of allowing you to organize your keys. An API key may be revoked, making it unusable and non-recoverable. [block:callout] { "type": "warning", "title": "API Key Security", "body": "API keys are secret. We strongly recommend against pasting it online or committing it to a repository. Treat it as you would your password." } [/block] ## Step 2: Set API Key HTTP Header Each request to our API requires a valid API key to be passed as an ``HTTP header``. There is no need to issue any login commands or to maintain a session. The API key must be passed as a basic ``Authorization`` token header. ## Step 3: Set Account Token HTTP Header Each request to the Fleetio API requires the presence of an Account token ``HTTP header``. This token must be a valid token belonging to one of your user's accounts, and it must be passed using the ``Account-Token`` header. You can find the account token for a particular account in the URL when you log into Fleetio: [block:image] { "images": [ { "image": [ "https://files.readme.io/1a8b1d4-account-token.png", "account-token.png", 1648, 190, "#1f5285" ] } ] } [/block] ## Step 4: Make your first API request using the API docs You can test API calls in these online docs using the Try It Out forms. Simply navigate to an API endpoint you wish to test (for example, the [Parts Index](https://developer.fleetio.com/docs/parts)), and enter your Authorization and Account-Token. *Be sure to put the word Token in front of the Authorization value.* [block:image] { "images": [ { "image": [ "https://files.readme.io/b9bc38b-fleetio-try-it-out.gif", "fleetio-try-it-out.gif", 1411, 831, "#e5e4e4" ] } ] } [/block] ## Step 5: Make API requests using your app Now you're ready to make requests to the Fleetio API using your programming tool of choice. Here's an example using cURL: [block:code] { "codes": [ { "code": "curl https://secure.fleetio.com/api/v1/vehicles \\\n--header 'Authorization: Token token=\"YOUR_API_KEY\"' \\\n--header 'Account-Token: YOUR_ACCOUNT_TOKEN' ", "language": "text", "name": "Basic request with authentication headers." } ] } [/block]