Files API

The file API allows you to retrieve details of a file upload.

POST /files

Uploads a new file.

content_type The required content type is multipart/form-data.
file File to be uploaded
purpose The reason for uploading the file

Example

curl https://test-api.pinpayments.com/1/files -u your-secret-api-key: \
 -d "file=@~/Documents/cat.jpeg" \
 -d "purpose=dispute_evidence"
200 OK
{
  "response": {
    "token": "file_M3wowEURfIpSQI6xCEoamQ",
    "original_filename": "cat.jpeg",
    "presigned_url": "https://pin-gateway-api-files-production-sandbox.s3.ap-southeast-2.amazonaws.com/sample.jpg",
    "presigned_url_expires_at": "2023-09-19T07:49:26Z",
    "purpose": "dispute_evidence",
    "size": 8060,
    "mime_type": "image/jpeg",
    "uploaded_at": "2023-09-19T06:47:54Z"
  }
}

GET /files/file-token

Returns file details by file token.

Example

curl https://test-api.pinpayments.com/1/files/file_lfUYEBK14zotCTykezJkfg -u your-secret-api-key:
200 OK
{
  "response": {
    "token": "file_M3wowEURfIpSQI6xCEoamQ",
    "original_filename": "cat.jpeg",
    "presigned_url": "https://pin-gateway-api-files-production-sandbox.s3.ap-southeast-2.amazonaws.com/sample.jpg",
    "presigned_url_expires_at": "2023-09-19T07:49:26Z",
    "purpose": "dispute_evidence",
    "size": 8060,
    "mime_type": "image/jpeg",
    "uploaded_at": "2023-09-19T06:47:54Z"
  }
}

DELETE /files/file-token

Deletes a file by token.

Example

curl https://test-api.pinpayments.com/1/files/file_lfUYEBK14zotCTykezJkfg -u your-secret-api-key: -X DELETE
204 No Content
No response body.

Error Responses

400 dispute_evidence_already_submitted {...}
{
  "error": "dispute_evidence_already_submitted",
  "error_description": "The file can not be deleted as it is associated with dispute evidence which has been submitted"
}