{"swaggerDoc":{"info":{"title":"Timeshifter API","version":"1.2.1","description":"This is the public Timeshifter API.\n\nAuthorization & Password sections, bellow, are open APIs.\nThe rest is locked, and requires a valid token, supplied in the [Authorization header field](https://tools.ietf.org/html/rfc6750#section-2.1).\n\nExample: `Authorization: Bearer hwByk34BaQtxNowlh2hj1U6y0t3rnWux` (this is not supported in this version of swagger)"},"basePath":"/v1","swagger":"2.0","paths":{"/airlines":{"get":{"tags":["airlines"],"summary":"List of supported airlines","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","example":"SK"},"title":{"type":"string","example":"SAS Scandinavian Airlines"}}}}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/airports":{"get":{"tags":["airports"],"summary":"List of supported airports","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","example":"CPH"},"title":{"type":"string","example":"Copenhagen, Denmark (CPH-Kastrup)"}}}}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/apple-auth":{"post":{"tags":["authentication"],"summary":"Sign in/ create new user via apple id auth","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["appleIdToken","devicePlatform","deviceName"],"properties":{"appleIdToken":{"type":"string","example":"cAbCd12331...","info":"jwt id token returned by frontend"},"devicePlatform":{"type":"string","example":"ios","enum":["ios","android","web","wear-os"],"info":"Current device platform (used for session)."},"deviceName":{"type":"string","example":"John's iPhone","info":"Current device's name (used for session)."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/TokenResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/create-handoff-token":{"get":{"tags":["handoff"],"summary":"Request handoff token","produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/TokenResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/verify":{"post":{"tags":["email"],"summary":"Verify email by token (email-link)","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","example":"A8Pmx1bdSLJ5rK2g_2vJqMZP8U2Z0cjk","info":"Token received through verify email link."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/google-auth":{"post":{"tags":["authentication"],"summary":"Sign in/ create new user via google auth","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["googleIdToken","devicePlatform","deviceName"],"properties":{"googleIdToken":{"type":"string","example":"cAbCd12331...","info":"jwt id token returned by frontend"},"devicePlatform":{"type":"string","example":"ios","enum":["ios","android","web","wear-os"],"info":"Current device platform (used for session)."},"deviceName":{"type":"string","example":"John's iPhone","info":"Current device's name (used for session)."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/TokenResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/health-check":{"get":{"tags":["health-check"],"summary":"Shows the server status","consumes":["application/json"],"produces":["application/json"],"responses":{"200":{"description":"Success"}}}},"/iap/redeem":{"post":{"tags":["IAP"],"summary":"converts IAP to a credit","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["platform","receipt"],"properties":{"platform":{"type":"string","example":"ios","enum":["ios","android"],"info":"Current device platform (used for receipt validation Apple/Google)."},"productId":{"type":"string","example":"single_plan"},"transactionId":{"type":"string","example":"abcd1234"},"transactionReceipt":{"type":"string","example":"vxLxtoHxug5t0Av2vqwho6o1ZwFZgb6SNCvRr8o8isKDJDQmwoybK6DaWdGHkactrKbCbEu7W3ASjCfgCmzmOkAy5aZwNpPbUU3MbQuots9TmO5enmosx6Jhs4PKoXfCnTZSqdwwRxquQpPeeLMZ50tvkfIxXeI4MqgTbnC6clkmFA0XyBrdfaLdCCmvFK6k5bwzqkqp"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"description":{"type":"boolean","example":true}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/ForbiddenErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/iap/subscription":{"post":{"tags":["IAP"],"summary":"registers subscription","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["platform","receipt"],"properties":{"platform":{"type":"string","example":"ios","enum":["ios","android"],"info":"Current device platform (used for receipt validation Apple/Google)."},"productId":{"type":"string","example":"single_plan"},"transactionId":{"type":"string","example":"abcd1234"},"transactionReceipt":{"type":"string","example":"vxLxtoHxug5t0Av2vqwho6o1ZwFZgb6SNCvRr8o8isKDJDQmwoybK6DaWdGHkactrKbCbEu7W3ASjCfgCmzmOkAy5aZwNpPbUU3MbQuots9TmO5enmosx6Jhs4PKoXfCnTZSqdwwRxquQpPeeLMZ50tvkfIxXeI4MqgTbnC6clkmFA0XyBrdfaLdCCmvFK6k5bwzqkqp"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"description":{"type":"boolean","example":true}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/ForbiddenErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/order/fulfill":{"post":{"tags":["Orders"],"summary":"fulfills a SquareSpace order by adding it to the user and marking it as fulfilled","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["orderId"],"properties":{"orderId":{"type":"string","example":"585d498fdee9f31a60284a37","info":"The SquareSpace order id"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"description":{"type":"boolean","example":true}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/ForbiddenErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/partner/united/voucher-generate":{"post":{"tags":["United"],"summary":"Generate United voucher from United membership id and surname","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["membershipId","surname"],"properties":{"orderId":{"type":"string","example":"ABC12345","info":"The United membership id"},"surname":{"type":"string","example":"Smith","info":"The users surname (last name)"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"voucherCode":{"type":"string","example":"XXXXXXXX"}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"403":{"description":"Forbidden","schema":{"$ref":"#/definitions/ForbiddenErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/redirect-watch":{"get":{"tags":["smartwatch"],"summary":"returns request data wrapped in format expected by AndroidWear to hand off to a smartwatch (HTTP 302 with payload)","consumes":["text/urlencoded"],"produces":["HTTP status header"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["target"],"properties":{"target":{"type":"string","example":"https://app.example.com/?token=123456","info":"return URL to wrap"}}}}],"responses":{"302":{"description":"Successful redirect"},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/request-reset-pass":{"post":{"tags":["password"],"summary":"Request reset password email","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["email","appUri"],"properties":{"email":{"type":"string","example":"user@example.com","info":"User's email."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/reset-pass":{"post":{"tags":["password"],"summary":"Reset password by token (email-link)","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["pass","token"],"properties":{"pass":{"type":"string","example":"lesssecret","info":"User's new password."},"token":{"type":"string","example":"A8Pmx1bdSLJ5rK2g_2vJqMZP8U2Z0cjk","info":"Token received through reset password email link."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/signin":{"post":{"tags":["authentication"],"summary":"User signin / create new session","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["email","pass","devicePlatform","deviceName"],"properties":{"email":{"type":"string","example":"user@example.com","info":"User's email."},"pass":{"type":"string","example":"verysecret!","info":"User's password."},"devicePlatform":{"type":"string","example":"ios","enum":["ios","android","web","wear-os"],"info":"Current device platform (used for session)."},"deviceName":{"type":"string","example":"John's iPhone","info":"Current device's name (used for session)."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/TokenResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/signout":{"get":{"tags":["authentication"],"summary":"User signout / delete current session","produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/signup":{"post":{"tags":["authentication"],"summary":"User signup / create user & session","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["name","email","pass","devicePlatform","deviceName"],"properties":{"name":{"type":"string","example":"John","info":"User's first name."},"email":{"type":"string","example":"user@example.com","info":"User's email."},"pass":{"type":"string","example":"verysecret!","info":"User's password."},"age":{"type":"integer","example":30,"info":"User's age."},"gender":{"type":"string","example":"male","enum":["female","male","other"],"info":"User's gender."},"chronotype":{"type":"string","example":"neither","enum":["earlybird","nightowl","neither"],"info":"Cronotype of the user"},"sleepingTime":{"type":"string","example":"23:00:00","info":"User's normal sleeping time. Format '22:00:00'."},"sleepingHours":{"type":"integer","example":8,"enum":[7,8,9],"info":"Amount of hours user normally sleeps."},"devicePlatform":{"type":"string","example":"ios","enum":["ios","android","web","wear-os"],"info":"Current device platform (used for session)."},"deviceName":{"type":"string","example":"John's iPhone","info":"Current device's name (used for session)."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/TokenResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/survey":{"get":{"tags":["survey"],"summary":"submit the post survey results here","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["tripId"],"properties":{"tripId":{"type":"string","example":"123e4567-e89b-12d3-a456-426655440000","info":"The ID of the relevant trip"},"didYouFollow":{"type":"string","example":0,"enum":[0,1,2,3,4]},"didYouExperience":{"type":"string","example":0,"enum":[0,1,2,3,4]}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"success":{"type":"boolean","example":true}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"404":{"description":"Trip not found"},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/trip/validate":{"post":{"tags":["trip"],"summary":"Validate trip","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["itinerary"],"properties":{"itinerary":{"type":"array","info":"List of flight-list schedules (including layovers).","items":{"type":"array","info":"Flight-list schedule (including layovers).","items":{"type":"object","required":["departureAirport","departureTime","arrivalAirport","arrivalTime"],"properties":{"departureAirport":{"type":"string","example":"CPH","info":"Departure airport code"},"departureTime":{"type":"string","example":"2017-10-01T18:10:00","info":"Local departure time (without timezone/utc)"},"arrivalAirport":{"type":"string","example":"DOH","info":"Arrival airport code"},"arrivalTime":{"type":"string","example":"2017-10-02T01:10:00","info":"Local arrival time (without timezone/utc)"}}}}}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","info":"Maximum preadaptation days (user setting taken into consideration)","properties":{"maxPreadaptationDays":{"type":"integer","example":2}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/trip":{"post":{"tags":["trip"],"summary":"Create trip","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["preadaptationDays","itinerary"],"properties":{"itinerary":{"type":"array","info":"List of flights.","items":{"type":"array","info":"Flight (one only).","items":{"type":"object","required":["departureAirport","departureTime","arrivalAirport","arrivalTime"],"properties":{"departureAirport":{"type":"string","example":"CPH","info":"Departure airport code"},"departureTime":{"type":"string","example":"2017-10-01T18:10:00","info":"Local departure time (without timezone/utc)"},"arrivalAirport":{"type":"string","example":"DOH","info":"Arrival airport code"},"arrivalTime":{"type":"string","example":"2017-10-02T01:10:00","info":"Local arrival time (without timezone/utc)"},"flightCode":{"type":"string","example":"WG249"},"flightId":{"type":"string","example":"WG249:CCC:2019-06-26:1850"},"preAdaptationDays":{"type":"integer","example":0,"enum":[0,1,2],"info":"Number of days previous to departure"}}}}}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"id":{"type":"string","example":"59998749-4fb7-4917-a367-1cd55cbc1107","info":"UUID"},"tripType":{"type":"string","enum":["one-way","return-trip","quick-turnaround"]},"itinerary":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"departureAirport":{"type":"string","example":"CPH"},"departureTime":{"type":"string","example":"2017-10-01T16:10:00+02:00","info":"Local departure time including airport timezone"},"arrivalAirport":{"type":"string","example":"DOH"},"arrivalTime":{"type":"string","example":"2017-10-01T22:10:00+03:00","info":"Local arrival time including airport timezone"},"arrivalTimezone":{"type":"string","example":"+03:00"},"flightCode":{"type":"string","example":"WG249"},"flightId":{"type":"string","example":"WG249:CCC:2019-06-26:1850"}}}}},"plans":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","example":"airplane","enum":["airplane","melatonin-sleep","sleep","nap","optional-nap","avoid-light","prioritize-light","see-light","use-caffeine","avoid-caffeine"]},"start":{"type":"string","example":"2018-05-01T19:00:00+02:00"},"end":{"type":"string","example":"2018-05-01T23:00:00+03:00"},"flight":{"type":"object","info":"optional (only occurs on type === 'airplane')","properties":{"departureAirport":{"type":"string","example":"CPH"},"departureTime":{"type":"string","example":"2018-05-01T18:40:00+02:00"},"departureCity":{"type":"string","example":"Copenhagen"},"arrivalAirport":{"type":"string","example":"IST"},"arrivalTime":{"type":"string","example":"2018-05-01T22:50:00+03:00"},"arrivalCity":{"type":"string","example":"Istanbul"}}}}}}}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}},"delete":{"tags":["trip"],"summary":"Delete trip","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string","example":"59998749-4fb7-4917-a367-1cd55cbc1107","info":"UUID"}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/use-handoff":{"post":{"tags":["handoff"],"summary":"log user in via handoff token","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","example":"A8Pmx1bdSLJ5rK2g_2vJqMZP8U2Z0cjk","info":"Token generated from create-handoff-token"},"devicePlatform":{"type":"string","example":"ios","enum":["ios","android","web","wear-os"],"info":"Current device platform (used for session)."},"deviceName":{"type":"string","example":"John's iPhone","info":"Current device's name (used for session)."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/user":{"get":{"tags":["user"],"summary":"Fetches user (current user)","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"query","name":"tripsActiveAfter","example":"2018-01-01T00:00:00.000Z","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"name":{"type":"string","example":"John"},"email":{"type":"string","example":"user@example.com"},"pass":{"type":"string","example":"verysecret!"},"age":{"type":"integer","example":30},"gender":{"type":"string","example":"male"},"chronotype":{"type":"string","example":"nightowl"},"useCaffeine":{"type":"boolean","example":true},"useMelatonin":{"type":"boolean","nullable":true,"example":null},"usePreadaption":{"type":"boolean","example":true},"sleepingTime":{"type":"string","example":"23:00:00"},"sleepingHours":{"type":"integer","example":8},"trips":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"59998749-4fb7-4917-a367-1cd55cbc1107","info":"UUID"},"tripType":{"type":"string","enum":["one-way","return-trip","quick-turnaround"]},"itinerary":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{"departureAirport":{"type":"string","example":"CPH"},"departureTime":{"type":"string","example":"2017-10-01T16:10:00+02:00","info":"Local departure time including airport timezone"},"arrivalAirport":{"type":"string","example":"DOH"},"arrivalTime":{"type":"string","example":"2017-10-01T22:10:00+03:00","info":"Local arrival time including airport timezone"},"arrivalTimezone":{"type":"string","example":"+03:00"}}}}},"plans":{"type":"array","items":{"type":"array","items":{"type":"object","required":["type","start","end"],"properties":{"type":{"type":"string","example":"airplane","enum":["airplane","melatonin-sleep","sleep","nap","optional-nap","avoid-light","prioritize-light","see-light","use-caffeine","avoid-caffeine"]},"start":{"type":"string","example":"2018-05-01T19:00:00+02:00"},"end":{"type":"string","example":"2018-05-01T23:00:00+03:00"},"flight":{"type":"object","info":"optional (only occurs on type === 'airplane')","properties":{"departureAirport":{"type":"string","example":"CPH"},"departureTime":{"type":"string","example":"2018-05-01T18:40:00+02:00"},"departureCity":{"type":"string","example":"Copenhagen"},"arrivalAirport":{"type":"string","example":"IST"},"arrivalTime":{"type":"string","example":"2018-05-01T22:50:00+03:00"},"arrivalCity":{"type":"string","example":"Istanbul"}}}}}}}}}}}}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}},"put":{"tags":["user"],"summary":"Edit user (current user)","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"body","name":"body","schema":{"type":"object","properties":{"name":{"type":"string","example":"John","info":"User's first name."},"email":{"type":"string","example":"user@example.com","info":"User's email."},"pass":{"type":"string","example":"verysecret!","info":"User's password."},"age":{"type":"integer","example":30,"info":"User's age."},"gender":{"type":"string","example":"male","enum":["female","male","other"],"info":"User's gender."},"chronotype":{"type":"string","example":"neither","enum":["earlybird","nightowl","neither"],"info":"Cronotype of the user"},"useCaffeine":{"type":"boolean","example":true},"useMelatonin":{"type":"boolean","nullable":true,"example":null},"usePreadaption":{"type":"boolean","example":true},"sleepingTime":{"type":"string","example":"23:00:00","info":"User's normal sleeping time. Format '22:00:00'."},"sleepingHours":{"type":"integer","example":8,"enum":[7,8,9],"info":"Amount of hours user normally sleeps."}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}},"delete":{"tags":["user"],"summary":"Anonymize the user name and email and mark user as deleted in the database and on Intercom.","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/SuccessResponse"}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized (see response)","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/voucher-gift":{"post":{"tags":["vouchers"],"summary":"Gift voucher to email address","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"body","name":"body","schema":{"type":"object","required":["voucherCode","email"],"properties":{"voucherCode":{"type":"string","example":"XXXXXXXX","info":"The voucher code"},"email":{"type":"email","example":"someone@somewhere.com","info":"The email of the gift receiver"},"giverName":{"type":"string","example":"John Doe","info":"The givers name. Defaults to 'Someone'"}}}}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"name":{"type":"string","example":"Voucher rule name"},"description":{"type":"string","example":"a 1-year subscription"}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"404":{"description":"voucher not found"},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/voucher-redeem":{"get":{"tags":["vouchers"],"summary":"redeems voucher for logged in user, 401 if not possible, 404 if voucher no longer valid","consumes":["application/json"],"produces":["application/json"],"parameters":[{"in":"header","name":"Authorization","example":"Bearer [access_token]","schema":{"type":"string"},"required":true},{"in":"query","name":"voucherId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"description":{"type":"string","example":"a 1-year subscription"}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/AuthorizationErrorResponse"}},"404":{"description":"voucher not found"},"500":{"description":"Internal Server Error (see response if not in production)"}}}},"/voucher-test":{"get":{"tags":["vouchers"],"summary":"Gets voucher info for given voucher id, or 404 if no longer valid","consumes":["voucher data url parameter"],"produces":["application/json"],"parameters":[{"in":"query","name":"voucherId","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Success","schema":{"type":"object","properties":{"description":{"type":"string","example":"a 1-year subscription"}}}},"400":{"description":"Bad request (see response)","schema":{"$ref":"#/definitions/FieldValidationErrorResponse"}},"404":{"description":"voucher not found"},"500":{"description":"Internal Server Error (see response if not in production)"}}}}},"definitions":{"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true}}},"TokenResponse":{"type":"object","properties":{"token":{"type":"string","example":"A8Pmx1bdSLJ5rK2g_2vJqMZP8U2Z0cjk"}}},"FieldValidationErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"FieldValidationError"},"message":{"type":"string","example":"Descriptive text"},"fields":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","example":"email"},"message":{"type":"string","example":"\"email\" is required"}}}}}},"NotImplementedErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"NotImplementedError"},"message":{"type":"string","example":"Descriptive text"}}},"InternalServerErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"InternalServerError"},"message":{"type":"string","example":"Descriptive text"}}},"AuthenticationErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"AuthenticationError"},"message":{"type":"string","example":"Descriptive text"}}},"AuthorizationErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"AuthorizationError"},"message":{"type":"string","example":"Descriptive text"}}},"ForbiddenErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"ForbiddenError"},"message":{"type":"string","example":"Descriptive text"}}},"EmailAlreadyExistsErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"EmailAlreadyExistsError"},"message":{"type":"string","example":"Descriptive text"}}},"UserNotFoundErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"UserNotFoundError"},"message":{"type":"string","example":"Descriptive text"}}},"TripNotFoundErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"TripNotFoundError"},"message":{"type":"string","example":"Descriptive text"}}},"NoPlanForTripErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"NoPlanForTripError"},"message":{"type":"string","example":"Descriptive text"}}},"TooFewTimezoneChangesErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"TooFewTimezoneChangesError"},"message":{"type":"string","example":"Descriptive text"}}},"PlanAlreadyStartedErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"PlanAlreadyStartedError"},"message":{"type":"string","example":"Descriptive text"}}},"FlightTimesIncorrectErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"FlightTimesIncorrectError"},"message":{"type":"string","example":"Descriptive text"}}},"SingleFlightTooLongErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"SingleFlightTooLongError"},"message":{"type":"string","example":"Descriptive text"}}},"LayoverTimeTooLongErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"LayoverTimeTooLongError"},"message":{"type":"string","example":"Descriptive text"}}},"AirportCodeNotFoundErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"AirportCodeNotFoundError"},"message":{"type":"string","example":"Descriptive text"}}},"ParameterNotInRangeErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"ParameterNotInRangeError"},"message":{"type":"string","example":"Descriptive text"}}},"PreAdaptationNeededErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"PreAdaptationNeededError"},"message":{"type":"string","example":"Descriptive text"}}},"AirportOrderErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"AirportOrderError"},"message":{"type":"string","example":"Descriptive text"}}},"FirstFlightPreAdaptationNotAllowedErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"FirstFlightPreAdaptationNotAllowedError"},"message":{"type":"string","example":"Descriptive text"}}},"ReturnFlightsPreAdaptationNotAllowedErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"ReturnFlightsPreAdaptationNotAllowedError"},"message":{"type":"string","example":"Descriptive text"}}},"JetlagApiResponseErrorResponse":{"type":"object","properties":{"type":{"type":"string","example":"JetlagApiResponseError"},"message":{"type":"string","example":"Descriptive text"}}}},"responses":{},"parameters":{},"securityDefinitions":{},"tags":[]},"customOptions":{}}