Skip to main content

Upload KYC Document

Uploads a Know Your Customer (KYC) document required for merchant verification.

Authentication required (User JWT).

POST/api/merchants/:merchantId/kyc

Authentication

This endpoint requires a valid user JWT token to be passed in the Authorization header:

Authorization: Bearer <your-jwt-token>

The user making the request must have permission to access the specified merchant account.

Path Parameters

ParameterTypeDescription
merchantIdStringThe ID of the parent merchant.

Request Body (multipart/form-data)

This endpoint expects multipart/form-data due to the file upload.

FieldTypeRequiredDescription
documentTypeString (KycDocumentType)YesType of document being uploaded (e.g., CAC_CERTIFICATE, UTILITY_BILL, DIRECTOR_ID, BANK_STATEMENT, OTHER).
documentFileFileYesThe actual document file (Allowed: JPG, PNG, PDF. Max size: 5MB).

Response 201 Created

Returns the details of the created KYC document record.

{
"message": "KYC document uploaded successfully",
"document": {
"id": "uuid-kyc-doc-123",
"merchantId": "uuid-merchant-456",
"uploadedByUserId": "uuid-user-789",
"documentType": "CAC_CERTIFICATE",
"fileUrl": "/uploads/documentFile-randomhex.pdf",
"fileName": "cac_certificate.pdf",
"status": "PENDING",
"rejectionReason": null,
"createdAt": "2023-10-27T14:00:00.000Z",
"updatedAt": "2023-10-27T14:00:00.000Z"
}
}

Errors

  • 400 Bad Request: Validation failed (missing fields, invalid file type, file too large).
  • 401 Unauthorized: Invalid or missing JWT.
  • 404 Not Found: Merchant not found.
  • 500 Internal Server Error: Server encountered an unexpected error.

File Storage

Documents are securely stored and only accessible to authorized personnel. After upload:

  1. Documents are placed in a review queue
  2. Admins will review the documents and either approve or reject them
  3. You can check the status of your documents using the Get KYC Documents endpoint

Example Requests

cURL

curl -X POST \
"https://api.skypay.com/api/merchants/uuid-merchant-456/kyc" \
-H "Authorization: Bearer <your-jwt-token>" \
-F "documentType=CAC_CERTIFICATE" \
-F "documentFile=@/path/to/your/document.pdf"

JavaScript (Fetch API)

const formData = new FormData();
formData.append('documentType', 'CAC_CERTIFICATE');
formData.append('documentFile', fileInput.files[0]);

fetch('https://api.skypay.com/api/merchants/uuid-merchant-456/kyc', {
method: 'POST',
headers: {
'Authorization': 'Bearer <your-jwt-token>'
},
body: formData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));