Skip to main content

Projects API

The Projects API allows you to manage projects within workspaces, including creation, import/export, and template management.


Save Project

Create or update a project in a workspace.

import prometheux_chain as px

# Create a new project
project_id = px.save_project(project_name="my_project")

# Update an existing project
updated_project_id = px.save_project(
project_id="existing_id",
project_name="updated_name"
)

Function Signature

def save_project(
project_id=None,
project_name=None,
project_scope="user"
)

Parameters

ParameterTypeRequiredDescription
project_idstrNoThe project identifier. If None, a new project will be created
project_namestrYes*The name of the project. Required when creating a new project
project_scopestrNoThe scope of the project. Defaults to "user"

Returns

The project ID of the created or updated project.


List Projects

List all projects in a workspace.

import prometheux_chain as px

# List all user projects
projects = px.list_projects()

# List projects with specific scopes
projects = px.list_projects(project_scopes=["user", "shared"])

Function Signature

def list_projects(
project_scopes=["user"]
)

Parameters

ParameterTypeRequiredDescription
project_scopeslistNoList of project scopes to filter by. Defaults to ["user"]

Returns

A list of project data dictionaries.


Load Project

Load a specific project by ID.

import prometheux_chain as px

# Load a specific project
project_data = px.load_project(project_id="my_project_id")

Function Signature

def load_project(
project_id,
project_scope="user"
)

Parameters

ParameterTypeRequiredDescription
project_idstrYesThe project identifier to load
project_scopestrNoThe scope of the project. Defaults to "user"

Returns

The project data dictionary.


List Templates

List all available project templates from the marketplace.

import prometheux_chain as px

# List all available project templates
templates = px.list_templates()
for template in templates:
print(f"Template: {template['name']} (ID: {template['id']})")

Response

{
"data": [
{
"id": "template_001",
"name": "Financial Analysis Template",
"description": "Template for financial data analysis",
"category": "finance"
},
{
"id": "template_002",
"name": "Customer Analytics Template",
"description": "Template for customer behavior analysis",
"category": "marketing"
}
],
"message": "Templates retrieved successfully",
"status": "success"
}

Import Template

Import a project from a marketplace template.

import prometheux_chain as px

# Import a template as a new project
result = px.import_template(
template_id="template_001",
new_project_name="My Financial Analysis"
)
print(f"Template imported as project: {result['name']}")

Response

{
"data": {
"id": "proj_67890",
"name": "My Financial Analysis",
"description": "Project created from Financial Analysis Template",
"scope": "user"
},
"message": "Template imported successfully as project 'My Financial Analysis'",
"status": "success"
}

Create Project from Context

Create a new project by analyzing text context and optional file attachments using AI.

import prometheux_chain as px

# Create a project from context
context = """
Analyze customer purchase patterns and identify high-value segments
for targeted marketing campaigns. Focus on seasonal trends and
customer lifetime value calculations.
"""

files = ["customer_data.csv", "marketing_report.pdf"]
result = px.create_project_from_context(
context=context,
files=files
)
print(f"Created project: {result['name']}")

Export Project

Export a project including all its data and metadata.

import prometheux_chain as px
import json

# Export a project
export_data = px.export_project(
project_id="proj_12345"
)
print(f"Exported {export_data['summary']['total_tables']} tables")

# Save export data for later import
with open("project_export.json", "w") as f:
json.dump(export_data, f)

Import Project

Import a previously exported project into a workspace.

import prometheux_chain as px
import json

# Load previously exported data
with open("project_export.json", "r") as f:
export_data = json.load(f)

# Import the project
result = px.import_project(
export_data=export_data
)
print(f"Imported project with new ID: {result['new_project_id']}")

Copy Project

Copy a project within or between workspaces.

import prometheux_chain as px

# Copy a project
result = px.copy_project(
project_id="proj_12345",
new_project_name="Copy of Financial Analysis"
)
print(f"Project copied with new ID: {result['new_project_id']}")

Cleanup Projects

Delete projects from a workspace.

import prometheux_chain as px

# Clean up all user projects
px.cleanup_projects()

# Clean up a specific project
px.cleanup_projects(project_id="my_project_id")

Function Signature

def cleanup_projects(
project_id=None,
project_scope="user"
)

Parameters

ParameterTypeRequiredDescription
project_idstrNoThe project identifier. If None, cleans up all project resources for the user
project_scopestrNoThe scope of the project. Defaults to "user"

Complete Workflow Example

import prometheux_chain as px
import os

# Set up authentication and configuration
os.environ['PMTX_TOKEN'] = 'my_pmtx_token'
px.config.set('JARVISPY_URL', "https://api.prometheux.ai/jarvispy/my-org/my-user")

# Create a new project
project_id = px.save_project(project_name="test_project")

# List all projects
projects = px.list_projects()
print(f"Available projects: {projects}")

# Load the created project
project_data = px.load_project(project_id)

# Clean up when done
px.cleanup_projects(project_id=project_id)