cURL Examples

cURL examples for Loom API v1 verification flow.

cURL Examples

Examples use the v1 verification flow and tenant API key authentication. Base URL: https://api.loomapi.com. Auth: header x-tenant-api-key.

Prerequisites

export LOOM_TENANT_API_KEY="your_tenant_api_key_here"

Start a verification

curl -s -X POST https://api.loomapi.com/verify/start \
  -H "x-tenant-api-key: $LOOM_TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Example response:

{
  "verificationId": "verif_abc123",
  "sessionUrl": "https://verify.loomapi.com/session/xyz",
  "redirectUrl": "https://verify.loomapi.com/session/xyz"
}

Get verification status

curl -s "https://api.loomapi.com/verify/status?verificationId=verif_abc123" \
  -H "x-tenant-api-key: $LOOM_TENANT_API_KEY"

Replace verif_abc123 with the verificationId from the start response.

Validate a token

curl -s -X POST https://api.loomapi.com/tokens/validate \
  -H "x-tenant-api-key: $LOOM_TENANT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"token": "YOUR_TOKEN_FROM_SESSION"}'

Error scenarios

Invalid API key

curl -s -X POST https://api.loomapi.com/verify/start \
  -H "x-tenant-api-key: invalid_key" \
  -H "Content-Type: application/json" \
  -d '{}'

Expected: 401 with error code AUTH_INVALID_KEY.

Rate limit exceeded

If you exceed rate limits you get 429. See Rate Limits.

Minimal test script

#!/bin/bash
set -e
API_KEY="${LOOM_TENANT_API_KEY:?Set LOOM_TENANT_API_KEY}"
API_BASE="https://api.loomapi.com"

# Start verification
RESP=$(curl -s -X POST "$API_BASE/verify/start" \
  -H "x-tenant-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}')

echo "$RESP" | jq '.'

VERIFICATION_ID=$(echo "$RESP" | jq -r '.verificationId')
if [[ -z "$VERIFICATION_ID" || "$VERIFICATION_ID" == "null" ]]; then
  echo "Failed to get verificationId"
  exit 1
fi

# Poll status
echo "Checking status for $VERIFICATION_ID..."
curl -s "$API_BASE/verify/status?verificationId=$VERIFICATION_ID" \
  -H "x-tenant-api-key: $API_KEY" | jq '.'

More