{"info":{"_postman_id":"7a232351-b939-427d-988e-81f971398e31","name":"Treepoints API","description":"<html><head></head><body><p>A collection of requests that can be made to the Treepoints API</p>\n<p>The base url for Staging is <code>staging-api.treepoints.green</code></p>\n<p>The base url for Production is <code>api.treepoints.green</code></p>\n<h1 id=\"example-flow\">Example Flow</h1>\n<p>Step 1:</p>\n<ul>\n<li><a href=\"https://treepoints.green/sign-up-partner\">Register</a> a user for your business at our signup page to receive your own <a href=\"https://treepoints.green/showcase/treepoints\">showcase page</a>. If you are using the staging api, you can instead register directly using the <a href=\"#861123ca-9200-4c3e-8a97-3a275c378089\">Register</a> endpoint. Note that registering through the api directly will not generate you a showcase page automatically and so if you're setting up your production account you should follow the first link.</li>\n</ul>\n<p>Step 2:</p>\n<ul>\n<li><a href=\"#19389f80-87ad-402d-a412-7409f2884c56\">Log in</a> using the email and password you just registered with to receive a token.</li>\n<li>Tokens only expire when you use <a href=\"#60a4132e-1bc1-40b6-9770-7107fdbea484\">Log out</a> so you should keep them safe and expire any old ones.</li>\n</ul>\n<p>Step 3 (optional):</p>\n<ul>\n<li>You can verify the token is working by calling <a href=\"#9c9e7eb7-ac5f-46b0-bf7d-9898e5b652e9\">Status</a> which if successful will return a 200 containing your email and the id of your user.</li>\n</ul>\n<p>Step 4:</p>\n<ul>\n<li><a href=\"#bda75dcb-dde6-4f00-8c4e-4b899386ab20\">Purchase Carbon Offsetting</a> with your token as authentication. This will return a 200 with details of your purchase when successful.</li>\n<li>If you receive any 4xx or 5xx error codes you should assume no offset has been purchased and retry.</li>\n<li>It is highly recommended though not required that you use an idempotency key when purchasing offsets as this will ensure any retries made by you will not result in duplicate purchases.</li>\n</ul>\n<p>Step 5 (optional):</p>\n<ul>\n<li>You can verify your purchase went through by calling <a href=\"#81288043-92e2-43c2-a5c3-d2be952b2f3a\">Get offset data</a> which will return a list of all purchases for your user.</li>\n</ul>\n<h1 id=\"errors\">Errors</h1>\n<p>Errors will be returned with the following format:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"error_id\": \"EMAIL_ALREADY_EXISTS\",\n    \"message\": \"A user with the email address 'luke+treepointslocal1@stasher.com' already exists\",\n    \"errors\": {}\n}\n\n</code></pre>\n<p><code>error_id</code> is the unique key for the error</p>\n<p><code>message</code> is a description of the problem</p>\n<p><code>errors</code> can contain extra information about the error. For example in a validation error you will see which fields need fixing, for example:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n    \"error_id\": \"INVALID_DATA\",\n    \"message\": \"Bad request - please consult the API documentation\",\n    \"errors\": {\n        \"email\": [\n            \"Missing data for required field.\"\n        ],\n        \"password\": [\n            \"Missing data for required field.\"\n        ]\n    }\n}\n\n</code></pre>\n<p>General errors:</p>\n<p><code>INVALID_TOKEN</code> - You've provided an expired, malformed or otherwise invalid token. You should request a new one and try again.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Example Flow","slug":"example-flow"},{"content":"Errors","slug":"errors"}],"owner":"7186757","collectionId":"7a232351-b939-427d-988e-81f971398e31","publishedId":"TVzLpLQm","public":true,"customColor":{"top-bar":"4B9658","right-sidebar":"303030","highlight":"00a9ff"},"publishDate":"2021-10-18T15:33:25.000Z"},"item":[{"name":"Auth","item":[{"name":"Register","id":"861123ca-9200-4c3e-8a97-3a275c378089","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\"\n}"},"url":"{{url}}/auth/register","description":"<p>Register an account using this endpoint.</p>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p><code>EMAIL_ALREADY_EXISTS</code> a user with this email already exists</p>\n<p><code>COMPANY_ALREADY_EXISTS</code> a company with this name already exists</p>\n<p><code>INVALID_PASSWORD</code> the password chosen has fewer than 10 characters</p>\n","urlObject":{"path":["auth","register"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"1545fd9d-ec84-43db-a1f5-0fb66db6dd5f","name":"Register","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\"\n}"},"url":"{{url}}/auth/register"},"status":"CREATED","code":201,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Tue, 25 Oct 2022 15:27:49 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"87"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"email\": \"luke+treepointsexample@stasher.com\",\n    \"id\": \"594beaf3ff8641f0b64efc6ccc664ed0\"\n}"}],"_postman_id":"861123ca-9200-4c3e-8a97-3a275c378089"},{"name":"Log in","event":[{"listen":"test","script":{"id":"cc355092-8eb8-42e9-98ec-d52cd1f6c28e","exec":["if (pm.response.code == 200 || pm.response.code == 201) {","    var json = pm.response.json();","    pm.environment.set(\"auth_token\", json.auth_token);","}",""],"type":"text/javascript"}}],"id":"19389f80-87ad-402d-a412-7409f2884c56","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/auth/login","description":"<p>Used to log into a user account and receive a token</p>\n<h1 id=\"error-codes\">Error codes</h1>\n<p><code>INCORRECT_CREDENTIALS</code> the credentials provided are incorrect</p>\n<p>can provide an optional <code>expires_at</code> argument to generate a token with an expiry time. Times are in UTC</p>\n","urlObject":{"path":["auth","login"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"d45872a9-bb68-4a39-a9a9-4ad40d8829d8","name":"Log in","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\"\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/auth/login"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Tue, 25 Oct 2022 16:28:11 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"278"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"auth_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NjY3MTUyOTEsInN1YiI6IjU5NGJlYWYzZmY4NjQxZjBiNjRlZmM2Y2NjNjY0ZWQwIn0.Z-ffWWyLKhlB3iNpVS3bqcjTNCXGowAPklzVxbBZDJc\",\n    \"message\": \"Successfully logged in.\",\n    \"status\": \"success\",\n    \"user_id\": \"594beaf3ff8641f0b64efc6ccc664ed0\"\n}"},{"id":"f1c76e57-17fd-416a-84b6-8ba7c3f64cd7","name":"Log in with expires_at","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"{{password}}\",\n    \"expires_at\": \"2022-11-17 16:20\"\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/auth/login"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 17 Nov 2022 16:18:19 GMT"},{"key":"Connection","value":"close"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"321"},{"key":"Set-Cookie","value":"session_id=c651a09a-df73-41cc-8acf-85768cad6b45; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"}],"cookie":[],"responseTime":null,"body":"{\n    \"auth_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2Njg3MDE4OTksInN1YiI6ImJlODhhMDMwYThlYjQ5YjQ5Y2Q0NzJjYzdmMWYwZWYyIiwiZXhwIjoxNjY4NzAyMDAwfQ.-VcJ802Am1wJi32mCt1wjwrLiWp5w9ZFsg9y7mekiM8\",\n    \"message\": \"Successfully logged in.\",\n    \"status\": \"success\",\n    \"user_id\": \"be88a030a8eb49b49cd472cc7f1f0ef2\"\n}"}],"_postman_id":"19389f80-87ad-402d-a412-7409f2884c56"},{"name":"Log out","id":"60a4132e-1bc1-40b6-9770-7107fdbea484","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"url":"{{url}}/auth/logout","description":"<p>Use this endpoint to expire an existing token</p>\n","urlObject":{"path":["auth","logout"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"6e664fad-39a7-481b-9da9-6206e3871135","name":"Log out","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"url":"{{url}}/auth/logout"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Tue, 25 Oct 2022 16:28:20 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"58"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Successfully logged out.\",\n    \"status\": \"success\"\n}"}],"_postman_id":"60a4132e-1bc1-40b6-9770-7107fdbea484"},{"name":"Forgot Password","id":"4670ea7e-d008-4187-85b1-81909accaa2e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\"\n}"},"url":"{{url}}/auth/forgot-password","description":"<p>Hit this endpoint to receive a password reset email with a code you will need to reset your password.</p>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p><code>USER_NOT_FOUND</code> a user with the email provided could not be found</p>\n","urlObject":{"path":["auth","forgot-password"],"host":["{{url}}"],"query":[{"disabled":true,"key":"","value":null}],"variable":[]}},"response":[{"id":"545a3719-5d17-41eb-af4e-f835c3510aea","name":"Forgot Password","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\"\n}"},"url":{"raw":"{{url}}/auth/forgot-password","host":["{{url}}"],"path":["auth","forgot-password"],"query":[{"key":"","value":null,"type":"text","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Tue, 25 Oct 2022 16:28:32 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"47"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"email\": \"luke+treepointsexample@stasher.com\"\n}"}],"_postman_id":"4670ea7e-d008-4187-85b1-81909accaa2e"},{"name":"Reset Password","id":"f39e0a8a-ffa4-4af4-a1af-7eba7b787b72","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"new_password\",\n    \"reset_code\": \"your_reset_code\"\n}"},"url":"{{url}}/auth/reset-password","description":"<p>Use this endpoint to submit your code and new password.</p>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p><code>USER_NOT_FOUND</code> a user with the email provided could not be found</p>\n<p><code>INVALID_PASSWORD</code> the password chosen has fewer than 10 characters</p>\n<p><code>INVALID_RESET_CODE</code> the reset code provided is invalid</p>\n","urlObject":{"path":["auth","reset-password"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"45953989-91eb-43b0-94d0-d772f712d259","name":"Reset Password","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"email\": \"{{email}}\",\n    \"password\": \"anevenmoresecretpassword\",\n    \"reset_code\": \"ufLN78YrrpY\"\n}"},"url":"{{url}}/auth/reset-password"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:38:56 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"47"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"email\": \"luke+treepointsexample@stasher.com\"\n}"}],"_postman_id":"f39e0a8a-ffa4-4af4-a1af-7eba7b787b72"},{"name":"Expire All Tokens","id":"b73a07e2-08d7-4bf6-b1d5-b4cfc6d73662","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":""},"url":"{{url}}/auth/expire-all-tokens","description":"<p>Hit this endpoint to expire all tokens for the user associated with your token</p>\n","urlObject":{"path":["auth","expire-all-tokens"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"647a9093-3740-4591-b249-215048ee5057","name":"Expire All Tokens","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":""},"url":"{{url}}/auth/expire-all-tokens"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 17 Nov 2022 16:07:53 GMT"},{"key":"Connection","value":"close"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"76"},{"key":"Set-Cookie","value":"session_id=c651a09a-df73-41cc-8acf-85768cad6b45; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Successfully expired all tokens.\",\n    \"status\": \"success\"\n}"}],"_postman_id":"b73a07e2-08d7-4bf6-b1d5-b4cfc6d73662"},{"name":"Status","id":"9c9e7eb7-ac5f-46b0-bf7d-9898e5b652e9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"url":"{{url}}/auth/status","description":"<p>Check the status of an auth token</p>\n","urlObject":{"path":["auth","status"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"515a1ce8-7cef-4cb6-bdb4-f35d872e6478","name":"Status","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"url":"{{url}}/auth/status"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:40:06 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"87"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"email\": \"luke+treepointsexample@stasher.com\",\n    \"id\": \"594beaf3ff8641f0b64efc6ccc664ed0\"\n}"}],"_postman_id":"9c9e7eb7-ac5f-46b0-bf7d-9898e5b652e9"}],"id":"3db21f1f-c431-4596-9f15-eef0bde1cb22","_postman_id":"3db21f1f-c431-4596-9f15-eef0bde1cb22","description":""},{"name":"Offset","item":[{"name":"Get offsets data","id":"81288043-92e2-43c2-a5c3-d2be952b2f3a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":""},"url":"{{url}}/offset","description":"<p>Get a list of all offsets for your user. You can also filter these by the optional query parameters.</p>\n","urlObject":{"path":["offset"],"host":["{{url}}"],"query":[{"disabled":true,"description":{"content":"<p>Admins only.</p>\n","type":"text/plain"},"key":"user_id","value":"{string}"},{"disabled":true,"description":{"content":"<p>Either \"carbon\", \"tree\" or \"plastic\".</p>\n","type":"text/plain"},"key":"product","value":"{string}"},{"disabled":true,"description":{"content":"<p>All offsets on or before this datetime.</p>\n","type":"text/plain"},"key":"created_lte","value":"{datetime}"},{"disabled":true,"description":{"content":"<p>All offsets on or after this datetime.</p>\n","type":"text/plain"},"key":"created_gte","value":"{datetime}"},{"disabled":true,"description":{"content":"<p>Admins only. Either \"api_integration\", \"shopify_subsidized\" or \"shopify_opt_in\".</p>\n","type":"text/plain"},"key":"source_of_sale","value":"{string}"},{"disabled":true,"description":{"content":"<p>Admins only.</p>\n","type":"text/plain"},"key":"currency_code_of_sale","value":"{string}"}],"variable":[]}},"response":[{"id":"e39f54cc-e471-4292-bec4-8508870406e3","name":"Get offsets data","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":""},"url":{"raw":"{{url}}/offset","host":["{{url}}"],"path":["offset"],"query":[{"key":"user_id","value":"{string}","description":"Admins only.","disabled":true},{"key":"product","value":"{string}","description":"Either \"carbon\", \"tree\" or \"plastic\".","type":"text","disabled":true},{"key":"created_lte","value":"{datetime}","description":"All offsets on or before this datetime.","disabled":true},{"key":"created_gte","value":"{datetime}","description":"All offsets on or after this datetime.","type":"text","disabled":true},{"key":"source_of_sale","value":"{string}","description":"Admins only. Either \"api_integration\", \"shopify_subsidized\" or \"shopify_opt_in\".","type":"text","disabled":true},{"key":"currency_code_of_sale","value":"{string}","description":"Admins only.","type":"text","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:41:03 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"184"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"has_next\": false,\n    \"has_prev\": false,\n    \"items\": [\n        {\n            \"amount\": 1,\n            \"created\": \"2022-10-27T02:40:39.512652\",\n            \"id\": \"d0b7646c27564897962a5b5f86d07bce\",\n            \"product\": \"tree\"\n        }\n    ],\n    \"page\": 1,\n    \"pages\": 1,\n    \"total\": 1\n}"}],"_postman_id":"81288043-92e2-43c2-a5c3-d2be952b2f3a"},{"name":"Purchase Carbon Offsetting","id":"bda75dcb-dde6-4f00-8c4e-4b899386ab20","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","type":"text","value":"Token {{auth_token}}"},{"key":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 1,\n    \"product\": \"tree\",\n    \"idempotency_key\": \"some_unique_identifier\"\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/offset","description":"<p>Use this to purchase a carbon offsetting product. This can be a tree, a kg of carbon, a plastic bottle, or a monetary value of carbon offsetting in your chosen currency.</p>\n<p>Your request should be authenticated with a token, and the purchase will be made on behalf of that user.</p>\n<h1 id=\"arguments\">Arguments:</h1>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>`amount`: Required, the amount of carbon offsetting to purchase, in minor denominations. Must be an Integer\n`product`: Required, the product to purchase. Must be one of ['TREE', 'CARBON', 'PLASTIC', 'GBP', 'USD', 'EUR']\n`idempotency_key`: Optional, add an idempotency_key to allow you to safely retry requests. Must be a String\n\n</code></pre><h1 id=\"units\">Units:</h1>\n<p>Tree purchases are per tree</p>\n<p>Carbon purchases are per kg</p>\n<p>Plastic purchases are per plastic bottle</p>\n<p>Currency purchases are per minor denomination, so to offset £1.00 you must send an amount of 100</p>\n<h1 id=\"idempotency_key\">Idempotency_key:</h1>\n<p>Adding one of these to your request will mean your request is checked. We will check if another request with your idempotency_key exists for your user_id. If it does then no purchase will be made since we deem the purchase to have already been made previously. This allows you to safely retry failed requests without risk of a double purchase.</p>\n<h1 id=\"error-codes\">Error Codes</h1>\n<p><code>IDEMPOTENCY_USED</code> the idempotency key has already been used</p>\n<p><code>INVALID_PRODUCT</code> the product is not supported</p>\n<p><code>INVALID_AMOUNT</code> the amount provided must not be 0 and must be an integer</p>\n<p><code>INVALID_COST</code> the cost at sale provided must not be None or less than or equal to 0</p>\n<p><code>CURRENCY_NOT_FOUND</code> the currency provided could not be found</p>\n<p><code>USER_NOT_FOUND</code> a user with the id provided could not be found</p>\n<p><code>USER_RESTRICTED</code> the user is restricted from making purchases</p>\n","urlObject":{"path":["offset"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"e1059f6a-364b-4ad8-8428-cf104fd9f243","name":"Purchase Carbon Offsetting","originalRequest":{"method":"POST","header":[{"key":"Authorization","type":"text","value":"Token {{auth_token}}"},{"key":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 1,\n    \"product\": \"tree\",\n    \"idempotency_key\": \"some_unique_identifier\"\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/offset"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:40:39 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"109"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"amount\": 1,\n    \"created\": \"2022-10-27T02:40:39.512652\",\n    \"id\": \"d0b7646c27564897962a5b5f86d07bce\",\n    \"product\": \"tree\"\n}"}],"_postman_id":"bda75dcb-dde6-4f00-8c4e-4b899386ab20"}],"id":"1fc7f645-7baf-4dd3-82ad-8bc968ecf820","description":"<p>A collection of endpoints for managing treepoints</p>\n","_postman_id":"1fc7f645-7baf-4dd3-82ad-8bc968ecf820"},{"name":"Companies","item":[{"name":"Create Company","id":"6336eeae-8fac-45c4-858d-ae810208c0c0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"My Company\",\n    \"opted_in\": true\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/companies","description":"<h1 id=\"error-codes\">Error Codes</h1>\n<p><code>UNAUTHORIZED</code> the user must be an admin to create a company for another user</p>\n<p><code>USER_NOT_FOUND</code> a user with the id provided could not be found</p>\n<p><code>COMPANY_ALREADY_EXISTS</code> a company with the name provided already exists</p>\n<p><code>COMPANY_WITH_USER_ID_ALREADY_EXISTS</code> a company with the user_id provided already exists</p>\n","urlObject":{"path":["companies"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"0033d095-60e0-4cb9-a5a3-b4b72c517af2","name":"Create Company","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Token {{auth_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"My Company\",\n    \"opted_in\": true\n}","options":{"raw":{"language":"json"}}},"url":"{{url}}/companies"},"status":"CREATED","code":201,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:56:39 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"190"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"carbon_amount_offset\": \"0\",\n    \"contributors\": [],\n    \"date_joined\": \"2022-10-25T15:27:49.203817\",\n    \"name\": \"My Company\",\n    \"opted_in\": true,\n    \"plastic_collected\": \"0\",\n    \"slug\": \"my-company\",\n    \"trees_planted\": \"1\"\n}"}],"_postman_id":"6336eeae-8fac-45c4-858d-ae810208c0c0"},{"name":"Get company stats","id":"8417c807-4a66-4d00-aa88-1f9fb1e1e9c4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{url}}/companies/[company-slug]","urlObject":{"path":["companies","[company-slug]"],"host":["{{url}}"],"query":[],"variable":[]}},"response":[{"id":"a4060510-c81d-4f04-a0a2-93ae388b73d1","name":"Get company stats","originalRequest":{"method":"GET","header":[],"url":"{{url}}/companies/my-company"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Connection","value":"keep-alive"},{"key":"Server","value":"gunicorn/20.0.4"},{"key":"Date","value":"Thu, 27 Oct 2022 02:58:00 GMT"},{"key":"Content-Type","value":"application/json"},{"key":"Content-Length","value":"190"},{"key":"Set-Cookie","value":"session_id=a4aab021-3a62-41de-9810-9246b3c22b09; Path=/"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Via","value":"1.1 vegur"}],"cookie":[],"responseTime":null,"body":"{\n    \"carbon_amount_offset\": \"0\",\n    \"contributors\": [],\n    \"date_joined\": \"2022-10-25T15:27:49.203817\",\n    \"name\": \"My Company\",\n    \"opted_in\": true,\n    \"plastic_collected\": \"0\",\n    \"slug\": \"my-company\",\n    \"trees_planted\": \"1\"\n}"}],"_postman_id":"8417c807-4a66-4d00-aa88-1f9fb1e1e9c4"}],"id":"62c48120-e088-45ab-83a2-82347c8b98b8","_postman_id":"62c48120-e088-45ab-83a2-82347c8b98b8","description":""}],"event":[{"listen":"prerequest","script":{"id":"11a96a93-04bf-4d6a-9e41-7cf22b9a3a15","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"a6c6f64c-3980-4a3c-9975-2178c57b2ca1","type":"text/javascript","exec":[""]}}]}