# Origin Financial Services - API Docs ## Advisor Meetings API Postman collection: [https://www.getpostman.com/collections/3e90e11fc66f29a7be67] ### Get Returns all upcoming advisor meetings of a given user. Requires a bearer token. #### Endpoint `GET advisor_meeting/v1/meetings/<user_id>` #### Example ##### Request Body is empty. ##### Response ```json [ { "id": "32fc76ae-ba0a-4b89-ae01-2ff8b7319d55", "scheduled_time": "2111-11-11T11:00:00Z" } ] ``` ### Create Creates an upcoming advisor meetings for a given user. Requires a bearer token. #### Endpoint `POST advisor_meeting/v1/meetings/<user_id>` #### Example ##### Request ```json { "scheduled_time": "2111-11-11T11:00:00Z" } ``` ##### Response ```json { "id": "32fc76ae-ba0a-4b89-ae01-2ff8b7319d55", "scheduled_time": "2111-11-11T11:00:00Z" } ``` ### Delete Destroys a given advisor meeting for a given user. Requires a bearer token. #### Endpoint `DELETE advisor_meeting/v1/meetings/<user_id>` #### Example ##### Request ```json { "id": "32fc76ae-ba0a-4b89-ae01-2ff8b7319d55" } ``` ##### Response Returns an empty body with a 204 status code. ## Bank Account API Postman collection: [https://www.getpostman.com/collections/6c600b406da2ee8ea700] ## BBVA Form API ### Create Creates a BBVA Form for a given user. Requires a bearer token. ### Endpoint `POST bank_account/v1/bbva_forms/<user_id>` ### Example #### Request ```json { "occupation": "occupation", "public_company_controller": "false", "security_exchange_worker": "true", "foreign_country_leader": "false", "electronic_communications_terms_agreed_at": "2019-07-20T10:00:00Z", "provided_certifications_and_agreements_agreed_at": "2019-07-20T10:00:00Z" } ``` ##### Response ```json { "occupation": "occupation", "public_company_controller": "false", "security_exchange_worker": "true", "foreign_country_leader": "false", "electronic_communications_terms_agreed_at": "2019-07-20T10:00:00Z", "provided_certifications_and_agreements_agreed_at": "2019-07-20T10:00:00Z" } ``` ### Update Updates all BBVA form fields for a given user. Requires a bearer token. ### Endpoint `PUT bank_account/v1/bbva_forms/<user_id>` ### Example #### Request ```json { "public_company_controller": "true", "security_exchange_worker": "false", "provided_certifications_and_agreements_agreed_at": "2019-10-20T17:00:00Z" } ``` ##### Response ```json { "occupation": "occupation", "public_company_controller": "true", "security_exchange_worker": "false", "foreign_country_leader": "false", "electronic_communications_terms_agreed_at": "2019-07-20T10:00:00Z", "provided_certifications_and_agreements_agreed_at": "2019-10-20T17:00:00Z" } ``` ## Onboarding Setup Steps ### GET Get all steps status needed to complete the onboarding. Requires a bearer token. #### Endpoint `GET financial_services/v1/onboarding_setup_steps/<user_id>` #### Example ##### Request Body is empty. ##### Response ```json { "insurance": { "auto": [ { "name": "drivers_included", "done": false }, { "name": "vehicles_included", "done": false }, { "name": "plan_selected", "done": false }, { "name": "meeting_scheduled", "done": false } ], "home": [ { "name": "plan_selected", "done": false }, { "name": "meeting_scheduled", "done": false } ], "renters": [ { "name": "plan_selected", "done": false }, { "name": "meeting_scheduled", "done": false } ], "condo": [ { "name": "plan_selected", "done": false }, { "name": "meeting_scheduled", "done": false } ], "term_life": [ { "name": "questions_answered", "done": false }, { "name": "plan_selected", "done": false }, { "name": "meeting_scheduled", "done": false } ] }, "savings": { "have_a_baby": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ], "go_to_college": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": true }, { "name": "chosen", "done": false } ], "throw_a_wedding_party": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ], "take_a_vacation": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ], "buy_a_car": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ], "build_an_emergency_fund": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ], "buy_a_house": [ { "name": "bbva_account_created", "done": false }, { "name": "bank_account_linked", "done": false }, { "name": "bbva_form_created", "done": true }, { "name": "goal_created", "done": false }, { "name": "chosen", "done": false } ] } } ``` ## Reports API Postman collection: [https://www.getpostman.com/collections/f857e1eb7e5ad2c4ad74] ## Home ### Get Returns a given user's home estimated valued based on his address. Requires a bearer token. #### Endpoint `GET reports/v1/home/<user_id>/estimated_value` #### Example ##### Request Body is empty. ##### Response ```json { "home_estimated_value": "390791" } ``` #### Error responses ##### 422 ```json { "detail": "Given user has no address answered.", "code": "user-has-no-address" } ``` ## Retirement API Postman collection: [https://www.getpostman.com/collections/3bd8b0d430f6f95f0ac5] ## Linked Bank Account ### Create Creates a linked bank account for a given user. Requires a bearer token. #### Endpoint `POST retirement/v1/401k/linked_bank_accounts/<user_id>` #### Example ```json { "public_token": "public_token", "name": "name", "mask": "mask", "institution_name": "institution_name", "institution_id": "institution_id", "account_id": "12345", "type": "investment", "subtype": "401k" } ``` ##### Response ```json { "name": "name", "mask": "mask", "institution_name": "institution_name", "institution_id": "institution_id", "account_id": "12345", "type": "investment", "subtype": "401k" } ``` #### Error responses ##### 400 ```json { "detail": "Linked account is not a 401k.", "code": "linked-account-not-401k" } ``` ## Consolidated Balance ### Retrieve Returns a consolidated balance for a given user. Requires a bearer token. #### Endpoint `GET retirement/v1/401k/portfolio/consolidated_balance/<user_id>` #### Example ##### Request Body is empty. ##### Response ```json { "total_amount": "total_amount", "asset_allocations": [ { "asset_class": "cash", "proportion": "propertion", "holdings_fees": "holdings_fees", "total_amount": "total_amount" }, { "asset_class": "bonds", "proportion": "proportion", "holdings_fees": "holdings_fees", "total_amount": "total_amount" }, { "asset_class": "stocks", "proportion": "proportion", "holdings_fees": "holdings_fees", "total_amount": "total_amount" }, { "asset_class": "other", "proportion": "proportion", "holdings_fees": "holdings_fees", "total_amount": "total_amount" } ] } ``` ## Transactions ### Retrieve Returns a list of transactions ordered from the newest to the lowest. Can be filtered with `year` and/or `max_items` as query strings. Requires a bearer token. #### Endpoint `GET retirement/v1/401k/portfolios/transactions/<user_id>?year=2019&max_items=5` ##### Request Body is empty. ##### Response ```json [ { "amount": -8.72, "date": "2019-05-05" }, { "amount": -1289.01, "date": "2019-05-04" }, { "amount": 7.7, "date": "2019-05-03" }, { "amount": -0.22, "date": "2019-05-02" }, { "amount": 1.1, "date": "2019-05-01" } ] ``` ## Savings API Postman collection: [https://www.getpostman.com/collections/4f00ae40091514208798] ## Saving Goal ### Create Creates a saving goal for a given user. Requires a bearer token. #### Endpoint `POST financial_services/savings/v1/goals/<user_id>` #### Example ##### Request ```json { "tag": "take_a_vacation", "term": 12, "total_amount": 12000.0, "monthly_amount": 1000.00 } ``` ##### Response The status code is 201. ```json { "tag": "go_to_college", "term": 12, "total_amount": 1200.0, "monthly_amount": 100.0 } ``` ### Retrieve Retrieves the saving goals of a given user. Requires a bearer token. #### Endpoint `GET financial_services/savings/v1/goals/<user_id>` #### Example ##### Request The body is empty. ##### Response The status code is 200. ```json [ { "tag": "take_a_vacation", "term": 12, "total_amount": 1200.0, "monthly_amount": 100.0 }, { "tag": "go_to_college", "term": 120, "total_amount": 18000.0, "monthly_amount": 150.0 } ] ``` ## Recommendation ### Retrieve Returns the recommendation for a given saving goal tag for a given user. Requires a bearer token. #### Endpoint `GET financial_services/savings/v1/recommendations/<user_id>/<saving_goal_tag>` #### Example ##### Request Body is empty. ##### Response ```json { "tag": "take_a_vacation", "term": 12, "total_amount": 4000.0, "monthly_amount": 333.33, "resources": { "total_time_off_in_days": 20.0, "number_of_travel_companions": 1.0, "average_vacation_expenses_per_day": 100.0 }, "description": "Covers the average travel expenses for a 30 day trip with a family your size." } ``` ### List Returns recommendations for all saving goal tags for a given user. Requires a bearer token. #### Endpoint `GET financial_services/savings/v1/recommendations/<user_id>` #### Example ##### Request Body is empty. ##### Response ```json [ { "tag": "take_a_vacation", "term": 12, "total_amount": 4000.0, "monthly_amount": 333.33, "resources": { "total_time_off_in_days": 20.0, "number_of_travel_companions": 1.0, "average_vacation_expenses_per_day": 100.0 }, "description": "Covers the average travel expenses for a 30 day trip with a family your size." }, { "tag": "throw_a_wedding_party", "term_in_months": 12, "total_amount": 35000.0, "monthly_amount": 2916.67, "resources": { "average_wedding_party_cost": 35000.0 }, "description": "Based on the average cost of a wedding party in the United States." } ] ``` ## Simulation ### Create Creates a simulation for a given user. A simulation consists in a `monthly_amount` that is calculated based on either the `total_amount` or the `resources` (which are used to calculate the `total_amount`) that are passed. If a `total_amount` is passed, the `resources` are ignored. Requires a bearer token. #### Endpoint `POST savings/v1/simulations/<user_id>` #### Example ##### Request ```json { "tag": "throw_a_wedding_party", "term_in_months": 37, "total_amount": null, "resources": { "average_wedding_party_cost": 37000.0 }, "description": "Based on the average cost of a wedding party in the United States." } ``` ##### Response ```json { "tag": "throw_a_wedding_party", "term_in_months": 37, "total_amount": 37000.0, "monthly_amount": 1000.0, "resources": { "average_wedding_party_cost": 37000.0 }, "description": "Based on the average cost of a wedding party in the United States." } ``` ## Linked Bank Account ### List List all linked bank accounts for a given user. Requires a bearer token. #### Endpoint `GET savings/v1/linked_bank_accounts/<user_id>` ### Example ```json [{ "name": "name", "mask": "mask", "institution_name": "institution_name", "type": "investment", "subtype": "checkings" }] ``` ### Create Creates a linked bank account for a given user. Requires a bearer token. #### Endpoint `POST savings/v1/linked_bank_accounts/<user_id>` #### Example ```json { "public_token": "public_token", "name": "name", "mask": "mask", "institution_name": "institution_name", "institution_id": "institution_id", "account_id": "1111", "type": "investment", "subtype": "checkings" } ``` ##### Response ```json { "name": "name", "mask": "mask", "institution_name": "institution_name", "institution_id": "institution_id", "account_id": "1111", "type": "investment", "subtype": "checkings" } ``` ## Transactions ### List Returns the transactions for a given user id. Can be filtered with `tag` and/or `max_items` as query strings. Requires a bearer token. #### Endpoint `POST savings/v1/transactions/<user_id>?tag=have_a_baby&max_items=5` #### Example ```json [ { "amount": "1000", "created_at": "2016-01-02", "processed": true, "manual": false } ] ``` ## Deposit ### Create Makes a deposit from a given user to the given savings plan tag. Requires a bearer token. #### Endpoint `POST savings/v1/savings_plan/<user_id>/<tag>/deposit` #### Example ```json { "amount": "1000" } ``` ##### Response The status code is 204. ## Withdraw ### Create Makes a withdraw from savings plan tag to the given user. Requires a bearer token. #### Endpoint `POST savings/v1/savings_plan/<user_id>/<tag>/withdraw` #### Example ```json { "amount": "1000" } ``` ##### Response The status code is 204. ## Update Updates an exististent transaction. #### Endpoint `POST savings/v1/transactions/update` #### Example ```{ "eventId": "NO-27e235a3-5f48-487b-ac3b-73034ffdbeef", "eventType": "payments:status:changed", "eventTypeVersion": "1.0.0", "subscriber": "app.open.testabc", "customerId": [ "CO-b03f6c42-ff9b-4ffc-bac4-c58179bc1bde" ], "creationTimeStamp": 1552401304, "payload": { "id": "MM-f06a75bd-4d2d-4971-9b02-6c42818a5123", "originAccount": "RA-65ee7007-d847-4b77-a555-a6ce8a31a729", "destinationAccount": "RA-27310bcb-6b17-4737-8c4b-46f385107b51", "transactionAmount": { "amount": 1.9, "currency": "USD" }, "status": { "id": "PULL_FAILED_REFUNDED" }, "dateCreated": "2019-03-06T22:17:19Z", "dateLastUpdated": "2019-03-12T14:35:04Z", "returned": [ { "id": "R01", "description": "Insufficient Funds.", "account": "ORIGIN" } ], "metadata": [ { "key": "thirdPartyId", "value": "IAVbuUsjkEyiDUu" } ] } } ``` ## Savings Plan List ### List Returns the savings plans for a given user id. Requires a bearer token. #### Endpoint `GET savings/v1/savings_plan/<user_id>` #### Example ```json [ { "tag": "have_a_baby", "deposit_day": 10, "started_at": "2020-12-12", "chosen_total_amount": 10000.0, "current_balance": 0, "deposits_left": 11, "monthly_deposit_amount": 909.09 }, { "tag": "buy_a_car", "deposit_day": 10, "started_at": null, "chosen_total_amount": 10000.0, "current_balance": 0, "deposits_left": 11, "monthly_deposit_amount": 909.09 } ] ``` #### Response No content `status_code: 204` ## Savings Plan Retrieve ### Retrieve Returns the savings plan for a given user id and tag. Requires a bearer token. #### Endpoint `GET savings/v1/savings_plan/<user_id>/<tag>` #### Example ```json { "tag": "have_a_baby", "deposit_day": 10, "started_at": "2020-12-12", "chosen_total_amount": 10000.0, "current_balance": 0, "deposits_left": 11, "monthly_deposit_amount": 909.09, "reach_by": "2022-02-20" } ``` ## Savings Plan Update ### Update Updates the savings plan for a given user id and tag. Requires a bearer token. #### Endpoint `PUT savings/v1/savings_plan/<user_id>/<tag>` #### Example ```json { "reach_by": "2025-05-16", "chosen_total_amount": 150000 } ``` #### Response ```json { "tag": "have_a_baby", "deposit_day": 10, "started_at": "2020-12-12", "chosen_total_amount": 150000, "current_balance": 0, "deposits_left": 60, "monthly_deposit_amount": 2500, "reach_by": "2025-05-16" } ``` ## Two Factor Authentication API Postman collection: [https://www.getpostman.com/collections/a123c4484ec254ddc25b] ## Send SMS Verification Send an SMS to the given number with an one-time passcode. It can receive a `phone_number`. #### Endpoint `POST two_factor_authentication/v1/one_time_passcode/<user_id>/sms/send` #### Example ##### Body ```json { "phone_number": "2025550107" } ``` ##### Response ```json { "hash_code": "gAAAAABdqL", "phone_last_digits": "0107" } ``` #### Error responses ##### 422 ```json { "detail": "Invalid phone number.", "code": "invalid-phone-number" } ``` ```json { "detail": "User already has a verified phone number.", "code": "already-has-verified-phone-number" } ``` ```json { "detail": "User does not have a verified phone number.", "code": "does-not-have-verified-phone-number" } ``` ## Verify One Time Passcode Verifies an one-time passcode. Requires a 6 digit `passcode` and a `hash_code` . #### Endpoint `POST two_factor_authentication/v1/one_time_passcode/<user_id>/sms/verify` ##### Body ```json { "hash_code": "gAAAAABdqL", "passcode": "123456" } ``` ##### Response ```json { "passcode_status": "approved" } ``` #### Error responses ##### 422 ```json { "detail": "Invalid hash code.", "code": "invalid-hash-code" } ``` ```json { "detail": "Hash_code does not belong to the user.", "code": "invalid-hash-code" } ``` ```json { "detail": "Invalid passcode.", "code": "invalid-passcode" } ``` ```json { "detail": "Phone number already has be taken.", "code": "phone-number-has-been-taken" } ``` ## For all endpoints, after TWO FACTOR AUTHENTICATION ### If user is not two factor authenticated ##### 403 ```json { "detail": "User is not two factor authenticated.", "code": "not-two-factor-authenticated" } ``` ## User account API Postman collection (user): [https://www.getpostman.com/collections/689ceb05bd04d6ad4850] Postman collection (auth): [https://www.getpostman.com/collections/e4e384469ca97272f642] ## User ### Create Creates a user. Requires an `email` and a `password`. Can also receive a `full_name`, `date_of_birth`, `social_security_number` and an `invitation_id`. #### Endpoint `POST account/v1/users` #### Example ##### Body ```json { "email": "test@test.com", "password": "new_password", "full_name": "Test Testing", "date_of_birth": "1994-06-28" } ``` ##### Response ```json { "id": "8a138805-4aec-4343-88ce-063ba479c850", "email": "test@test.com", "full_name": "Test Testing", "date_of_birth": "1994-06-28" } ``` #### Error responses ##### 409 ```json { "detail": "Email already has be taken.", "code": "email-has-been-taken" } ``` ##### 422 ```json { "detail": "This invitation belongs to a different email.", "code": "belongs-to-different-email" } ``` ### Update Updates all user fields save for email & password. Requires a bearer token. #### Endpoint `PUT account/v1/users/<user_id>` #### Example ##### Body ```json { "email": "new_email@test.com", "full_name": "Test New", "date_of_birth": "1994-06-28" } ``` ##### Response: ```json { "full_name": "Test New", "date_of_birth": "1994-06-28" } ``` ### Retrieve Retrieve an user id, full name, email, gender and employer information. Requires a bearer token. #### Endpoint `GET account/v1/users/<user_id>` #### Example ##### Response: ```json { "email": "new_email@test.com", "full_name": "Test New", "date_of_birth": "1994-06-28", "gender": "male", "employer": { "company_name": "Test Company", "retirement_401k_plaid_institution_id": "test id" } } ``` ## Token ### Create Creates new refresh and access tokens given a user's email and password. #### Endpoint `POST account/v1/auth/token` #### Example ##### Body ```json { "email": "test@test.com", "password": "password" } ``` ##### Response ```json { "user_id": "c0e66de8-d6f0-4be5-bbc1-d517d9d58ceb", "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2NTExNzg0MiwianRpIjoiOWYwYjE2NzhiMzA2NDQ0Yzg5M2NjZGVjOWQ1ZjAyZjUiLCJ1c2VyX2lkIjoiYzBlNjZkZTgtZDZmMC00YmU1LWJiYzEtZDUxN2Q5ZDU4Y2ViIn0.duy0uueCou6xlqGj0PmlQbgovLbEIg2W3eunfAgk5gc", "access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTY0NTEzOTQyLCJqdGkiOiI4NGNlYmQ4MzBlMjc0YzFjYWJiMzA4NGYzNDE1YjQwOCIsInVzZXJfaWQiOiJjMGU2NmRlOC1kNmYwLTRiZTUtYmJjMS1kNTE3ZDlkNThjZWIifQ.eOi-qIikil3pLg9jxVzxypXX1kvdOnR2ofUYV3Hs28c" } ``` ### Refresh Creates a new access token given a valid refresh token. #### Endpoint `POST account/v1/auth/token/refresh` #### Example ##### Body ```json { "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2NTExNzg0MiwianRpIjoiOWYwYjE2NzhiMzA2NDQ0Yzg5M2NjZGVjOWQ1ZjAyZjUiLCJ1c2VyX2lkIjoiYzBlNjZkZTgtZDZmMC00YmU1LWJiYzEtZDUxN2Q5ZDU4Y2ViIn0.duy0uueCou6xlqGj0PmlQbgovLbEIg2W3eunfAgk5gc" } ``` ##### Response ```json { "access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTY0NTE0MzQ0LCJqdGkiOiIwMDEyMDk0YjkyMTc0OGY4YjI3YmQ3Nzk0NWJmMDhiNiIsInVzZXJfaWQiOiJjMGU2NmRlOC1kNmYwLTRiZTUtYmJjMS1kNTE3ZDlkNThjZWIifQ._tXCg76Fsy-xfozGapR7lwwShNRWV4yolOKks1kd6NQ" } ``` #### Error responses ##### 403 ```json { "detail": "Unable to login with given credentials.", "code": "invalid-credentials" } ``` ### Delete Invalidates a given refresh token. Valid access tokens will work until its expiration date. Requires a bearer token. #### Endpoint `DELETE account/v1/auth/token` #### Example ##### Body ```json { "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2NTExOTA4NCwianRpIjoiOTFlMDQ1ZWM0YWI2NGVlY2E5ZmE3NGYwYmVjN2M4ZmMiLCJ1c2VyX2lkIjoiYzBlNjZkZTgtZDZmMC00YmU1LWJiYzEtZDUxN2Q5ZDU4Y2ViIn0.eR9gUlkDZPwYeSVmHThW2JBud1s3oQRNo3OrskX3WxM" } ``` ##### Response Returns an empty body with a 204 status code. ## Invitation ### Retrieve Retrieve an invitation. Requires an `invitation_id`. #### Endpoint `GET account/v1/invitation/<invitation_id>` #### Example ##### Response ```json { "email": "test@test.com", } ``` ## Password Recovery ### Create Send a password recovery email to the given email. #### Endpoint `POST account/v1/password_recovery` #### Example ##### Body ```json { "email": "test@test.com" } ``` ##### Response ```json { "detail": "You will receive an email with further instructions.", "code": "email-sent" } ``` `status_code: 200` ### Update Updates a password for a given token #### Endpoint `PATCH account/v1/password_recovery/reset` #### Example ##### Body ```json { "token": "CDDD70B1-5F1B-4FAC-9BAD-04B814C1E3A7", "password": "new-password" } ``` ##### Response No content `status_code: 204` ### Send User Data Email Send a email to advisors with user data and answers. #### Endpoint `GET account/v1/users/<user_id>/send_data_email` #### Example ##### Body No content ##### Response No content `status_code: 204`