📦 Storage Connection Guide

Learn how to connect to your storage buckets using API keys

🔑 1. Get Your Authentication Token

First, login to get your JWT token:

curl -X POST https://baraclouds.com/api/login \
  -H "Content-Type: application/json" \
  -d '{"username":"YOUR_USERNAME","password":"YOUR_PASSWORD"}'
Your Current Token:
Loading...

🔐 2. Generate API Key (Alternative to JWT)

Go to API Keys Page to generate a permanent API key.

API keys can be used instead of JWT tokens for programmatic access.

curl -X GET https://baraclouds.com/api/buckets \
  -H "Authorization: Bearer YOUR_API_KEY"

📁 3. Storage Operations

List All Buckets

curl -X GET https://baraclouds.com/api/buckets \
  -H "Authorization: Bearer YOUR_TOKEN"

Create a New Bucket

curl -X POST https://baraclouds.com/api/buckets \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"name": "my-new-bucket"}'

Upload a File

curl -X POST https://baraclouds.com/api/buckets/MY_BUCKET/upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/your/file.txt"

List Files in a Bucket

curl -X GET https://baraclouds.com/api/buckets/MY_BUCKET/files \
  -H "Authorization: Bearer YOUR_TOKEN"

Download a File

curl -X GET "https://baraclouds.com/api/storage/OBJECT_ID/download" \
  -H "Authorization: Bearer YOUR_TOKEN" -o downloaded_file.txt

Delete a File

curl -X DELETE https://baraclouds.com/api/storage/OBJECT_ID \
  -H "Authorization: Bearer YOUR_TOKEN"

Delete a Bucket

curl -X DELETE https://baraclouds.com/api/buckets/BUCKET_NAME \
  -H "Authorization: Bearer YOUR_TOKEN"

🐍 Python Example

import requests

# Your token from login
TOKEN = "your_jwt_token_here"

# List buckets
response = requests.get(
    "https://baraclouds.com/api/buckets",
    headers={"Authorization": f"Bearer {TOKEN}"}
)
print(response.json())

# Upload a file
files = {'file': open('myfile.txt', 'rb')}
response = requests.post(
    "https://baraclouds.com/api/buckets/my-bucket/upload",
    headers={"Authorization": f"Bearer {TOKEN}"},
    files=files
)
print(response.json())