{"_id":"5949a4ba31fdf80010e41abb","project":"54e405191e51932d006abc39","version":{"_id":"55fa37c88065a10d004e5bb6","project":"54e405191e51932d006abc39","__v":9,"createdAt":"2015-09-17T03:47:20.956Z","releaseDate":"2015-09-17T03:47:20.956Z","categories":["55fa37ca8065a10d004e5bb7","55fa37ca8065a10d004e5bb8","55fa37ca8065a10d004e5bb9","55fa37ca8065a10d004e5bba","55fca6bf34ae7c0d00ab8ea0","55ff80fd9e7ccf0d000a1d93","560220af7435de0d00fabd0d","56107f21bb9d920d00303e70","563e184077681a0d00d96a02","56fafc6596ec7e0e002ac85f","5915e54f7c2c552d008b8549","59499fcd64b5f5002690bbc1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"REST V3","version_clean":"3.1.0","version":"3.1"},"category":{"_id":"59499fcd64b5f5002690bbc1","project":"54e405191e51932d006abc39","version":"55fa37c88065a10d004e5bb6","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-20T22:21:01.625Z","from_sync":false,"order":2,"slug":"quickstart-flows","title":"Quickstart Flows"},"user":"58d1abdd704af00f0062d849","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-20T22:42:02.884Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Onboarding users (KYC) and payment flows are customized for every platform. We recommend [contacting us](doc:contact-us) before you start developing against our APIs. But if you are curious and still want to test out our APIs, this common flow can help.\n\nThe savings flow is ideal for applications that allow users to move money between their checking account to a savings account opened with our APIs. This flow will show you how to create users, add KYC, open subaccounts and make transfers.  \n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/d68d6eb-savings.png\",\n        \"savings.png\",\n        351,\n        61,\n        \"#181818\"\n      ],\n      \"border\": false,\n      \"sizing\": \"smart\",\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\n## 1. Create user account and add KYC\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/users -H 'content-type: application/json' -H 'x-sp-gateway: client_id_5p7x3zfEglJOGcR2beTCyNAKtLnVSFBXh6vdos4k|client_secret_nP213c0wuyWIdKZRXmjHTDC0FxNBkvLoVYfi6glt' -H 'x-sp-user: |e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' \\n  -d '{\\n  \\\"logins\\\": [\\n    {\\n      \\\"email\\\": \\\"test:::at:::synapsepay.com\\\"\\n    }\\n  ],\\n  \\\"phone_numbers\\\": [\\n    \\\"901.111.1111\\\",\\n    \\\"test@synapsepay.com\\\"\\n  ],\\n  \\\"legal_names\\\": [\\n    \\\"Test User\\\"\\n  ],\\n  \\\"documents\\\":[{\\n        \\\"email\\\":\\\"test@synapsepay.com\\\",\\n        \\\"phone_number\\\":\\\"901.111.1111\\\",\\n        \\\"ip\\\":\\\"::1\\\",\\n        \\\"name\\\":\\\"Test User\\\",\\n        \\\"alias\\\":\\\"Test\\\",\\n        \\\"entity_type\\\":\\\"M\\\",\\n        \\\"entity_scope\\\":\\\"Arts & Entertainment\\\",\\n        \\\"day\\\":2,\\n        \\\"month\\\":5,\\n        \\\"year\\\":1989,\\n        \\\"address_street\\\":\\\"1 Market St\\\",\\n        \\\"address_city\\\":\\\"SF\\\",\\n        \\\"address_subdivision\\\":\\\"CA\\\",\\n        \\\"address_postal_code\\\":\\\"94114\\\",\\n        \\\"address_country_code\\\":\\\"US\\\",\\n        \\\"virtual_docs\\\":[{\\n            \\\"document_value\\\":\\\"2222\\\",\\n            \\\"document_type\\\":\\\"SSN\\\"\\n        }]\\n    }],\\n  \\\"extra\\\": {\\n    \\\"supp_id\\\": \\\"122eddfgbeafrfvbbb\\\",\\n    \\\"cip_tag\\\":1,\\n    \\\"is_business\\\": false\\n  }\\n}'\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"{\\n    \\\"_id\\\": \\\"59499bc6838454002fd0c096\\\",\\n    \\\"_links\\\": {\\n        \\\"self\\\": {\\n            \\\"href\\\": \\\"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096\\\"\\n        }\\n    },\\n    \\\"client\\\": {\\n        \\\"id\\\": \\\"5949989f23dbf000229bdbaf\\\",\\n        \\\"name\\\": \\\"Test Platform\\\"\\n    },\\n    \\\"doc_status\\\": {\\n        \\\"physical_doc\\\": \\\"MISSING|INVALID\\\",\\n        \\\"virtual_doc\\\": \\\"MISSING|INVALID\\\"\\n    },\\n    \\\"documents\\\": [\\n        {\\n            \\\"id\\\": \\\"dcd19da5fb2470984d0e316fb5551269e65c109730b0b45b32a8bb1eb83d6a72\\\",\\n            \\\"name\\\": \\\"Test User\\\",\\n            \\\"permission_scope\\\": \\\"UNVERIFIED\\\",\\n            \\\"physical_docs\\\": [],\\n            \\\"social_docs\\\": [\\n                {\\n                    \\\"document_type\\\": \\\"IP\\\",\\n                    \\\"id\\\": \\\"28d9177b22c127d9a51d8903893864accf6e553ac326704a4c0d585eaad2516a\\\",\\n                    \\\"last_updated\\\": 1497996229732,\\n                    \\\"status\\\": \\\"SUBMITTED|VALID\\\"\\n                },\\n                {\\n                    \\\"document_type\\\": \\\"PHONE_NUMBER\\\",\\n                    \\\"id\\\": \\\"fda60784d6375bc44edafaaeae149626c4c13dcb92e85a2a7a00eec2cdfd2b6f\\\",\\n                    \\\"last_updated\\\": 1497996229222,\\n                    \\\"status\\\": \\\"SUBMITTED|VALID\\\"\\n                },\\n                {\\n                    \\\"document_type\\\": \\\"EMAIL\\\",\\n                    \\\"id\\\": \\\"b886811ff9cbc150065c65eb5295951ac624e3a63e57d5e016cfddc03904f46b\\\",\\n                    \\\"last_updated\\\": 1497996228710,\\n                    \\\"status\\\": \\\"SUBMITTED|VALID\\\"\\n                }\\n            ],\\n            \\\"virtual_docs\\\": [\\n                {\\n                    \\\"document_type\\\": \\\"SSN\\\",\\n                    \\\"id\\\": \\\"ee596c2896dddc19b76c07a184fe7d3cf5a04b8e94b9108190cac7890739017f\\\",\\n                    \\\"last_updated\\\": 1497996228195,\\n                    \\\"status\\\": \\\"SUBMITTED|VALID\\\"\\n                }\\n            ]\\n        }\\n    ],\\n    \\\"emails\\\": [],\\n    \\\"extra\\\": {\\n        \\\"cip_tag\\\": 1,\\n        \\\"date_joined\\\": 1497996227163,\\n        \\\"extra_security\\\": false,\\n        \\\"is_business\\\": false,\\n        \\\"last_updated\\\": 1497996227163,\\n        \\\"public_note\\\": null,\\n        \\\"supp_id\\\": \\\"122eddfgbeafrfvbbb\\\"\\n    },\\n    \\\"is_hidden\\\": false,\\n    \\\"legal_names\\\": [\\n        \\\"Test User\\\"\\n    ],\\n    \\\"logins\\\": [\\n        {\\n            \\\"email\\\": \\\"test@synapsepay.com\\\",\\n            \\\"scope\\\": \\\"READ_AND_WRITE\\\"\\n        }\\n    ],\\n    \\\"permission\\\": \\\"UNVERIFIED\\\",\\n    \\\"phone_numbers\\\": [\\n        \\\"test@synapsepay.com\\\",\\n        \\\"901.111.1111\\\"\\n    ],\\n    \\\"photos\\\": [],\\n    \\\"refresh_token\\\": \\\"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\nIn the response, you get back an `_id` associated with the user. You should store this `_id`. In addition, the `refresh_token` is included in the response which will be used to generate OAuth access, which allows you to perform operations on behalf of the user. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"User verification is async. If you do `GET` user after the `POST` user API call and all documents have been submitted and verified, the user will have `SEND-AND-RECEIVE` permissions.\\n\\nFor the purpose of this tutorial, for the user to be able to get `SEND-AND-RECEIVE` permissions, you need to supply the user's SSN number.\",\n  \"title\": \"Asynchronous User Verification\"\n}\n[/block]\n### OAuth User:\n\nIf you are using one of the Client libraries, this step is not required because the libraries automatically handle OAuth after the user is created.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/oauth/59499bc6838454002fd0c096 -H 'content-type: application/json' -H 'postman-token: d7e038c8-1bd4-8b71-1e91-913b0676283f' -H 'x-sp-gateway: client_id_5p7x3zfEglJOGcR2beTCyNAKtLnVSFBXh6vdos4k|client_secret_nP213c0wuyWIdKZRXmjHTDC0FxNBkvLoVYfi6glt' -H 'x-sp-user: |e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\\n    \\\"refresh_token\\\":\\\"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\\\"\\n}'\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"{\\n    \\\"client_id\\\": \\\"5949989f23dbf000229bdbaf\\\",\\n    \\\"client_name\\\": \\\"Test Platform\\\",\\n    \\\"expires_at\\\": \\\"1498007186\\\",\\n    \\\"expires_in\\\": \\\"7200\\\",\\n    \\\"oauth_key\\\": \\\"oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet\\\",\\n    \\\"refresh_expires_in\\\": 8,\\n    \\\"refresh_token\\\": \\\"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\\\",\\n    \\\"scope\\\": [\\n        \\\"USER|PATCH\\\",\\n        \\\"USER|GET\\\",\\n        \\\"NODES|POST\\\",\\n        \\\"NODES|GET\\\",\\n        \\\"NODE|GET\\\",\\n        \\\"NODE|PATCH\\\",\\n        \\\"NODE|DELETE\\\",\\n        \\\"TRANS|POST\\\",\\n        \\\"TRANS|GET\\\",\\n        \\\"TRAN|GET\\\",\\n        \\\"TRAN|PATCH\\\",\\n        \\\"TRAN|DELETE\\\"\\n    ],\\n    \\\"user_id\\\": \\\"59499bc6838454002fd0c096\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\nFrom the response, you need to capture the `oauth_key` to make further requests on the user's behalf.\n\n## 2. Link External Account\n\nIn this step we will allow the user to link an external bank account by using their online banking credentials.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes -H 'content-type: application/json' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\\n  \\\"type\\\": \\\"ACH-US\\\",\\n  \\\"info\\\":{\\n    \\\"bank_id\\\":\\\"synapse_good\\\",\\n    \\\"bank_pw\\\":\\\"test1234\\\",\\n    \\\"bank_name\\\":\\\"fake\\\"\\n  }\\n}'\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"{\\n    \\\"error_code\\\": \\\"10\\\",\\n    \\\"http_code\\\": \\\"202\\\",\\n    \\\"mfa\\\": {\\n        \\\"access_token\\\": \\\"fake_cd60680b9addc01295b34a6e3d14473e3cc65aa82d3\\\",\\n        \\\"message\\\": \\\"I heard you like questions so we put a question in your question?\\\",\\n        \\\"type\\\": \\\"question\\\"\\n    },\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"json\",\n      \"name\": \"MFA Response\"\n    }\n  ]\n}\n[/block]\nIn most cases when a user tries to log in with their bank account, the user is challenged with an MFA response—this can be either question-based or code-based. You need to capture the `access_token` in order to continue linking the account.\n\n### Perform MFA\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes -H 'content-type: application/json' -H 'postman-token: fa66ac69-8835-999d-7ad2-3e9ed259a087' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' \\n-d '{\\n \\\"access_token\\\":\\\"fake_cd60680b9addc01295b34a6e3d14473e3cc65aa82d3\\\",\\n \\\"mfa_answer\\\":\\\"test_answer\\\"\\n}'\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"{\\n    \\\"error_code\\\": \\\"0\\\",\\n    \\\"http_code\\\": \\\"200\\\",\\n    \\\"limit\\\": 2,\\n    \\\"node_count\\\": 2,\\n    \\\"nodes\\\": [\\n        {\\n            \\\"_id\\\": \\\"5949ae324d1d6200370ff5db\\\",\\n            \\\"_links\\\": {\\n                \\\"self\\\": {\\n                    \\\"href\\\": \\\"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5db\\\"\\n                }\\n            },\\n            \\\"allowed\\\": \\\"CREDIT-AND-DEBIT\\\",\\n            \\\"client\\\": {\\n                \\\"id\\\": \\\"5949989f23dbf000229bdbaf\\\",\\n                \\\"name\\\": \\\"Test Platform\\\"\\n            },\\n            \\\"extra\\\": {\\n                \\\"other\\\": {},\\n                \\\"supp_id\\\": \\\"\\\"\\n            },\\n            \\\"info\\\": {\\n                \\\"account_num\\\": \\\"8902\\\",\\n                \\\"address\\\": \\\"PO BOX 85139, RICHMOND, VA, US\\\",\\n                \\\"balance\\\": {\\n                    \\\"amount\\\": \\\"750.00\\\",\\n                    \\\"currency\\\": \\\"USD\\\"\\n                },\\n                \\\"bank_long_name\\\": \\\"CAPITAL ONE N.A.\\\",\\n                \\\"bank_name\\\": \\\"CAPITAL ONE N.A.\\\",\\n                \\\"class\\\": \\\"SAVINGS\\\",\\n                \\\"match_info\\\": {\\n                    \\\"email_match\\\": \\\"match\\\",\\n                    \\\"name_match\\\": \\\"match\\\",\\n                    \\\"phonenumber_match\\\": \\\"no_match\\\"\\n                },\\n                \\\"name_on_account\\\": \\\" \\\",\\n                \\\"nickname\\\": \\\"SynapsePay Test Savings Account - 8902\\\",\\n                \\\"routing_num\\\": \\\"6110\\\",\\n                \\\"type\\\": \\\"BUSINESS\\\"\\n            },\\n            \\\"is_active\\\": true,\\n            \\\"timeline\\\": [\\n                {\\n                    \\\"date\\\": 1498000945638,\\n                    \\\"note\\\": \\\"Node created.\\\"\\n                }\\n            ],\\n            \\\"type\\\": \\\"ACH-US\\\",\\n            \\\"user_id\\\": \\\"59499bc6838454002fd0c096\\\"\\n        },\\n        {\\n            ...\\n        }\\n    ],\\n    \\\"page_count\\\": 1,\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\nFrom the response, you need to capture the `_id`. Now user's external account is ready for transfers. Now you need to create a subaccount for your user. \n\n## 3. Create Subaccount\n\nIn this step we will allow the user to link a sub-account with Synapse.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes  -H 'content-type: application/json' -H 'postman-token: ac89cde7-239b-3f48-ab06-950253ae6722' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\\n  \\\"type\\\": \\\"SUBACCOUNT-US\\\",\\n  \\\"info\\\":{\\n      \\\"nickname\\\":\\\"My Savings Account\\\"\\n  }\\n}'\",\n      \"language\": \"json\",\n      \"name\": \"cURL\"\n    },\n    {\n      \"code\": \"{\\n    \\\"error_code\\\": \\\"0\\\",\\n    \\\"http_code\\\": \\\"200\\\",\\n    \\\"limit\\\": 20,\\n    \\\"node_count\\\": 1,\\n    \\\"nodes\\\": [\\n        {\\n            \\\"_id\\\": \\\"5949b1334d1d62002e7af1dc\\\",\\n            \\\"_links\\\": {\\n                \\\"self\\\": {\\n                    \\\"href\\\": \\\"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949b1334d1d62002e7af1dc\\\"\\n                }\\n            },\\n            \\\"allowed\\\": \\\"CREDIT-AND-DEBIT\\\",\\n            \\\"client\\\": {\\n                \\\"id\\\": \\\"5949989f23dbf000229bdbaf\\\",\\n                \\\"name\\\": \\\"Test Platform\\\"\\n            },\\n            \\\"extra\\\": {\\n                \\\"other\\\": {},\\n                \\\"supp_id\\\": \\\"\\\"\\n            },\\n            \\\"info\\\": {\\n                \\\"balance\\\": {\\n                    \\\"amount\\\": 0,\\n                    \\\"currency\\\": \\\"USD\\\"\\n                },\\n                \\\"name_on_account\\\": \\\" \\\",\\n                \\\"nickname\\\": \\\"My Savings Account\\\"\\n            },\\n            \\\"is_active\\\": true,\\n            \\\"timeline\\\": [\\n                {\\n                    \\\"date\\\": 1498001715653,\\n                    \\\"note\\\": \\\"Node created.\\\"\\n                }\\n            ],\\n            \\\"type\\\": \\\"SUBACCOUNT-US\\\",\\n            \\\"user_id\\\": \\\"59499bc6838454002fd0c096\\\"\\n        }\\n    ],\\n    \\\"page_count\\\": 1,\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\nFrom the response, you need to capture the `_id`.\n\n## 4. Create Transaction\n\nNow the user is ready to transfer money from their external account to their subaccount.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5de/trans -H 'content-type: application/json' -H 'x-sp-idempotency-key: a938b7083253972554ce8e9dd5eb4e86e271b2a346d52ad136eccd21606d6215' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\\n  \\\"to\\\": {\\n    \\\"type\\\": \\\"SUBACCOUNT-US\\\",\\n    \\\"id\\\": \\\"5949b1334d1d62002e7af1dc\\\"\\n  },\\n  \\\"amount\\\": {\\n    \\\"amount\\\": 100,\\n    \\\"currency\\\": \\\"USD\\\"\\n  },\\n  \\\"extra\\\": {\\n    \\\"ip\\\": \\\"192.168.0.1\\\"\\n  }\\n}'\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"{\\n    \\\"_id\\\": \\\"5949b3712f8896002dfa8320\\\",\\n    \\\"_links\\\": {\\n        \\\"self\\\": {\\n            \\\"href\\\": \\\"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5de/trans/5949b3712f8896002dfa8320\\\"\\n        }\\n    },\\n    \\\"_v\\\": 2,\\n    \\\"amount\\\": {\\n        \\\"amount\\\": 100,\\n        \\\"currency\\\": \\\"USD\\\"\\n    },\\n    \\\"client\\\": {\\n        \\\"id\\\": \\\"5949989f23dbf000229bdbaf\\\",\\n        \\\"name\\\": \\\"Test Platform\\\"\\n    },\\n    \\\"extra\\\": {\\n        \\\"created_on\\\": 1498002289132,\\n        \\\"ip\\\": \\\"192.168.0.1\\\",\\n        \\\"latlon\\\": \\\"0,0\\\",\\n        \\\"note\\\": \\\"\\\",\\n        \\\"process_on\\\": 1498002289132,\\n        \\\"supp_id\\\": \\\"\\\"\\n    },\\n    \\\"fees\\\": [\\n        {\\n            \\\"fee\\\": 0,\\n            \\\"note\\\": \\\"Facilitator Fee\\\",\\n            \\\"to\\\": {\\n                \\\"id\\\": \\\"None\\\"\\n            }\\n        }\\n    ],\\n    \\\"from\\\": {\\n        \\\"id\\\": \\\"5949ae324d1d6200370ff5de\\\",\\n        \\\"nickname\\\": \\\"SynapsePay Test Checking Account - 8901\\\",\\n        \\\"type\\\": \\\"ACH-US\\\",\\n        \\\"user\\\": {\\n            \\\"_id\\\": \\\"59499bc6838454002fd0c096\\\",\\n            \\\"legal_names\\\": []\\n        }\\n    },\\n    \\\"recent_status\\\": {\\n        \\\"date\\\": 1498002289132,\\n        \\\"note\\\": \\\"Transaction Created.\\\",\\n        \\\"status\\\": \\\"CREATED\\\",\\n        \\\"status_id\\\": \\\"1\\\"\\n    },\\n    \\\"timeline\\\": [\\n        {\\n            \\\"date\\\": 1498002289132,\\n            \\\"note\\\": \\\"Transaction Created.\\\",\\n            \\\"status\\\": \\\"CREATED\\\",\\n            \\\"status_id\\\": \\\"1\\\"\\n        }\\n    ],\\n    \\\"to\\\": {\\n        \\\"id\\\": \\\"5949b1334d1d62002e7af1dc\\\",\\n        \\\"nickname\\\": \\\"\\\",\\n        \\\"type\\\": \\\"SUBACCOUNT-US\\\",\\n        \\\"user\\\": {\\n            \\\"_id\\\": \\\"\\\",\\n            \\\"legal_names\\\": []\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Response\"\n    }\n  ]\n}\n[/block]\nThat's it! Now you have a basic savings application working with Synapse. This is the bare bones version. If you have any questions, please [Contact us](doc:contact-us) and we will be more than happy to assist.","excerpt":"Common Flow for Savings Platforms","slug":"savings-flow","type":"basic","title":"Savings Flow"}

Savings Flow

Common Flow for Savings Platforms

Onboarding users (KYC) and payment flows are customized for every platform. We recommend [contacting us](doc:contact-us) before you start developing against our APIs. But if you are curious and still want to test out our APIs, this common flow can help. The savings flow is ideal for applications that allow users to move money between their checking account to a savings account opened with our APIs. This flow will show you how to create users, add KYC, open subaccounts and make transfers. [block:image] { "images": [ { "image": [ "https://files.readme.io/d68d6eb-savings.png", "savings.png", 351, 61, "#181818" ], "border": false, "sizing": "smart", "caption": "" } ] } [/block] ## 1. Create user account and add KYC [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/users -H 'content-type: application/json' -H 'x-sp-gateway: client_id_5p7x3zfEglJOGcR2beTCyNAKtLnVSFBXh6vdos4k|client_secret_nP213c0wuyWIdKZRXmjHTDC0FxNBkvLoVYfi6glt' -H 'x-sp-user: |e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' \n -d '{\n \"logins\": [\n {\n \"email\": \"test@synapsepay.com\"\n }\n ],\n \"phone_numbers\": [\n \"901.111.1111\",\n \"test@synapsepay.com\"\n ],\n \"legal_names\": [\n \"Test User\"\n ],\n \"documents\":[{\n \"email\":\"test@synapsepay.com\",\n \"phone_number\":\"901.111.1111\",\n \"ip\":\"::1\",\n \"name\":\"Test User\",\n \"alias\":\"Test\",\n \"entity_type\":\"M\",\n \"entity_scope\":\"Arts & Entertainment\",\n \"day\":2,\n \"month\":5,\n \"year\":1989,\n \"address_street\":\"1 Market St\",\n \"address_city\":\"SF\",\n \"address_subdivision\":\"CA\",\n \"address_postal_code\":\"94114\",\n \"address_country_code\":\"US\",\n \"virtual_docs\":[{\n \"document_value\":\"2222\",\n \"document_type\":\"SSN\"\n }]\n }],\n \"extra\": {\n \"supp_id\": \"122eddfgbeafrfvbbb\",\n \"cip_tag\":1,\n \"is_business\": false\n }\n}'", "language": "curl" }, { "code": "{\n \"_id\": \"59499bc6838454002fd0c096\",\n \"_links\": {\n \"self\": {\n \"href\": \"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096\"\n }\n },\n \"client\": {\n \"id\": \"5949989f23dbf000229bdbaf\",\n \"name\": \"Test Platform\"\n },\n \"doc_status\": {\n \"physical_doc\": \"MISSING|INVALID\",\n \"virtual_doc\": \"MISSING|INVALID\"\n },\n \"documents\": [\n {\n \"id\": \"dcd19da5fb2470984d0e316fb5551269e65c109730b0b45b32a8bb1eb83d6a72\",\n \"name\": \"Test User\",\n \"permission_scope\": \"UNVERIFIED\",\n \"physical_docs\": [],\n \"social_docs\": [\n {\n \"document_type\": \"IP\",\n \"id\": \"28d9177b22c127d9a51d8903893864accf6e553ac326704a4c0d585eaad2516a\",\n \"last_updated\": 1497996229732,\n \"status\": \"SUBMITTED|VALID\"\n },\n {\n \"document_type\": \"PHONE_NUMBER\",\n \"id\": \"fda60784d6375bc44edafaaeae149626c4c13dcb92e85a2a7a00eec2cdfd2b6f\",\n \"last_updated\": 1497996229222,\n \"status\": \"SUBMITTED|VALID\"\n },\n {\n \"document_type\": \"EMAIL\",\n \"id\": \"b886811ff9cbc150065c65eb5295951ac624e3a63e57d5e016cfddc03904f46b\",\n \"last_updated\": 1497996228710,\n \"status\": \"SUBMITTED|VALID\"\n }\n ],\n \"virtual_docs\": [\n {\n \"document_type\": \"SSN\",\n \"id\": \"ee596c2896dddc19b76c07a184fe7d3cf5a04b8e94b9108190cac7890739017f\",\n \"last_updated\": 1497996228195,\n \"status\": \"SUBMITTED|VALID\"\n }\n ]\n }\n ],\n \"emails\": [],\n \"extra\": {\n \"cip_tag\": 1,\n \"date_joined\": 1497996227163,\n \"extra_security\": false,\n \"is_business\": false,\n \"last_updated\": 1497996227163,\n \"public_note\": null,\n \"supp_id\": \"122eddfgbeafrfvbbb\"\n },\n \"is_hidden\": false,\n \"legal_names\": [\n \"Test User\"\n ],\n \"logins\": [\n {\n \"email\": \"test@synapsepay.com\",\n \"scope\": \"READ_AND_WRITE\"\n }\n ],\n \"permission\": \"UNVERIFIED\",\n \"phone_numbers\": [\n \"test@synapsepay.com\",\n \"901.111.1111\"\n ],\n \"photos\": [],\n \"refresh_token\": \"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\"\n}", "language": "json", "name": "Response" } ] } [/block] In the response, you get back an `_id` associated with the user. You should store this `_id`. In addition, the `refresh_token` is included in the response which will be used to generate OAuth access, which allows you to perform operations on behalf of the user. [block:callout] { "type": "info", "body": "User verification is async. If you do `GET` user after the `POST` user API call and all documents have been submitted and verified, the user will have `SEND-AND-RECEIVE` permissions.\n\nFor the purpose of this tutorial, for the user to be able to get `SEND-AND-RECEIVE` permissions, you need to supply the user's SSN number.", "title": "Asynchronous User Verification" } [/block] ### OAuth User: If you are using one of the Client libraries, this step is not required because the libraries automatically handle OAuth after the user is created. [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/oauth/59499bc6838454002fd0c096 -H 'content-type: application/json' -H 'postman-token: d7e038c8-1bd4-8b71-1e91-913b0676283f' -H 'x-sp-gateway: client_id_5p7x3zfEglJOGcR2beTCyNAKtLnVSFBXh6vdos4k|client_secret_nP213c0wuyWIdKZRXmjHTDC0FxNBkvLoVYfi6glt' -H 'x-sp-user: |e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\n \"refresh_token\":\"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\"\n}'", "language": "curl" }, { "code": "{\n \"client_id\": \"5949989f23dbf000229bdbaf\",\n \"client_name\": \"Test Platform\",\n \"expires_at\": \"1498007186\",\n \"expires_in\": \"7200\",\n \"oauth_key\": \"oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet\",\n \"refresh_expires_in\": 8,\n \"refresh_token\": \"refresh_FBCt0DOU9NvcfKpe3lbr7ghisaoq2ImduPERx4nW\",\n \"scope\": [\n \"USER|PATCH\",\n \"USER|GET\",\n \"NODES|POST\",\n \"NODES|GET\",\n \"NODE|GET\",\n \"NODE|PATCH\",\n \"NODE|DELETE\",\n \"TRANS|POST\",\n \"TRANS|GET\",\n \"TRAN|GET\",\n \"TRAN|PATCH\",\n \"TRAN|DELETE\"\n ],\n \"user_id\": \"59499bc6838454002fd0c096\"\n}", "language": "json", "name": "Response" } ] } [/block] From the response, you need to capture the `oauth_key` to make further requests on the user's behalf. ## 2. Link External Account In this step we will allow the user to link an external bank account by using their online banking credentials. [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes -H 'content-type: application/json' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\n \"type\": \"ACH-US\",\n \"info\":{\n \"bank_id\":\"synapse_good\",\n \"bank_pw\":\"test1234\",\n \"bank_name\":\"fake\"\n }\n}'", "language": "curl" }, { "code": "{\n \"error_code\": \"10\",\n \"http_code\": \"202\",\n \"mfa\": {\n \"access_token\": \"fake_cd60680b9addc01295b34a6e3d14473e3cc65aa82d3\",\n \"message\": \"I heard you like questions so we put a question in your question?\",\n \"type\": \"question\"\n },\n \"success\": true\n}", "language": "json", "name": "MFA Response" } ] } [/block] In most cases when a user tries to log in with their bank account, the user is challenged with an MFA response—this can be either question-based or code-based. You need to capture the `access_token` in order to continue linking the account. ### Perform MFA [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes -H 'content-type: application/json' -H 'postman-token: fa66ac69-8835-999d-7ad2-3e9ed259a087' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' \n-d '{\n \"access_token\":\"fake_cd60680b9addc01295b34a6e3d14473e3cc65aa82d3\",\n \"mfa_answer\":\"test_answer\"\n}'", "language": "curl" }, { "code": "{\n \"error_code\": \"0\",\n \"http_code\": \"200\",\n \"limit\": 2,\n \"node_count\": 2,\n \"nodes\": [\n {\n \"_id\": \"5949ae324d1d6200370ff5db\",\n \"_links\": {\n \"self\": {\n \"href\": \"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5db\"\n }\n },\n \"allowed\": \"CREDIT-AND-DEBIT\",\n \"client\": {\n \"id\": \"5949989f23dbf000229bdbaf\",\n \"name\": \"Test Platform\"\n },\n \"extra\": {\n \"other\": {},\n \"supp_id\": \"\"\n },\n \"info\": {\n \"account_num\": \"8902\",\n \"address\": \"PO BOX 85139, RICHMOND, VA, US\",\n \"balance\": {\n \"amount\": \"750.00\",\n \"currency\": \"USD\"\n },\n \"bank_long_name\": \"CAPITAL ONE N.A.\",\n \"bank_name\": \"CAPITAL ONE N.A.\",\n \"class\": \"SAVINGS\",\n \"match_info\": {\n \"email_match\": \"match\",\n \"name_match\": \"match\",\n \"phonenumber_match\": \"no_match\"\n },\n \"name_on_account\": \" \",\n \"nickname\": \"SynapsePay Test Savings Account - 8902\",\n \"routing_num\": \"6110\",\n \"type\": \"BUSINESS\"\n },\n \"is_active\": true,\n \"timeline\": [\n {\n \"date\": 1498000945638,\n \"note\": \"Node created.\"\n }\n ],\n \"type\": \"ACH-US\",\n \"user_id\": \"59499bc6838454002fd0c096\"\n },\n {\n ...\n }\n ],\n \"page_count\": 1,\n \"success\": true\n}", "language": "json", "name": "Response" } ] } [/block] From the response, you need to capture the `_id`. Now user's external account is ready for transfers. Now you need to create a subaccount for your user. ## 3. Create Subaccount In this step we will allow the user to link a sub-account with Synapse. [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes -H 'content-type: application/json' -H 'postman-token: ac89cde7-239b-3f48-ab06-950253ae6722' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\n \"type\": \"SUBACCOUNT-US\",\n \"info\":{\n \"nickname\":\"My Savings Account\"\n }\n}'", "language": "json", "name": "cURL" }, { "code": "{\n \"error_code\": \"0\",\n \"http_code\": \"200\",\n \"limit\": 20,\n \"node_count\": 1,\n \"nodes\": [\n {\n \"_id\": \"5949b1334d1d62002e7af1dc\",\n \"_links\": {\n \"self\": {\n \"href\": \"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949b1334d1d62002e7af1dc\"\n }\n },\n \"allowed\": \"CREDIT-AND-DEBIT\",\n \"client\": {\n \"id\": \"5949989f23dbf000229bdbaf\",\n \"name\": \"Test Platform\"\n },\n \"extra\": {\n \"other\": {},\n \"supp_id\": \"\"\n },\n \"info\": {\n \"balance\": {\n \"amount\": 0,\n \"currency\": \"USD\"\n },\n \"name_on_account\": \" \",\n \"nickname\": \"My Savings Account\"\n },\n \"is_active\": true,\n \"timeline\": [\n {\n \"date\": 1498001715653,\n \"note\": \"Node created.\"\n }\n ],\n \"type\": \"SUBACCOUNT-US\",\n \"user_id\": \"59499bc6838454002fd0c096\"\n }\n ],\n \"page_count\": 1,\n \"success\": true\n}", "language": "json", "name": "Response" } ] } [/block] From the response, you need to capture the `_id`. ## 4. Create Transaction Now the user is ready to transfer money from their external account to their subaccount. [block:code] { "codes": [ { "code": "curl -X POST https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5de/trans -H 'content-type: application/json' -H 'x-sp-idempotency-key: a938b7083253972554ce8e9dd5eb4e86e271b2a346d52ad136eccd21606d6215' -H 'x-sp-user: oauth_EdsiI8FOkKz1QaBGqHAxLl5Xjv4o7nCDThp0yUet|e83cf6ddcf778e37bfe3d48fc78a6502062fc1030449628c699ef3c4ffa6f9a2000b8acc3c4c0addd8013285bb52c89e5267b628ca02fa84a6d71fe186b7cd5d' -H 'x-sp-user-ip: 127.0.0.1' -d '{\n \"to\": {\n \"type\": \"SUBACCOUNT-US\",\n \"id\": \"5949b1334d1d62002e7af1dc\"\n },\n \"amount\": {\n \"amount\": 100,\n \"currency\": \"USD\"\n },\n \"extra\": {\n \"ip\": \"192.168.0.1\"\n }\n}'", "language": "curl" }, { "code": "{\n \"_id\": \"5949b3712f8896002dfa8320\",\n \"_links\": {\n \"self\": {\n \"href\": \"https://uat-api.synapsefi.com/v3.1/users/59499bc6838454002fd0c096/nodes/5949ae324d1d6200370ff5de/trans/5949b3712f8896002dfa8320\"\n }\n },\n \"_v\": 2,\n \"amount\": {\n \"amount\": 100,\n \"currency\": \"USD\"\n },\n \"client\": {\n \"id\": \"5949989f23dbf000229bdbaf\",\n \"name\": \"Test Platform\"\n },\n \"extra\": {\n \"created_on\": 1498002289132,\n \"ip\": \"192.168.0.1\",\n \"latlon\": \"0,0\",\n \"note\": \"\",\n \"process_on\": 1498002289132,\n \"supp_id\": \"\"\n },\n \"fees\": [\n {\n \"fee\": 0,\n \"note\": \"Facilitator Fee\",\n \"to\": {\n \"id\": \"None\"\n }\n }\n ],\n \"from\": {\n \"id\": \"5949ae324d1d6200370ff5de\",\n \"nickname\": \"SynapsePay Test Checking Account - 8901\",\n \"type\": \"ACH-US\",\n \"user\": {\n \"_id\": \"59499bc6838454002fd0c096\",\n \"legal_names\": []\n }\n },\n \"recent_status\": {\n \"date\": 1498002289132,\n \"note\": \"Transaction Created.\",\n \"status\": \"CREATED\",\n \"status_id\": \"1\"\n },\n \"timeline\": [\n {\n \"date\": 1498002289132,\n \"note\": \"Transaction Created.\",\n \"status\": \"CREATED\",\n \"status_id\": \"1\"\n }\n ],\n \"to\": {\n \"id\": \"5949b1334d1d62002e7af1dc\",\n \"nickname\": \"\",\n \"type\": \"SUBACCOUNT-US\",\n \"user\": {\n \"_id\": \"\",\n \"legal_names\": []\n }\n }\n}", "language": "json", "name": "Response" } ] } [/block] That's it! Now you have a basic savings application working with Synapse. This is the bare bones version. If you have any questions, please [Contact us](doc:contact-us) and we will be more than happy to assist.