Skip to main content

Upload a transaction document

Share supporting documents for transactions proactively with the API.

Step 1: Initiate a transaction​

Initiate a transaction with any relevant mutation. Don't continue until you've successfully initiated a transactionβ€”you'll need the transaction ID for step 2.

β†’ Initiate SEPA Credit Transfers

β†’ Initiate International Credit Transfers

Step 2: Generate upload URL​

  1. Call the generateTransactionSupportingDocumentUploadUrl mutation.
  2. Enter your transactionId and filename (lines 4-5).
  3. Choose a supportingDocumentPurpose (line 6).
  4. Add the GenerateTransactionSupportingDocumentUploadUrlSuccessPayload with required key/value pairs and url (lines 14-16, 18).
  5. Add other optional messages to the payload, either for validation or in case of rejection (rejections not shown).

πŸ”Ž Open the mutation in API Explorer

mutation TransactionDocumentUrl {
generateTransactionSupportingDocumentUploadUrl(
input: {
transactionId: "$TRANSACTION_ID"
filename: "example.pdf"
supportingDocumentPurpose: ProofOfOriginOfFunds
}
) {
... on GenerateTransactionSupportingDocumentUploadUrlSuccessPayload {
__typename
supportingDocumentCollectionId
supportingDocumentId
upload {
fields {
key
value
}
url
}
}
}
}

Step 3: Recover generated URL from payload​

Recover the generated url in the payload, as well as several pairs of keys and values.

Upload URL expiration

The url is only valid for seven days, after which you'd need to generate a new url.

{
"data": {
"generateTransactionSupportingDocumentUploadUrl": {
"__typename": "GenerateTransactionSupportingDocumentUploadUrlSuccessPayload",
"supportingDocumentCollectionId": "$COLLECTION_ID",
"supportingDocumentId": "$DOCUMENT_ID",
"upload": {
"fields": [
{
"key": "Key",
"value": "INPUT/cc5a7444-f6cb-4274-9c4e-4027817bc8cb"
},
{
"key": "X-Amz-Algorithm",
"value": "AWS4-HMAC-SHA256"
},
{
"key": "X-Amz-Credential",
"value": "ASIAWHEXXLUXHYAJRMKR/20240909/eu-west-1/s3/aws4_request"
},
{
"key": "X-Amz-Date",
"value": "20240909T081927Z"
},
{
"key": "X-Amz-Security-Token",
"value": "IQoJb3JpZ2luX2VjEDEaCWV1LXdlc3QtMSJHMEUCIQCTTt/5TYXOTx4VTaIMyzsjDq/TzKJ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3V2c4Umx5MGlMWmJ5S2RuOUhFcWsrVk5XRjVXQjF2R3BKdmNBMVJyV3BUakZrZmcrR1lkZkdIWGQ1OXJEVWdENFQxL3VLSTNtYmtwRHcvcFI4WWs5SHBRc21pcWlSeU1EUHgzRllOcjFYVjE4U3JwQnNyS2wrZ2xVeHFsNE8ydEdjR1NnQzkwNjZ3QVkxV2lCL0RTdjkrTmtFK0lWUkdDU0pEVERnK3J5WFoxRGY2WmNNNlcifV19"
},
{
"key": "X-Amz-Signature",
"value": "6b5425e162c9bdd9d8e425a87d96a1f2b745d19f0be8c996cd5fee12461dbe7e"
},
{
"key": "X-Amz-Meta-X-Swan-Supporting-Document-Id",
"value": "cc5a7444-f6cb-4274-9c4e-4027817bc8cb"
}
],
"url": "https://s3.eu-west-1.amazonaws.com/swan-supporting-document-master-sandbox"
}
}
}
}

Step 4: Send POST request​

Send an HTTP POST request to the url without a Content-Type header using the following cURL command. Supported file formats are .pdf, .png, and .jpg.

curl --location --request POST '$UPLOAD_URL' \
--form 'Key="INPUT/$ID"' \
--form 'X-Amz-Algorithm="AWS4-HMAC-SHA256"' \
--form 'X-Amz-Credential="$CREDENTIAL"' \
--form 'X-Amz-Date="20220705T135458Z"' \
--form 'X-Amz-Security-Token="$TOKEN"' \
--form 'Policy="$POLICY"' \
--form 'X-Amz-Signature="$SIGNATURE"' \
--form 'X-Amz-Meta-X-Swan-Supporting-Document-Id="$DOCUMENT_ID"' \
--form 'file=@"$FILE_PATH"'

Replace all $VARIABLES with the values provided in the payload.

Upload successful

When you upload a document with the HTTP POST cURL command, Amazon sends a 204: No content error, but the document was successfully uploaded.

Step 5: Confirm upload (optional)​

At this stage, your document is uploaded. If you'd like to confirm, you can query the API.

β†’ Query the supporting document collection

β†’ Query the transaction