{"_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":33,"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"],"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 (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. To generate one [log in](http://secure.fleetio.com/users/sign_in) to Fleetio and navigate to the API Keys from the user dropdown in the top right corner. Each key can have a label, which 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:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/f234a45-api-keys-smaller.jpg\",\n        \"api-keys-smaller.jpg\",\n        400,\n        276,\n        \"#3f6776\"\n      ],\n      \"caption\": \"Select the API Keys menu from the user drop-down.\"\n    }\n  ]\n}\n[/block]\n\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 also requires the presence of an Account token ``HTTP 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/49184ed-example-account-token.jpg\",\n        \"example-account-token.jpg\",\n        1394,\n        178,\n        \"#ecf1f1\"\n      ],\n      \"caption\": \"Example account token in the URL of the Fleetio app.\"\n    }\n  ]\n}\n[/block]\nThis token must be a valid token belonging to one of your user's accounts, and it must be passed using the ``Account-Token`` header. Keys cannot be passed as ``GET`` or ``POST`` parameters. We'll ignore them and you run the risk of jeopardizing the security your account.\n\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\n![Try It Out Example](http://g.recordit.co/6ffJefRwWS.gif)\n\n## Step 5: Make API requests using your app\n\nNow you're ready to make requests to the API using your programming tool of choice. For example:\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 curl request with authentication headers.\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"overview","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 (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. To generate one [log in](http://secure.fleetio.com/users/sign_in) to Fleetio and navigate to the API Keys from the user dropdown in the top right corner. Each key can have a label, which is simply a way of allowing you to organize your keys. An API key may be revoked, making it unusable and non-recoverable. [block:image] { "images": [ { "image": [ "https://files.readme.io/f234a45-api-keys-smaller.jpg", "api-keys-smaller.jpg", 400, 276, "#3f6776" ], "caption": "Select the API Keys menu from the user drop-down." } ] } [/block] [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 also requires the presence of an Account token ``HTTP 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/49184ed-example-account-token.jpg", "example-account-token.jpg", 1394, 178, "#ecf1f1" ], "caption": "Example account token in the URL of the Fleetio app." } ] } [/block] 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. Keys cannot be passed as ``GET`` or ``POST`` parameters. We'll ignore them and you run the risk of jeopardizing the security your account. ## 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.* ![Try It Out Example](http://g.recordit.co/6ffJefRwWS.gif) ## Step 5: Make API requests using your app Now you're ready to make requests to the API using your programming tool of choice. For example: [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 curl request with authentication headers." } ] } [/block]