Quickstart
Get started with the Pixelbase API in minutes. This guide will help you make your first API call.
Your First API Call
Install the Pixelbase SDK and initialize the client with your API key. You can get your API key from the API Keys page in your dashboard.
python
import pixelbase
API_KEY = "live_....."
client = pixelbase.PixelbaseClient(API_KEY)Initializing Pixelbase SDK
The SDK supports multiple programming languages. Choose your preferred language below:
example.py
# Downloads all completed tasks from a project and saves them to a jsonl
import json
PROJECT_NAME = "My Test Project"
def get_tasks_by_project_name(project_name: str):
tasks_generator = client.v2_get_tasks(
project_name=project_name,
status="completed",
limit=100,
)
tasks = list(tasks_generator)
return tasks
if __name__ == "__main__":
tasks = get_tasks_by_project_name(PROJECT_NAME)
with open(f"{PROJECT_NAME}.jsonl", "w+") as f:
for task in tasks:
json.dump(task.model_dump(mode='json'), f)
f.write("\n")Downloading Tasks
See our API Reference to retrieve a single task or query for tasks in a project or batch.
javascript
// Fetch all customers from your business
const response = await fetch('https://pxb.app/api/v1/customers', {
method: 'GET',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data.content);Uploading Tasks to Pixelbase
Creating a Batch
First you are expected to create a batch in the project.
python
from pixelbase.exceptions import (
PixelbaseException,
PixelbaseResourceNotFound,
)
try:
batch = client.create_batch(
project_name="My Project",
batch_name="Batch 001",
)
print(f"Created batch: {batch.id}")
except PixelbaseResourceNotFound:
print("Project not found")
except PixelbaseException as e:
print(f"Error: {e}")Creating Tasks
Once you have a batch, you can create tasks within it:
curl
curl -X POST https://pxb.app/api/v1/tasks \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"batch_id": "batch_abc123",
"data": {
"title": "Review customer feedback",
"priority": "high"
}
}'