Skip to main content

Overview

Tesslate Studio exposes a REST API for managing projects, agents, and deployments. The API is built with FastAPI and uses JWT authentication.
The API is primarily used internally by the Tesslate Studio frontend. However, you can use it directly for custom integrations and automation.

Base URL

https://studio.tesslate.com/api

Authentication

All API endpoints require JWT authentication using Bearer tokens.

Getting a Token

# Login to get tokens
curl -X POST https://studio.tesslate.com/api/auth/jwt/login \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "[email protected]&password=yourpassword"
Response:
{
  "access_token": "eyJ...",
  "token_type": "bearer"
}

Using the Token

Include the token in the Authorization header:
curl https://studio.tesslate.com/api/projects \
  -H "Authorization: Bearer eyJ..."

Key Endpoints

Authentication

MethodEndpointDescription
POST/auth/registerCreate a new account
POST/auth/jwt/loginLogin with email/password
POST/auth/jwt/refreshRefresh access token
GET/users/meGet current user info
GET/auth/github/authorizeStart GitHub OAuth flow
GET/auth/google/authorizeStart Google OAuth flow

Projects

MethodEndpointDescription
GET/projectsList all user projects
POST/projectsCreate a new project
GET/projects/{id}Get project details
PUT/projects/{id}Update project
DELETE/projects/{id}Delete project
POST/projects/{id}/startStart project containers
POST/projects/{id}/stopStop project containers

Chat & AI Agents

MethodEndpointDescription
POST/chat/streamSend message to AI agent (streaming)
GET/chat/{project_id}/historyGet chat history
WebSocket/ws/chat/{project_id}Real-time chat connection

Marketplace

MethodEndpointDescription
GET/marketplace/basesList available bases
GET/marketplace/agentsList available agents
POST/marketplace/purchasePurchase a base or agent

Billing

MethodEndpointDescription
GET/billing/subscriptionGet current subscription
POST/billing/subscribeCreate subscription
GET/billing/usageGet usage statistics
GET/billing/transactionsGet transaction history

Deployments

MethodEndpointDescription
POST/deploymentsCreate deployment to Vercel/Netlify
GET/deployments/{id}Get deployment status
GET/deployments/credentialsList connected providers

Example: Create a Project

curl -X POST https://studio.tesslate.com/api/projects \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My New Project",
    "description": "A sample project",
    "source_type": "template"
  }'
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My New Project",
  "slug": "my-new-project-k3x8n2",
  "description": "A sample project",
  "status": "initializing",
  "created_at": "2025-01-15T10:30:00Z"
}

Example: Chat with AI Agent

curl -X POST https://studio.tesslate.com/api/chat/stream \
  -H "Authorization: Bearer eyJ..." \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "550e8400-e29b-41d4-a716-446655440000",
    "message": "Create a hero section with a gradient background",
    "agent_id": "stream-agent-id"
  }'
The response is a Server-Sent Events stream with chunks of the AI response.

Error Handling

API errors follow a consistent format:
{
  "detail": "Error message describing what went wrong"
}
Common HTTP status codes:
  • 400 - Bad Request (invalid input)
  • 401 - Unauthorized (missing or invalid token)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found (resource doesn’t exist)
  • 422 - Validation Error (invalid request body)
  • 500 - Internal Server Error

Rate Limiting

The API implements rate limiting to prevent abuse:
  • Default: 100 requests per minute per user
  • Chat endpoints: 20 requests per minute (to manage AI costs)
When rate limited, you’ll receive a 429 Too Many Requests response.

WebSocket API

For real-time chat, connect via WebSocket:
const ws = new WebSocket('wss://studio.tesslate.com/ws/chat/PROJECT_ID?token=ACCESS_TOKEN');

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};

ws.send(JSON.stringify({
  message: "Create a button component",
  agent_id: "stream-agent-id"
}));

SDKs & Libraries

Currently, Tesslate Studio provides a REST API only. Community SDKs may be available:
  • JavaScript/TypeScript: Use fetch or axios
  • Python: Use httpx or requests

Next Steps