The Reflexible API provides programmatic access to your Reflexible account, allowing you to manage projects, files, compile RFX code, and interact with AI assistants from external applications.
To get started with the Reflexible API, you'll need to create an API key from your workspace. Click the Developer Tools button (<>
) in your workspace to manage API keys.
https://reflexible.ai/api/v1
Create, read, update, and delete projects programmatically.
Upload, download, and manage files within your projects.
Compile and verify RFX code with detailed error reporting.
Start chat sessions and interact with AI assistants.
Create isolated environments for anonymous workflows.
Fine-grained permissions and access controls.
The Reflexible API uses API keys for authentication. You can create and manage API keys from the Developer Tools panel in your workspace.
Include your API key in the request headers using one of these methods:
Authorization: Bearer rfx_your_api_key_here
X-API-Key: rfx_your_api_key_here
Manage your Reflexible projects programmatically.
Retrieve a list of projects accessible to your API key.
{
"projects": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "My Robot Controller",
"updatedAt": 1640995200000,
"createdAt": 1640908800000
}
]
}
Create a new project. Requires Manager permissions.
{
"name": "New Project Name"
}
Retrieve detailed information about a specific project.
Update project name or settings. Requires Write permissions.
Delete a project permanently. Requires Manager permissions.
Upload, download, and manage files within your projects.
Get a list of all files in a project.
{
"files": [
{
"id": "file-uuid",
"path": "src/main.rfx",
"extension": "rfx",
"sizeBytes": 1024,
"mimeType": "text/plain",
"createdAt": 1640995200000,
"updatedAt": 1640995200000
}
]
}
Download the content of a specific file.
{
"file": {
"id": "file-uuid",
"path": "src/main.rfx",
"content": "// RFX code content here",
"sizeBytes": 1024,
"mimeType": "text/plain",
"contentHash": "sha256-hash",
"updatedAt": 1640995200000
}
}
Upload a new file or update an existing one. Requires Write permissions.
// Send file content as raw text in request body
// Content-Type: text/plain (or appropriate MIME type)
Delete a file from the project. Requires Write permissions.
Compile and verify your RFX code using the API.
Compile an RFX file and get compilation results.
{
"filePath": "src/main.rfx",
"content": "// Optional: RFX code to compile"
}
{
"success": true,
"result": {
"filePath": "src/main.rfx",
"compiledAt": "2024-01-01T12:00:00Z",
"output": "Compilation successful",
"warnings": [],
"metrics": {
"compilationTimeMs": 120,
"linesOfCode": 45
}
}
}
{
"success": false,
"errors": [
"Syntax error on line 5: unexpected token"
],
"warnings": []
}
Perform static analysis and verification on RFX code.
{
"filePath": "src/main.rfx",
"checkLevel": "standard", // basic, standard, strict
"content": "// Optional: RFX code to verify"
}
Interact with AI assistants programmatically.
Get all chat sessions for a project.
Start a new AI chat session.
Send a message to the AI assistant.
{
"role": "user",
"content": "Help me debug this RFX code",
"metadata": {
"context": "debugging"
}
}
Retrieve chat messages from a session.
limit
- Number of messages to return (max 100)offset
- Number of messages to skipsince
- ISO timestamp to get messages afterCheck the status of a chat session and workspace.
Create isolated environments for anonymous workflows.
Your API key must have "Allow anonymous workflows" enabled to use temporary workspaces.
Create a new temporary workspace that expires after 30 minutes of inactivity.
{
"workspace": {
"token": "tmp_workspace_token_here",
"path": "/tmp/workspaces/tmp_workspace_token_here",
"expiresAt": 1640995200000,
"createdAt": 1640993400000
}
}
Check the status of a temporary workspace.
Mark a temporary workspace for cleanup.
Understanding API error responses and status codes.
Code | Status | Description |
---|---|---|
200 | OK | Request successful |
201 | Created | Resource created successfully |
400 | Bad Request | Invalid request parameters |
401 | Unauthorized | Invalid or missing API key |
403 | Forbidden | Insufficient permissions |
404 | Not Found | Resource not found |
422 | Unprocessable Entity | Compilation or validation errors |
500 | Internal Server Error | Server error |
{
"error": "Error message",
"details": {
"field": "specific error details"
},
"timestamp": "2024-01-01T12:00:00Z"
}
Code examples for common API operations.
// Initialize API client
const API_KEY = 'rfx_your_api_key_here';
const BASE_URL = 'https://reflexible.ai/api/v1';
const headers = {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
};
// List projects
async function listProjects() {
const response = await fetch(`${BASE_URL}/projects`, { headers });
const data = await response.json();
return data.projects;
}
// Upload a file
async function uploadFile(projectId, filePath, content) {
const response = await fetch(
`${BASE_URL}/projects/${projectId}/files/${filePath}`,
{
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'text/plain'
},
body: content
}
);
return await response.json();
}
// Compile RFX code
async function compileRfx(projectId, filePath) {
const response = await fetch(
`${BASE_URL}/projects/${projectId}/rfx/compile`,
{
method: 'POST',
headers,
body: JSON.stringify({ filePath })
}
);
return await response.json();
}
import requests
import json
API_KEY = 'rfx_your_api_key_here'
BASE_URL = 'https://reflexible.ai/api/v1'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
# List projects
def list_projects():
response = requests.get(f'{BASE_URL}/projects', headers=headers)
return response.json()['projects']
# Upload a file
def upload_file(project_id, file_path, content):
response = requests.put(
f'{BASE_URL}/projects/{project_id}/files/{file_path}',
headers={'Authorization': f'Bearer {API_KEY}'},
data=content
)
return response.json()
# Start chat session
def start_chat(project_id):
response = requests.post(
f'{BASE_URL}/projects/{project_id}/chat/sessions',
headers=headers
)
return response.json()['session']
# Send chat message
def send_message(project_id, session_id, message):
payload = {
'role': 'user',
'content': message
}
response = requests.post(
f'{BASE_URL}/projects/{project_id}/chat/sessions/{session_id}/messages',
headers=headers,
json=payload
)
return response.json()
# List projects
curl -H "Authorization: Bearer rfx_your_api_key_here" \
https://reflexible.ai/api/v1/projects
# Upload a file
curl -X PUT \
-H "Authorization: Bearer rfx_your_api_key_here" \
-H "Content-Type: text/plain" \
-d "// RFX code content" \
https://reflexible.ai/api/v1/projects/PROJECT_ID/files/src/main.rfx
# Compile RFX
curl -X POST \
-H "Authorization: Bearer rfx_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"filePath": "src/main.rfx"}' \
https://reflexible.ai/api/v1/projects/PROJECT_ID/rfx/compile
# Create temporary workspace
curl -X POST \
-H "Authorization: Bearer rfx_your_api_key_here" \
https://reflexible.ai/api/v1/workspaces/temporary