Skip to main content

Update User Document API

Overview

Update an existing user document. This API allows you to modify document information including file paths, status, and other metadata.

API Details

Endpoint

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

Request Body

Required Fields

  • id (String): The unique identifier of the document to update
    • Example: 3e14e8ea518b4d64a9970c9b35723173

Optional Fields

  • 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
  • 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

{
"id": "3e14e8ea518b4d64a9970c9b35723173",
"document_user_type": 5,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/digipaypython/40qwd7.jpg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]
}

Response

{
"success": 1,
"error": [],
"data": {
"message": "USER_UPDATE_DOCUMENTS_SUCCESSFULLY"
}
}

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

Example Usage

Update Document File

curl --location --request PUT '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 '{
"id": "3e14e8ea518b4d64a9970c9b35723173",
"document_user_type": 5,
"document_path": [
{
"value": "https://s3.ap-south-1.amazonaws.com/digipaypython/40qwd7.jpg",
"type": 1,
"file_type_extension": "image/jpeg"
}
]
}'

Update Document Status

curl --location --request PUT '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 '{
"id": "3e14e8ea518b4d64a9970c9b35723173",
"document_status": 2
}'

Update Multiple Document Files

curl --location --request PUT '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 '{
"id": "3e14e8ea518b4d64a9970c9b35723173",
"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"
}
]
}'

Update Document with Expiry Date

curl --location --request PUT '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 '{
"id": "3e14e8ea518b4d64a9970c9b35723173",
"document_status": 2,
"expiry_date": 1893456000,
"document_type_id": "passport"
}'

Document Path Structure

When updating document files, use the same structure as creating documents:

"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

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

Update Scenarios

1. File Replacement

Update the document_path with new S3 URLs when replacing files.

2. Status Updates

Update document_status to reflect verification progress.

3. Metadata Updates

Update document_type_id, expiry_date, or other metadata fields.

4. Multiple File Updates

Replace or add multiple files in the document_path array.

Process Flow

  1. Upload New File to S3: If updating file, upload new file to S3 first
  2. Get New S3 URL: Retrieve the new S3 URL
  3. Update Document Record: Use this API to update the document with new information

Notes

  • Partial Updates: You can update only specific fields - not all fields are required
  • AWS S3 Integration: If updating file paths, ensure new files are uploaded to S3 first
  • Audit Trail: Document updates are tracked with updated_by and updated_date fields
  • File Type Validation: Ensure the file_type_extension matches the actual file type
  • Authentication: Requires valid authorization token and company ID