Skip to main content

Your First API Call

This tutorial walks you through making your first API call to WAYSCloud. You'll upload and download a file using the Storage API with just a few commands.

Prerequisites

  • ✅ WAYSCloud account created
  • ✅ API key created (Create one now)
  • curl installed (or your preferred HTTP client)

Quick Start with cURL

Step 1: Set Your API Key

export WAYSCLOUD_API_KEY="wayscloud_storage_abc123_YourSecretKeyHere"
tip

Replace with your actual API key from my.wayscloud.services.

Step 2: List Your Buckets

curl -X GET "https://api.wayscloud.services/v1/storage/" \
-H "Authorization: Bearer $WAYSCLOUD_API_KEY"

Expected Response:

<?xml version="1.0" encoding="UTF-8"?>
<ListAllMyBucketsResult>
<Buckets>
<Bucket>
<Name>my-first-bucket</Name>
<CreationDate>2025-11-04T10:30:00.000Z</CreationDate>
</Bucket>
</Buckets>
</ListAllMyBucketsResult>

Step 3: Create a Test File

echo "Hello, WAYSCloud! This is my first API upload." > hello.txt

Step 4: Upload the File

curl -X PUT "https://api.wayscloud.services/v1/storage/my-first-bucket/hello.txt" \
-H "Authorization: Bearer $WAYSCLOUD_API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @hello.txt

Expected Response:

HTTP/1.1 200 OK
ETag: "a1b2c3d4e5f6789..."

Step 5: Download the File

curl -X GET "https://api.wayscloud.services/v1/storage/my-first-bucket/hello.txt" \
-H "Authorization: Bearer $WAYSCLOUD_API_KEY"

Expected Response:

Hello, WAYSCloud! This is my first API upload.

Step 6: Delete the File

curl -X DELETE "https://api.wayscloud.services/v1/storage/my-first-bucket/hello.txt" \
-H "Authorization: Bearer $WAYSCLOUD_API_KEY"

Expected Response:

HTTP/1.1 204 No Content

Python Quick Example

pip install requests
import os
import requests

API_KEY = os.getenv('WAYSCLOUD_API_KEY')
BASE_URL = 'https://api.wayscloud.services/v1/storage'
headers = {'Authorization': f'Bearer {API_KEY}'}

# List buckets
response = requests.get(f"{BASE_URL}/", headers=headers)
print(f"Buckets: {response.status_code}")

# Upload file
with open('hello.txt', 'rb') as f:
response = requests.put(
f"{BASE_URL}/my-first-bucket/hello.txt",
headers={**headers, 'Content-Type': 'text/plain'},
data=f
)
print(f"Upload: {response.status_code}")

# Download file
response = requests.get(f"{BASE_URL}/my-first-bucket/hello.txt", headers=headers)
print(f"Content: {response.text}")

# Delete file
response = requests.delete(f"{BASE_URL}/my-first-bucket/hello.txt", headers=headers)
print(f"Delete: {response.status_code}")

Common Errors and Solutions

401 Unauthorized

{
"error": "Invalid or expired API key"
}

Solution:

  • Verify your API key is correct
  • Check the Authorization header format: Bearer wayscloud_storage_...
  • Ensure the key is active in the dashboard

403 Forbidden

{
"error": "API key does not have permission"
}

Solution: Create a new API key with Storage service enabled.

404 Not Found

{
"error": "Bucket not found"
}

Solution: Check bucket name is correct or create the bucket first.

413 Request Entity Too Large

{
"error": "File size exceeds maximum (50GB)"
}

Solution: Use multipart upload for large files.

Next Steps

Continue Learning

Explore other WAYSCloud APIs:

  • Storage API - Complete S3-compatible storage guide
  • LLM API - Large language models (OpenAI-compatible)
  • Database API - PostgreSQL/MariaDB management
  • DNS API - Managed DNS with DNSSEC
  • GPU API - AI-powered content generation

Build in Your Language

Complete guides for your programming language:

Build Something Amazing

Ideas to get started:

  • 📸 Photo backup system
  • 📹 Video transcoding pipeline
  • 🤖 AI-powered chatbot
  • 📊 Data analytics dashboard
  • 🌐 Static website hosting

Support

Need help?