cURL Guide

All Toolkit API endpoints work with cURL. These examples show common patterns.

GET Requests

Many endpoints use query parameters (for example DNS lookups and status checks):

curl -X GET "https://dns.toolkitapi.io/v1/lookup?domain=toolkitapi.io&type=A" \
  -H "X-API-Key: YOUR_KEY"

JSON POST Requests

Other endpoints use JSON POST bodies:

curl -X POST https://auth.toolkitapi.io/v1/auth/hash-password \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"password": "my-secret-password"}'

Pretty-Print Output

Pipe through jq for formatted output:

curl -s -X GET "https://dns.toolkitapi.io/v1/lookup?domain=toolkitapi.io&type=A" \
  -H "X-API-Key: YOUR_KEY" | jq .

File Uploads

For image, PDF, and file conversion endpoints, use -F for multipart form data:

curl -X POST https://image.toolkitapi.io/v1/image/convert \
  -H "X-API-Key: YOUR_KEY" \
  -F "[email protected]" \
  -F "format=webp" \
  --output photo.webp

Saving Binary Output

For endpoints that return binary data (images and PDFs):

curl -X POST https://image.toolkitapi.io/v1/image/from-html \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"html": "<html><body><h1>Hello</h1></body></html>", "format": "png"}' \
  --output screenshot.png

Checking Response Headers

Use -i to see response headers including rate limit info:

curl -i -X GET "https://dns.toolkitapi.io/v1/lookup?domain=toolkitapi.io&type=A" \
  -H "X-API-Key: YOUR_KEY"

Environment Variables

Store your key in an environment variable to avoid repeating it:

export TOOLKIT_KEY="YOUR_KEY"

curl -X GET "https://dns.toolkitapi.io/v1/lookup?domain=toolkitapi.io&type=A" \
  -H "X-API-Key: $TOOLKIT_KEY"