---
# 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
API enpoint: http://api.com
API: http://api.com/submit_document

Request Params: {
    username:'username',
    id_front:'id_front',
    id_back:'id_back',
    'selfie':'selfie'
}

Headers {
    token: token (if logged in already)
}

errors{
    id_front:required,
    id_front:invalid format
    id_back:required
    id_back:invalid_format
    selfie:required
    selfie:invalid format
    something went wrong while upload your document:server error when convert and upload document on s3
    something went wrong: while storing the document record in database in case of database is not available to connect
    invalid token: if token is invalid
}

success{
    code : 200
    message: document uploaded successfully
    data: {
     [
         id, document_name, path, status
     ]
    }
}

response{
    check for validation errors with error code
    error/success message based on scenario
}

api url: http://api.com/get_user_documents
headers{
    token:token
}
request params{

}
response{
    error:if document not found, token invalid
    success: if document found and token is valid
    data: [ doucument array with all document details fetch for user based on token]
}

### **Database Design**

Design tables to store user documents

table:users
(id,username,hash_password,etc)

table:user_documents
(id,user_id,document_name, document_path, document_type, status,etc)

document_type -> selfie
document_name -> fullname
document_path -> path 
status - > need to resubmit from admin