1. All in one
1. All in one
This is one script that allows onboarding a full customer. For a step by step representation that explains each step, please refer to the
Full flow from Customer Creation to Autoramp recipe.Copy
Ask AI
#!/usr/bin/env bash
set -euo pipefail
# This script requires the installation of:
# - jq (https://stedolan.github.io/jq/)
# - uuidgen (https://www.gnu.org/software/coreutils/uuidgen)
# Your API Key
API_KEY=''
# The IRON API Base URL. Currently set to sandbox.
BASE_URL="https://api.sandbox.iron.xyz/api"
# Helper to generate idempotency keys (requires uuidgen installation)
gen_key(){ uuidgen || echo "key-$RANDOM"; }
echo "Create Customer:"
IDEMPOTENCY_KEY=$(gen_key)
create_resp=$(curl -sSf \
-X POST "$BASE_URL/customers" \
-H "Content-Type: application/json" \
-H "X-API-Key: $API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d '{
"customer_type":"Person",
"email":"alice@example.com",
"name":"Alice Example"
}')
customer_id=$(echo "$create_resp" | jq -r '.id')
echo "Get the first Unsigned Documents:"
unsigned_documents=$(curl -sSf -X GET "${BASE_URL}/customers/${customer_id}/unsigned-documents" \
-H "X-API-Key: $API_KEY" \
-H "Accept: application/json")
# There may be multiple unsigned documents. For simplicity, we just take the first one.
unsigned_id=$(echo "$unsigned_documents" | jq -r '.items[0]["id"]')
echo "Sign Document:"
IDEMPOTENCY_KEY=$(gen_key)
signing_resp=$(curl -sSf \
-X POST "$BASE_URL/customers/$customer_id/signings" \
-H "Content-Type: application/json" \
-H "X-API-Key: $API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-d '{
"signed":true,
"document_id":"'$unsigned_id'"
}')
identification_id=$(echo "$signing_resp" | jq -r '.["id"]')
echo "Create Identification:"
IDEMPOTENCY_KEY=$(gen_key)
identification=$(curl -sSf \
-X POST "$BASE_URL/customers/$customer_id/identifications" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "X-API-Key: $API_KEY")
# The output of this (`identification`) is the following JSON:
{
"created_at":"2025-06-26T10:12:49.011195+00:00",
"id":"0197abb9-c8f2-7802-a40e-182f8d16e7b7",
"status":"Pending",
"updated_at":"2025-06-26T10:12:49.011195+00:00",
"url":"https://app.sandbox.iron.xyz/verify?Okjvl2CbD-CmHumZ9pOM8j2kFB7XX5gJevGGBYl9"
}
Please extract the `URL` and hand it over to your customer to confirm his identity.
Copy
Ask AI
{"success":true}

