List Buckets
Retrieve all buckets in your organization.
Endpoint
GET /api/buckets
Authentication
| Key Type | Allowed |
|---|---|
Admin (dakkio_a_) | ✅ Yes |
Write (dakkio_w_) | ❌ No |
Read (dakkio_r_) | ❌ No |
Required: Admin key (dakkio_a_). Only Admin keys can manage buckets at the organization level.
Why Admin key only?
Bucket management is an organization-level operation. Write and Read keys are scoped to specific buckets and cannot see or manage other buckets.
Request
Headers
| Header | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | ✅ Yes | Your Admin API key |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | ❌ No | Max results (default: 100, max: 1000) |
offset | number | ❌ No | Skip results for pagination |
Example Request
curl -X GET "https://api.dakkio.io/api/buckets" \
-H "X-API-Key: dakkio_a_your_admin_key..."
Example Request with Pagination
curl -X GET "https://api.dakkio.io/api/buckets?limit=10&offset=0" \
-H "X-API-Key: dakkio_a_your_admin_key..."
Response
Success Response (200 OK)
{
"buckets": [
{
"_id": "507f1f77bcf86cd799439011",
"name": "Home Sensors",
"description": "Temperature and humidity sensors for my home",
"createdAt": "2024-01-10T08:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
{
"_id": "507f1f77bcf86cd799439022",
"name": "Office Monitoring",
"description": "Environmental monitoring for the office",
"createdAt": "2024-01-12T14:00:00Z",
"updatedAt": "2024-01-12T14:00:00Z"
}
],
"pagination": {
"limit": 100,
"offset": 0,
"total": 2,
"hasMore": false
}
}
Empty Response (200 OK)
{
"buckets": [],
"pagination": {
"limit": 100,
"offset": 0,
"total": 0,
"hasMore": false
}
}
Error Responses
401 Unauthorized
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}
403 Forbidden
{
"error": "Forbidden",
"message": "Only Admin keys can list buckets"
}
Code Examples
JavaScript/Node.js
const axios = require('axios');
async function listBuckets() {
const response = await axios.get(
'https://api.dakkio.io/api/buckets',
{
headers: {
'X-API-Key': process.env.DAKKIO_ADMIN_KEY
}
}
);
return response.data.buckets;
}
// List all buckets
const buckets = await listBuckets();
console.log(`Found ${buckets.length} buckets`);
buckets.forEach(b => console.log(`- ${b.name} (${b._id})`));
Python
import requests
import os
def list_buckets():
response = requests.get(
'https://api.dakkio.io/api/buckets',
headers={
'X-API-Key': os.environ['DAKKIO_ADMIN_KEY']
}
)
if response.status_code == 200:
return response.json()['buckets']
else:
print('Error:', response.json())
return []
# List all buckets
buckets = list_buckets()
for bucket in buckets:
print(f"- {bucket['name']} ({bucket['_id']})")
cURL with Pagination
# Get first page
curl -X GET "https://api.dakkio.io/api/buckets?limit=10&offset=0" \
-H "X-API-Key: $DAKKIO_ADMIN_KEY"
# Get second page
curl -X GET "https://api.dakkio.io/api/buckets?limit=10&offset=10" \
-H "X-API-Key: $DAKKIO_ADMIN_KEY"
Related Endpoints
- Create Bucket - Create a new bucket
- Get Bucket - Get bucket details
- Delete Bucket - Delete a bucket