---
# System prepended metadata

title: Untitled

---

Users can have up to 4 documents:

- ID front
- ID back
- Proof of address
- Selfie

If all 4 documents are verified, user is verified else user is unverified.

User can resubmit for documents that have been rejected.

### **API Endpoint Design**

Design APIs for clients to query for user statusesDesign APIs for clients to submit user documents

1) User Submits documents
2) System checks if user is already verified and returns already verified response otherwise proceeds to step 3
3) the api saves the document Id to database
4) Cloudwatch triggers a lambda function whenever a file is saved to S3 which verifies the documents using 3rd party API's and then if it succeeds updates the record in database



### **Database Design**

Design tables to store user documents
// kyc_status
{
    id: 'asdasd3423423',
    documents: [
            {id:42342, status:'accepted', 'type': 'address'},
            {id:343ad, status:'rejected' 'type': 'selfie'},
            {id:gfg34, status:'accepted' 'type': 'id_front'},
            {id:43fs6, status:'accepted' 'type': 'id_back'}
            ] //these are the ids of the documents user has saved in S3,
    currentStatus: 'rejected' //can be pending, accepted, rejected
}


// user_info
{
    id: 'asdasd3423423',
    firstName: 'Huzaifa',
    lastName: 'Murtaza'
}
