Skip to main content

Save User Document API

Overview

Create and save a new user document. This API is used for uploading and storing user documents, particularly for KYC (Know Your Customer) verification processes.

API Details

Endpoint

POST https://api.gafapay.com:8443/gafapay/v3/user/user_document

Request Body

Required Fields

  • user_id (String): The unique identifier of the user
    • Example: 24777b9d072f49bb8d366421628805d0
  • document_user_type (Integer): Type of user document
    • Example: 5 (Agent documents)
  • document_status (Integer): Document verification status
    • 1 = PENDING
    • 2 = VERIFIED
    • 3 = EXPIRED
    • 4 = REJECTED
  • document_path (Array): Array of document file information
    • value (String): AWS S3 URL of the uploaded document
    • type (Integer): Document type identifier (always 1 for uploaded files)
    • file_type_extension (String): MIME type of the file

Optional Fields

  • document_type_id (String): Document type identifier
  • document_extra_fields_values (Array): Additional field values for document validation
  • expiry_date (Long): Document expiry timestamp (epoch)

Headers

authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyNDc3N2I5ZDA3MmY0OWJiOGQzNjY0MjE2Mjg4MDVkMCIsInJvbGVzIjpbIlJPTEVfQUdFTlQiXSwiZXhwIjoxNzU3NTI1MjQxfQ.KlzfPocW-sPvxprUqwwiX5laJkQO-a4MAfrZo-1XqgA
companyid: 59388167894b4d10a04fe5da3b8a2104
requestid: b35d332f-131e-44c1-892f-8322e022da74
Content-Type: application/json

Request Example

{
"user_id": "24777b9d072f49bb8d366421628805d0",
"document_user_type": 5,
"document_status": 1,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/devdigipaypython/gafa-bucket/default/attachment-3_mGlqf2sGakdT8VsG.jpeg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]
}

Response

{
"success": 1,
"error": [],
"data": {
"message": "USER_SAVE_DOCUMENTS_SUCCESSFULLY",
"document_master_id": "1531d56243e74e89826d986ff3944025"
}
}

Response Fields

  • success (integer): Response status indicator
    • 1 = Success
    • 0 = Failure
  • error (array): Array of error messages (empty on success)
  • data (object): Response data object
    • message (string): Success message
    • document_master_id (string): Generated document ID

Example Usage

Basic Document Upload

curl --location 'https://api.gafapay.com:8443/gafapay/v3/user/user_document' \
--header 'authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyNDc3N2I5ZDA3MmY0OWJiOGQzNjY0MjE2Mjg4MDVkMCIsInJvbGVzIjpbIlJPTEVfQUdFTlQiXSwiZXhwIjoxNzU3NTI1MjQxfQ.KlzfPocW-sPvxprUqwwiX5laJkQO-a4MAfrZo-1XqgA' \
--header 'companyid: 59388167894b4d10a04fe5da3b8a2104' \
--header 'requestid: b35d332f-131e-44c1-892f-8322e022da74' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "24777b9d072f49bb8d366421628805d0",
"document_user_type": 5,
"document_status": 1,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/devdigipaypython/gafa-bucket/default/attachment-3_mGlqf2sGakdT8VsG.jpeg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]
}'

Multiple Document Upload (Front and Back of ID)

curl --location 'https://api.gafapay.com:8443/gafapay/v3/user/user_document' \
--header 'authorization: Token YOUR_TOKEN_HERE' \
--header 'companyid: YOUR_COMPANY_ID' \
--header 'requestid: YOUR_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "24777b9d072f49bb8d366421628805d0",
"document_user_type": 5,
"document_status": 1,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/bucket/path/front.jpg",
"type": 1,
"file_type_extension": "image/jpeg"
},
{
"value": "https://s3.ap-south-1.amazonaws.com/bucket/path/back.jpg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]
}'

Document with Expiry Date

curl --location 'https://api.gafapay.com:8443/gafapay/v3/user/user_document' \
--header 'authorization: Token YOUR_TOKEN_HERE' \
--header 'companyid: YOUR_COMPANY_ID' \
--header 'requestid: YOUR_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "24777b9d072f49bb8d366421628805d0",
"document_user_type": 5,
"document_status": 1,
"document_type_id": "passport",
"expiry_date": 1893456000,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/bucket/passport.pdf",
"type": 1,
"file_type_extension": "application/pdf"
}
]
}'

Document Path Structure

The document_path array is required and must contain at least one document:

"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/bucket/path/file.jpg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]

Field Descriptions:

  • value (String, required): AWS S3 URL of the uploaded document
  • type (Integer, required): Always set to 1 for uploaded files
  • file_type_extension (String, required): MIME type of the file

Supported File Types:

  • Images: image/jpeg, image/png, image/gif
  • Documents: application/pdf, application/msword
  • Other: Various MIME types supported

Document Status Constants

  • PENDING = 1: Document is uploaded and awaiting verification
  • VERIFIED = 2: Document has been verified and approved
  • EXPIRED = 3: Document has expired
  • REJECTED = 4: Document was rejected during verification

Document User Types

  • 5 = Agent documents
  • 2 = Customer documents
  • 3 = Merchant documents

Process Flow

  1. Upload to S3: First upload the document file to AWS S3 bucket
  2. Get S3 URL: Retrieve the S3 URL of the uploaded file
  3. Create Document Record: Use this API to create the document record with S3 URL

Notes

  • AWS S3 Required: Documents must be uploaded to AWS S3 bucket before creating the document record
  • File Type Validation: Ensure the file_type_extension matches the actual file type
  • Multiple Documents: For documents requiring multiple files (like ID front/back), add multiple objects to the document_path array
  • Unique Document ID: Each document gets a unique document_master_id upon creation
  • Authentication: Requires valid authorization token and company ID