Attach a document to a transaction
Attach a document (an invoice, a contract) to a bank transaction.
A transaction lists the document kinds it still needs in
required_documents; one created by a virtual account's deposit waits
for them before it is sent. Any bank transaction takes further documents
until it ends.
curl -X POST "https://sandbox.rasto.co/api/transactions/txn_03567gp0y9r0USMPkVcuVs/documents" \
-H "Content-Type: application/json" \
-H "Api-Version: 2026-08-01" \
-H "Idempotency-Key: 6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63" \
-H "Api-Key: YOUR_API_KEY" \
-d '{
"file": "JVBERi0xLjQgaW52b2ljZSA0Mg==",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
}'
import requests
import json
url = "https://sandbox.rasto.co/api/transactions/txn_03567gp0y9r0USMPkVcuVs/documents"
headers = {
"Content-Type": "application/json",
"Api-Version": "2026-08-01",
"Idempotency-Key": "6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63",
"Api-Key": "YOUR_API_KEY"
}
data = {
"file": "JVBERi0xLjQgaW52b2ljZSA0Mg==",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://sandbox.rasto.co/api/transactions/txn_03567gp0y9r0USMPkVcuVs/documents", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Api-Version": "2026-08-01",
"Idempotency-Key": "6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63",
"Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"file": "JVBERi0xLjQgaW52b2ljZSA0Mg==",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"file": "JVBERi0xLjQgaW52b2ljZSA0Mg==",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
}`)
req, err := http.NewRequest("POST", "https://sandbox.rasto.co/api/transactions/txn_03567gp0y9r0USMPkVcuVs/documents", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Api-Version", "2026-08-01")
req.Header.Set("Idempotency-Key", "6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63")
req.Header.Set("Api-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://sandbox.rasto.co/api/transactions/txn_03567gp0y9r0USMPkVcuVs/documents')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Api-Version'] = '2026-08-01'
request['Idempotency-Key'] = '6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63'
request['Api-Key'] = 'YOUR_API_KEY'
request.body = '{
"file": "JVBERi0xLjQgaW52b2ljZSA0Mg==",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
}'
response = http.request(request)
puts response.body
{
"bank_reference": null,
"completed_at": null,
"conversion": {
"exchange_rate": null,
"kind": "fx"
},
"created_at": "2026-11-29T18:02:17.427951+00:00",
"customer_id": "cus_03567d7njVQ4kHysbZCK51",
"destination": {
"amount": null,
"chain": null,
"currency": "inr",
"external_account_id": "ea_03567iY3DaSiJmOBFXfR0G",
"kind": "external_account",
"network": null,
"payment_rail": "rda"
},
"documents": [
{
"check": {
"mismatches": [],
"status": "approved"
},
"created_at": "2026-11-29T18:02:30.735737+00:00",
"id": "doc_03567j55B6ogR0XMYhPSq0",
"invoice": {
"amount": "200",
"currency": "usd",
"issue_date": "2026-11-01",
"number": "INV-42"
},
"kind": "invoice"
}
],
"failure_code": null,
"fees": {
"currency": "usd",
"lines": [],
"total": "0"
},
"id": "txn_03567iolKuOuN2emkb2BdR",
"object": "transaction",
"partner_reference_id": null,
"purpose": "professional_services",
"required_documents": [],
"scheme": null,
"source": {
"amount": "200",
"chain": null,
"currency": "usd",
"deposit_id": "dep_03567inyOnfeDQWLM4SMAV",
"kind": "deposit",
"network": null
},
"status": "processing",
"transaction_hash": null,
"virtual_account_id": "va_03567ieQ0xhXXs9uSxmW1d"
}
{
"error": {
"code": "missing_api_key",
"kind": "authentication_error",
"message": "Provide your secret key in the Api-Key header.",
"param": null,
"request_id": "req_03567lszGA4YWKfI2la4GG"
}
}
{
"error": {
"code": "invalid_parameter",
"kind": "invalid_request_error",
"message": "Field required",
"param": "kind",
"request_id": "req_03567lszkGWo1tCiJr4Xwp"
}
}
{
"error": {
"code": "rate_limited",
"kind": "rate_limit_error",
"message": "Too many requests. Back off and retry after the indicated delay.",
"param": null,
"request_id": "req_03567lszGA4YWKfI2la4GG"
}
}
{
"error": {
"code": "upstream_error",
"kind": "api_error",
"message": "The request could not be completed right now. Nothing was charged or changed; retry shortly, and contact support if it persists.",
"param": null,
"request_id": "req_03567lszGA4YWKfI2la4GG"
}
}
/api/transactions/{transaction_id}/documentsTarget server for requests. Edit to use your own host.
Your secret API key, sent in the Api-Key header on every request. Create keys on the dashboard. A sandbox key starts with sk_test_ and works only on https://sandbox.rasto.co; a live key starts with sk_live_ and works only on https://api.rasto.co. A read-only key can call every GET and is refused on anything that changes state. Keep keys on your server: never ship one in a browser or mobile app.
Api-Key header on every request. Create keys on the dashboard. A sandbox key starts with sk_test_ and works only on https://sandbox.rasto.co; a live key starts with sk_live_ and works only on https://api.rasto.co. A read-only key can call every GET and is refused on anything that changes state. Keep keys on your server: never ship one in a browser or mobile app.The transaction's id (txn_...).
The media type of the request body
The API version to use for this request, as a date (YYYY-MM-DD). Optional: without it you get version 2026-08-01, and that never changes. A later breaking change reaches you only when you send its newer date. Supported: 2026-08-01.
A value you choose, unique per request (a UUID works), at most 255 characters. Retrying with the same key and the same body replays the first answer instead of acting again. Keys are kept for 24 hours.
Required. What the document is: invoice, contract, purchase_order, shipping_document or other.
Required. The file, base64-encoded: a JPEG, PNG or PDF of up to about 5 MB. A data: URI is accepted.
What the invoice says. Required when kind is invoice, and refused with any other kind.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Your secret API key, sent in the Api-Key header on every request. Create keys on the dashboard. A sandbox key starts with sk_test_ and works only on https://sandbox.rasto.co; a live key starts with sk_live_ and works only on https://api.rasto.co. A read-only key can call every GET and is refused on anything that changes state. Keep keys on your server: never ship one in a browser or mobile app.
Path Parameters
Headers
The API version to use for this request, as a date (YYYY-MM-DD). Optional: without it you get version 2026-08-01, and that never changes. A later breaking change reaches you only when you send its newer date. Supported: 2026-08-01.
2026-08-01A value you choose, unique per request (a UUID works), at most 255 characters. Retrying with the same key and the same body replays the first answer instead of acting again. Keys are kept for 24 hours.
6f1c9a0e-2b7d-4c3a-9e58-0d4b7a1f2c63Body
Required. What the document is: invoice, contract, purchase_order, shipping_document or other.
invoicecontractpurchase_ordershipping_documentotherRequired. The file, base64-encoded: a JPEG, PNG or PDF of up to about 5 MB. A data: URI is accepted.
What the invoice says. Required when kind is invoice, and refused with any other kind.
Responses
The payment rail's trace reference for a payment to a bank account, which the receiving bank finds the credit by. null until known, and for an on-chain destination.
When delivery was confirmed, as an ISO 8601 timestamp. null until then.
The conversion between source and destination. null when both are the same currency.
When the object was created, as an ISO 8601 timestamp.
The customer the object belongs to.
Where the transaction delivers.
The documents attached to a payment to a bank account, oldest first. The files themselves are never returned. Empty when there are none.
Why the transaction ended without arriving, as one of our transaction failure codes. null when there is none.
What the transaction was charged: the total, its currency and each line. A later price change never rewrites it.
The object's unique identifier. Its prefix names the object kind, for example cus_ for a customer.
The kind of object this is, for example customer or transaction. Every object the API returns carries it.
Your own identifier for the object, unique per environment. null when you set none.
The purpose code of a payment to a bank account, for example family_support. null for an on-chain destination.
The document kinds the payment still needs before it is sent, for example ["invoice"]. A payment created by a virtual account's deposit waits processing until each is attached; without them it ends failed with failure_code: documents_missing after 7 days. Empty when nothing is owed.
The domestic scheme that carried a payment to a bank account: imps, neft or rtgs. null until known, and for an on-chain destination.
What funds the transaction.
The transaction's status: awaiting_authorization, processing, on_hold, completed, failed, returned, canceled or expired.
The chain transaction that delivered an on-chain destination. null until it is known, and for a bank account.
The virtual account whose standing destination created the transaction. null for any other transaction.