011. Create the upload intent
Prepare the exact file metadata locally, write it to intent.json and send the upload intent with the required write scope. The response gives you upload.id for the next step.
- Use an idempotency key between 8 and 128 characters from the safe character set.
- The declared hash must be SHA-256 of the exact file bytes.
- A retry with the same body is replayed. A different body returns a conflict.
BASE="https://your-rahunko-origin.example"
WORKSPACE_ID="ws_123"
API_KEY="rk_replace_with_your_key"
BYTE_LENGTH=$(wc -c < march.pdf | tr -d ' ')
SHA256=$(shasum -a 256 march.pdf | awk '{print $1}')
cat > intent.json <<JSON
{
"fileName": "march.pdf",
"mediaType": "application/pdf",
"byteLength": $BYTE_LENGTH,
"sha256": "$SHA256",
"sourceKind": "pdf"
}
JSON
curl -X POST "$BASE/api/v1/workspaces/$WORKSPACE_ID/uploads" \
-H "Authorization: Bearer $API_KEY" \
-H "Idempotency-Key: march-2026-upload-01" \
-H "Content-Type: application/json" \
--data-binary @intent.json