cURL Examples
Copy-paste API recipes for testing WAYSCloud services from the command line. Set your API key once and run any example.
Setup
bash
# Set your API key (service-specific)
export WAYSCLOUD_API_KEY="wayscloud_dns_abc123_yourkey"
# Base URL
export API="https://api.wayscloud.services/v1"VPS
bash
# List servers
curl $API/vps -H "X-API-Key: $WAYSCLOUD_API_KEY"
# Create a VPS
curl -X POST $API/vps \
-H "X-API-Key: $WAYSCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"plan_code":"vps-4gb-2cpu","region":"NO","os_template":"ubuntu-22.04","ssh_keys":["ssh-rsa AAAA..."]}'
# Start / Stop / Reboot
curl -X POST $API/vps/{id}/start -H "X-API-Key: $WAYSCLOUD_API_KEY"
curl -X POST $API/vps/{id}/stop -H "X-API-Key: $WAYSCLOUD_API_KEY"
curl -X POST $API/vps/{id}/reboot -H "X-API-Key: $WAYSCLOUD_API_KEY"
# List plans
curl $API/vps/plans -H "X-API-Key: $WAYSCLOUD_API_KEY"See: Deploy a VPS
Databases
bash
# Create a PostgreSQL database
curl -X POST $API/databases \
-H "X-API-Key: $WAYSCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"db_name":"myapp_db","db_type":"postgresql","tier":"standard"}'
# List databases
curl $API/databases -H "X-API-Key: $WAYSCLOUD_API_KEY"See: Create a Database
Object Storage (S3)
bash
# Create a bucket
curl -X POST $API/storage/buckets \
-H "X-API-Key: $WAYSCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"bucket_name":"my-uploads","is_public":false}'
# Upload a file (using S3 credentials)
export AWS_ACCESS_KEY_ID="wayscloud_s3_my-uploads_abc123"
export AWS_SECRET_ACCESS_KEY="your-secret"
aws s3 cp file.pdf s3://my-uploads/ \
--endpoint-url https://storage.wayscloud.servicesSee: Store Files
DNS
bash
DNS_KEY="wayscloud_dns_abc123_yourkey"
# Create a zone
curl -X POST $API/dns/zones \
-H "X-API-Key: $DNS_KEY" \
-H "Content-Type: application/json" \
-d '{"zone_name":"example.com","type":"PRIMARY"}'
# Add an A record
curl -X POST $API/dns/zones/example.com/records \
-H "X-API-Key: $DNS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"www","type":"A","content":"203.0.113.42","ttl":3600}'
# Add a TXT record (SPF)
curl -X POST $API/dns/zones/example.com/records \
-H "X-API-Key: $DNS_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"","type":"TXT","content":"v=spf1 include:mail.example.com ~all","ttl":3600}'
# List records
curl $API/dns/zones/example.com/records -H "X-API-Key: $DNS_KEY"See: Create a DNS Zone
LLM
bash
LLM_KEY="wayscloud_api_abc123_yourkey"
# Chat completion
curl -X POST $API/llm/chat/completions \
-H "Authorization: Bearer $LLM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-235b-thinking",
"messages": [{"role":"user","content":"Explain DNS in one paragraph."}],
"max_tokens": 500
}'See: Run an LLM Request
SMS
bash
# Send a message (requires JWT token)
curl -X POST $API/dashboard/sms/send \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":["+4799999999"],"message":"Your order has shipped."}'See: Send an SMS
Verify (OTP)
bash
VERIFY_KEY="wayscloud_verify_abc123_yourkey"
# Send code
curl -X POST $API/verify/send \
-H "X-API-Key: $VERIFY_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"+4799999999","channel":"sms"}'
# Check code
curl -X POST $API/verify/check \
-H "X-API-Key: $VERIFY_KEY" \
-H "Content-Type: application/json" \
-d '{"session_id":"sess_abc123","code":"123456"}'See: Send OTP
Common patterns
Pagination
bash
# Most list endpoints support limit and offset
curl "$API/vps?limit=10&offset=0" -H "X-API-Key: $WAYSCLOUD_API_KEY"Error responses
bash
# Check HTTP status code
curl -o /dev/null -w "%{http_code}" -X POST $API/vps \
-H "X-API-Key: invalid_key"
# Returns: 401Next steps
- Python Integration — full Python examples
- Terraform Provider — infrastructure as code
- API Reference — complete endpoint documentation