Create a Document
POST/v1/documentsClick to copy
Use this endpoint to upload a document onto the Razorpay ecosystem. After a document is successfully uploaded, the corresponding document id (present in response) can be provided in cases such as dispute evidence submission.
Is this page helpful?
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \2-X POST 'https://api.razorpay.com/v1/documents' \3-H "Content-Type: multipart/form-data" \4-F 'purpose=dispute_evidence' \5-F 'file=@/Users/your_name/sample_uploaded.jpeg'
Success
Failure
1{2"id": "doc_EsyWjHrfzb59Re",3"entity": "document",4"purpose": "dispute_evidence",5"name": "doc_19_12_2020.jpg",6"mime_type": "image/png",7"size": 2863,8"created_at": 15906042009}
Response Parameters
idstringThe unique identifier of the document uploaded.
entitystring Indicates the type of entity. In this case, it is document.
purposestring The reason you are uploading this document. Here, it is dispute_evidence.
sizeintegerIndicates the size of the document in bytes.
mime_typestringIndicates the nature and format in which the document is uploaded. Possible values include:
- image/jpg
- image/jpeg
- image/png
- application/pdf
created_atintegerUnix timestamp at which the document was uploaded.
Errors
The API <key/secret> provided is invalid.
Error Status: 401
The API credentials passed in the API call differ from the ones generated on the Dashboard.
- Different keys for test mode and live modes.
- Expired API key.
Solution
The file field is required.
Error Status: 400
The request did not include a file field. This endpoint expects a multipart/form-data upload with both file and purpose parts.
Solution
The purpose field is required.
Error Status: 400
The request did not include a purpose field, or the request body was empty.
Solution
invalid document upload purpose.
Error Status: 400
The value passed for purpose is not one of the supported document-upload purposes. The API echoes the rejected value, for example invalid document upload purpose:completely_invalid_purpose.
Solution
Document upload already in progress.
Error Status: 400
Another document-upload request from the same merchant is already in progress. Razorpay Curlec holds a short-lived lock per merchant to prevent concurrent uploads from clashing.
Solution
The file may not be greater than 50000 kilobytes.
Error Status: 400
The uploaded file exceeds the 50 MB (50,000 KB) size limit.
Solution
The file must be a file of type: {allowed types}.
Error Status: 400
The uploaded file's MIME type does not match the allowed types for the supplied purpose. The list of allowed types varies per purpose. For example, kyc_proof accepts pdf, jpeg, jpg, png, jfif, while opgsp_awb accepts only pdf. The error message lists the allowed types for the requested purpose.
Solution
Create a Document
POST/v1/documentsClick to copy
Use this endpoint to upload a document onto the Razorpay ecosystem. After a document is successfully uploaded, the corresponding document id (present in response) can be provided in cases such as dispute evidence submission.
Is this page helpful?
Response Parameters
idstringThe unique identifier of the document uploaded.
entitystring Indicates the type of entity. In this case, it is document.
purposestring The reason you are uploading this document. Here, it is dispute_evidence.
sizeintegerIndicates the size of the document in bytes.
mime_typestringIndicates the nature and format in which the document is uploaded. Possible values include:
- image/jpg
- image/jpeg
- image/png
- application/pdf
created_atintegerUnix timestamp at which the document was uploaded.
Errors
The API <key/secret> provided is invalid.
Error Status: 401
The API credentials passed in the API call differ from the ones generated on the Dashboard.
- Different keys for test mode and live modes.
- Expired API key.
Solution
The file field is required.
Error Status: 400
The request did not include a file field. This endpoint expects a multipart/form-data upload with both file and purpose parts.
Solution
The purpose field is required.
Error Status: 400
The request did not include a purpose field, or the request body was empty.
Solution
invalid document upload purpose.
Error Status: 400
The value passed for purpose is not one of the supported document-upload purposes. The API echoes the rejected value, for example invalid document upload purpose:completely_invalid_purpose.
Solution
Document upload already in progress.
Error Status: 400
Another document-upload request from the same merchant is already in progress. Razorpay Curlec holds a short-lived lock per merchant to prevent concurrent uploads from clashing.
Solution
The file may not be greater than 50000 kilobytes.
Error Status: 400
The uploaded file exceeds the 50 MB (50,000 KB) size limit.
Solution
The file must be a file of type: {allowed types}.
Error Status: 400
The uploaded file's MIME type does not match the allowed types for the supplied purpose. The list of allowed types varies per purpose. For example, kyc_proof accepts pdf, jpeg, jpg, png, jfif, while opgsp_awb accepts only pdf. The error message lists the allowed types for the requested purpose.
Solution
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \2-X POST 'https://api.razorpay.com/v1/documents' \3-H "Content-Type: multipart/form-data" \4-F 'purpose=dispute_evidence' \5-F 'file=@/Users/your_name/sample_uploaded.jpeg'
Success
Failure
1{2"id": "doc_EsyWjHrfzb59Re",3"entity": "document",4"purpose": "dispute_evidence",5"name": "doc_19_12_2020.jpg",6"mime_type": "image/png",7"size": 2863,8"created_at": 15906042009}