Skip to main content

Quickstart

This quickstart shows the end‑to‑end flow using the D3 Business API:
  1. Generate an API key.
  2. Upload a file.
  3. Create an operation.
  4. Poll for status.

1. Get an API key

API keys are managed via the authenticated developer routes under /v1/developer.

Generate a new API key

curl -X POST https://api.dragdropdo.com/v1/developer/generate-api-key \
  -H "Authorization: Bearer your-user-jwt" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My SaaS backend",
    "webhook_url": "https://example.com/webhooks/d3",
    "webhook_secret": "",
    "region": "us-east-1"
  }'
Response (simplified):
{
  "api_key": "d3_live_xxx",
  "rate_limit": "1000/m",
  "webhook_url": "https://example.com/webhooks/d3",
  "webhook_secret": "whsec_xxx",
  "created_at": "2025-01-01T00:00:00Z"
}
Store the api_key securely – it is only returned once. Authentication for /v1/biz endpoints uses this raw key.

2. Upload a file

Uploads are done in two steps using presigned URLs.
# Step 1: Initiate upload
curl -X POST https://api.dragdropdo.com/v1/biz/initiate-upload \
  -H "X-D3-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "file_name": "document.pdf",
    "size": 1234567,
    "mime_type": "application/pdf",
    "parts": 1
  }'

# Step 2: Upload to presigned URL

curl -X PUT "https://minio/..." \
 -H "Content-Type: application/pdf" \
 --data-binary "@document.pdf"

# Step 3: Complete upload

curl -X POST https://api.dragdropdo.com/v1/biz/complete-upload \
 -H "X-D3-API-Key: your-api-key" \
 -H "Content-Type: application/json" \
 -d '{
"file_key": "file_key_123"
}'

3. Create an operation

curl -X POST https://api.dragdropdo.com/v1/biz/do \
  -H "X-D3-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "convert",
    "file_keys": ["file_key_123"],
    "parameters": {
      "convert_to": "png"
    },
    "notes": {
      "user_id": "user-123",
      "source": "api"
    }
  }'
Response:
{
  "main_task_id": "task_abc123"
}

4. Poll for status

# Single status check
curl -X GET https://api.dragdropdo.com/v1/biz/status/task_abc123 \
  -H "X-D3-API-Key: your-api-key"

# Poll in a loop (bash example)

while true; do
response=$(curl -s -X GET https://api.dragdropdo.com/v1/biz/status/task_abc123 \
 -H "X-D3-API-Key: your-api-key")

status=$(echo $response | jq -r '.operation_status')
echo "Status: $status"

if [ "$status" = "completed" ] || [ "$status" = "failed" ]; then
echo $response | jq '.'
break
fi

sleep 2
done

Response:
{
  "operation_status": "completed",
  "files_data": [
    {
      "file_key": "file_key_123_result",
      "status": "completed",
      "download_link": "/v1/download/file_key_123_result"
    }
  ]
}
For production integrations we recommend configuring webhooks instead of / in addition to polling. See Business API → Webhooks.