Production: https://api.myndphylogeny.com/v1
Development: http://localhost:8080/v1
All API requests require authentication using one of:
- JWT Token:
Authorization: Bearer <token> - API Key:
X-API-Key: <api_key>
POST /auth/register
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePass123!",
"first_name": "John",
"last_name": "Doe",
"organization_name": "My Company"
}
Response: 201 Created
{
"user": {
"id": "uuid",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"role": "owner"
},
"organization": {
"id": "uuid",
"name": "My Company",
"slug": "my-company"
},
"tokens": {
"access_token": "jwt_token",
"refresh_token": "jwt_token",
"expires_at": "2024-01-01T00:00:00Z"
}
}POST /auth/login
Content-Type: application/json
{
"email": "user@example.com",
"password": "SecurePass123!"
}
Response: 200 OK
{
"user": { "id": "uuid", "email": "user@example.com" },
"tokens": {
"access_token": "jwt_token",
"refresh_token": "jwt_token"
}
}POST /auth/refresh
Content-Type: application/json
{
"refresh_token": "jwt_token"
}
Response: 200 OK
{
"access_token": "new_jwt_token",
"refresh_token": "new_jwt_token"
}GET /auth/oauth/google
Response: Redirect to Google OAuthGET /auth/oauth/github
Response: Redirect to GitHub OAuthPOST /auth/logout
Authorization: Bearer <token>
Response: 204 No ContentGET /users/me
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"avatar_url": "https://...",
"role": "owner",
"organization": {
"id": "uuid",
"name": "My Company",
"subscription_plan": "pro"
}
}PATCH /users/me
Authorization: Bearer <token>
Content-Type: application/json
{
"first_name": "Johnny",
"last_name": "Doe"
}
Response: 200 OK
{
"id": "uuid",
"first_name": "Johnny",
"last_name": "Doe"
}GET /organizations/members
Authorization: Bearer <token>
Response: 200 OK
{
"members": [
{
"id": "uuid",
"email": "user@example.com",
"first_name": "John",
"last_name": "Doe",
"role": "owner",
"joined_at": "2024-01-01T00:00:00Z"
}
],
"total": 1
}POST /organizations/members/invite
Authorization: Bearer <token>
Content-Type: application/json
{
"email": "new@example.com",
"role": "member"
}
Response: 201 Created
{
"invitation_id": "uuid",
"email": "new@example.com",
"role": "member"
}GET /projects
Authorization: Bearer <token>
Query Parameters:
- page: number (default: 1)
- limit: number (default: 20)
- search: string
Response: 200 OK
{
"projects": [
{
"id": "uuid",
"name": "Customer Support Prompts",
"description": "Evolution of support prompts",
"prompt_count": 42,
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}POST /projects
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Customer Support Prompts",
"description": "Track evolution of support prompts",
"is_public": false
}
Response: 201 Created
{
"id": "uuid",
"name": "Customer Support Prompts",
"description": "Track evolution of support prompts",
"created_at": "2024-01-01T00:00:00Z"
}GET /projects/{projectId}
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid",
"name": "Customer Support Prompts",
"description": "Track evolution of support prompts",
"prompt_count": 42,
"tree_count": 2,
"created_at": "2024-01-01T00:00:00Z",
"created_by": {
"id": "uuid",
"name": "John Doe"
}
}PATCH /projects/{projectId}
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Updated Project Name",
"description": "Updated description"
}
Response: 200 OK
{
"id": "uuid",
"name": "Updated Project Name",
"description": "Updated description"
}DELETE /projects/{projectId}
Authorization: Bearer <token>
Response: 204 No ContentGET /projects/{projectId}/prompts
Authorization: Bearer <token>
Query Parameters:
- page: number
- limit: number
- search: string
- sort: fitness_score|-fitness_score|created_at
- is_archived: boolean
Response: 200 OK
{
"prompts": [
{
"id": "uuid",
"title": "Support Response v3",
"version": 3,
"dna_fingerprint": "a1b2c3...",
"avg_fitness": 0.8742,
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 42
}POST /projects/{projectId}/prompts
Authorization: Bearer <token>
Content-Type: application/json
{
"title": "Support Response v4",
"content": "You are a helpful customer support agent...",
"description": "Improved empathy version",
"parent_id": "uuid_of_v3",
"temperature": 0.7,
"max_tokens": 1024,
"model": "gpt-4"
}
Response: 201 Created
{
"id": "uuid",
"title": "Support Response v4",
"version": 4,
"dna_fingerprint": "d4e5f6...",
"embedding_generated": true,
"parent_id": "uuid_of_v3",
"created_at": "2024-01-01T00:00:00Z"
}GET /prompts/{promptId}
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid",
"project_id": "uuid",
"title": "Support Response v4",
"content": "You are a helpful customer support agent...",
"version": 4,
"dna_fingerprint": "d4e5f6...",
"parent_id": "uuid_of_v3",
"avg_fitness": 0.9123,
"fitness_breakdown": {
"accuracy": 0.94,
"relevance": 0.89,
"coherence": 0.92,
"creativity": 0.78
},
"mutation_count": 3,
"created_at": "2024-01-01T00:00:00Z"
}GET /prompts/{promptId}/lineage
Authorization: Bearer <token>
Response: 200 OK
{
"ancestors": [
{ "id": "uuid_v1", "version": 1, "fitness": 0.72 },
{ "id": "uuid_v2", "version": 2, "fitness": 0.78 },
{ "id": "uuid_v3", "version": 3, "fitness": 0.87 }
],
"current": { "id": "uuid_v4", "version": 4, "fitness": 0.91 },
"descendants": []
}GET /prompts/{promptId}/mutations
Authorization: Bearer <token>
Response: 200 OK
{
"mutations": [
{
"id": "uuid",
"mutation_type": "substitution",
"semantic_distance": 0.1234,
"edit_distance": 15,
"original_text": "...",
"mutated_text": "...",
"detected_at": "2024-01-01T00:00:00Z"
}
]
}GET /projects/{projectId}/trees
Authorization: Bearer <token>
Response: 200 OK
{
"trees": [
{
"id": "uuid",
"name": "Main Evolution Tree",
"algorithm": "upgma",
"node_count": 42,
"last_recalculated_at": "2024-01-01T00:00:00Z"
}
]
}POST /projects/{projectId}/trees
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Main Evolution Tree",
"algorithm": "upgma",
"prompt_ids": ["uuid1", "uuid2", "uuid3"]
}
Response: 201 Created
{
"id": "uuid",
"name": "Main Evolution Tree",
"status": "building",
"estimated_time_seconds": 30
}GET /trees/{treeId}
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid",
"name": "Main Evolution Tree",
"algorithm": "upgma",
"root_node": {
"id": "uuid",
"prompt_id": "uuid",
"children": [
{
"id": "uuid",
"prompt_id": "uuid",
"branch_length": 0.1234,
"fitness_score": 0.87,
"children": []
}
]
},
"node_count": 42,
"last_recalculated_at": "2024-01-01T00:00:00Z"
}POST /trees/{treeId}/recalculate
Authorization: Bearer <token>
Response: 202 Accepted
{
"status": "recalculating",
"job_id": "uuid"
}POST /projects/{projectId}/hybrids
Authorization: Bearer <token>
Content-Type: application/json
{
"parent_a_id": "uuid_prompt1",
"parent_b_id": "uuid_prompt2",
"method": "semantic_blend",
"weights": [0.6, 0.4]
}
Response: 201 Created
{
"id": "uuid",
"offspring_prompt": {
"id": "uuid",
"title": "Hybrid: Prompt1 + Prompt2",
"content": "Hybridized content...",
"dna_fingerprint": "hybrid_hash..."
},
"predicted_fitness_improvement": 0.0842
}GET /projects/{projectId}/hybrids
Authorization: Bearer <token>
Response: 200 OK
{
"hybrids": [
{
"id": "uuid",
"parent_a": { "id": "uuid", "title": "Prompt A" },
"parent_b": { "id": "uuid", "title": "Prompt B" },
"offspring": { "id": "uuid", "title": "Hybrid Offspring" },
"fitness_improvement": 0.0842,
"created_at": "2024-01-01T00:00:00Z"
}
]
}POST /prompts/{promptId}/fitness
Authorization: Bearer <token>
Content-Type: application/json
{
"metric_name": "accuracy",
"score": 0.9456,
"test_case_id": "uuid",
"model_used": "gpt-4",
"latency_ms": 1247,
"token_count": 842
}
Response: 201 Created
{
"id": "uuid",
"new_avg_fitness": 0.8923
}GET /prompts/{promptId}/fitness/history
Authorization: Bearer <token>
Query Parameters:
- start_date: ISO date
- end_date: ISO date
- interval: hour|day|week
Response: 200 OK
{
"history": [
{
"time": "2024-01-01T00:00:00Z",
"avg_fitness": 0.85,
"sample_count": 5
}
]
}POST /projects/{projectId}/analytics/convergent-evolution
Authorization: Bearer <token>
Response: 200 OK
{
"clusters": [
{
"cluster_id": "uuid",
"prompts": [
{ "id": "uuid1", "similarity": 0.98 },
{ "id": "uuid2", "similarity": 0.97 }
],
"centroid_embedding": [...],
"avg_fitness": 0.89
}
]
}POST /projects/{projectId}/test-runs
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Regression Test v2.0",
"prompt_ids": ["uuid1", "uuid2"],
"test_case_ids": ["uuid1", "uuid2", "uuid3"]
}
Response: 201 Created
{
"id": "uuid",
"status": "running",
"progress": 0
}GET /test-runs/{testRunId}
Authorization: Bearer <token>
Response: 200 OK
{
"id": "uuid",
"name": "Regression Test v2.0",
"status": "completed",
"results": [
{
"prompt_id": "uuid",
"test_case_id": "uuid",
"scores": {
"accuracy": 0.92,
"relevance": 0.88
},
"output": "LLM output text..."
}
],
"completed_at": "2024-01-01T00:00:00Z"
}POST /billing/checkout
Authorization: Bearer <token>
Content-Type: application/json
{
"plan": "professional",
"billing_cycle": "monthly"
}
Response: 200 OK
{
"checkout_url": "https://checkout.stripe.com/..."
}GET /billing/subscription
Authorization: Bearer <token>
Response: 200 OK
{
"plan": "professional",
"status": "active",
"current_period_end": "2024-02-01T00:00:00Z",
"usage": {
"prompts_used": 42,
"prompts_limit": 1000
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
}VALIDATION_ERROR: Input validation failedAUTHENTICATION_ERROR: Invalid or missing tokenAUTHORIZATION_ERROR: Insufficient permissionsNOT_FOUND: Resource not foundCONFLICT: Resource conflictRATE_LIMITED: Too many requestsINTERNAL_ERROR: Server error